Skip to content

Commit d541fc9

Browse files
authored
Merge pull request #990 from JuliaRobotics/23Q1/enh/pcktojustvar
rn PackedVariable to Variable,
2 parents 866808a + 5392496 commit d541fc9

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/entities/DFGVariable.jl

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,15 @@ getEstimateFields(::MeanMaxPPE) = [:suggested, :max, :mean]
177177
## DFG Variables
178178
##==============================================================================
179179

180-
# Packed Variable
181-
Base.@kwdef struct PackedVariable <: AbstractDFGVariable
180+
181+
export Variable
182+
183+
"""
184+
$(TYPEDEF)
185+
186+
The Variable information packed in a way that accomdates multi-lang using json.
187+
"""
188+
Base.@kwdef struct Variable <: AbstractDFGVariable
182189
id::Union{UUID, Nothing} = nothing
183190
label::Symbol
184191
tags::Vector{Symbol} = Symbol[]
@@ -194,7 +201,7 @@ Base.@kwdef struct PackedVariable <: AbstractDFGVariable
194201
end
195202

196203
#IIF like contruction helper for packed variable
197-
function PackedVariable(
204+
function Variable(
198205
label::Symbol,
199206
variableType::String;
200207
tags::Vector{Symbol} = Symbol[],
@@ -206,7 +213,7 @@ function PackedVariable(
206213
)
207214
union!(tags, [:VARIABLE])
208215

209-
pacvar = PackedVariable(;
216+
pacvar = Variable(;
210217
label,
211218
variableType,
212219
nstime = string(nanosecondtime),
@@ -219,10 +226,11 @@ function PackedVariable(
219226

220227
return pacvar
221228
end
229+
const PackedVariable = Variable
222230

223-
StructTypes.StructType(::Type{PackedVariable}) = StructTypes.UnorderedStruct()
224-
StructTypes.idproperty(::Type{PackedVariable}) = :id
225-
StructTypes.omitempties(::Type{PackedVariable}) = (:id,)
231+
StructTypes.StructType(::Type{Variable}) = StructTypes.UnorderedStruct()
232+
StructTypes.idproperty(::Type{Variable}) = :id
233+
StructTypes.omitempties(::Type{Variable}) = (:id,)
226234

227235
##------------------------------------------------------------------------------
228236
## DFGVariable lv2
@@ -424,8 +432,8 @@ StructTypes.omitempties(::Type{SkeletonDFGVariable}) = (:id,)
424432
##==============================================================================
425433
# Define variable levels
426434
##==============================================================================
427-
const VariableDataLevel0 = Union{DFGVariable, DFGVariableSummary, PackedVariable, SkeletonDFGVariable}
428-
const VariableDataLevel1 = Union{DFGVariable, DFGVariableSummary, PackedVariable}
435+
const VariableDataLevel0 = Union{DFGVariable, DFGVariableSummary, Variable, SkeletonDFGVariable}
436+
const VariableDataLevel1 = Union{DFGVariable, DFGVariableSummary, Variable}
429437
const VariableDataLevel2 = Union{DFGVariable}
430438

431439
##==============================================================================

0 commit comments

Comments
 (0)