Skip to content

Commit e8e590b

Browse files
committed
Smalldata update
1 parent a6fe4ee commit e8e590b

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/entities/DFGVariable.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ getEstimateFields(::MeanMaxPPE) = [:suggested, :max, :mean]
217217
## DFG Variables
218218
##==============================================================================
219219

220+
const SmallDataType = Union{Int, Float64, String, Bool, Vector{Int}, Vector{Float64}, Vector{String}, Vector{Bool}}
221+
220222
##------------------------------------------------------------------------------
221223
## DFGVariable lv2
222224
##------------------------------------------------------------------------------
@@ -248,7 +250,7 @@ struct DFGVariable{T<:InferenceVariable} <: AbstractDFGVariable
248250
solverDataDict::Dict{Symbol, VariableNodeData{T}}
249251
"""Dictionary of small data associated with this variable.
250252
Accessors: [`getSmallData`](@ref), [`setSmallData!`](@ref)"""
251-
smallData::Dict{String, String}#Ref{Dict{String, String}} #why was Ref here?
253+
smallData::Dict{String, SmallDataType}
252254
"""Dictionary of large data associated with this variable.
253255
Accessors: [`addDataEntry!`](@ref), [`getDataEntry`](@ref), [`updateDataEntry!`](@ref), and [`deleteDataEntry!`](@ref)"""
254256
dataDict::Dict{Symbol, AbstractDataEntry}
@@ -270,7 +272,7 @@ function DFGVariable(label::Symbol, softtype::T;
270272
tags::Set{Symbol}=Set{Symbol}(),
271273
estimateDict::Dict{Symbol, <: AbstractPointParametricEst}=Dict{Symbol, MeanMaxPPE}(),
272274
solverDataDict::Dict{Symbol, VariableNodeData{T}}=Dict{Symbol, VariableNodeData{T}}(),
273-
smallData::Dict{String, String}=Dict{String, String}(),
275+
smallData::Dict{String, SmallDataType}=Dict{String, SmallDataType}(),
274276
dataDict::Dict{Symbol, AbstractDataEntry}=Dict{Symbol,AbstractDataEntry}(),
275277
solvable::Int=1) where {T <: InferenceVariable}
276278

@@ -287,7 +289,7 @@ function DFGVariable(label::Symbol,
287289
nstime::Nanosecond = Nanosecond(0),
288290
tags::Set{Symbol}=Set{Symbol}(),
289291
estimateDict::Dict{Symbol, <: AbstractPointParametricEst}=Dict{Symbol, MeanMaxPPE}(),
290-
smallData::Dict{String, String}=Dict{String, String}(),
292+
smallData::Dict{String, SmallDataType}=Dict{String, SmallDataType}(),
291293
dataDict::Dict{Symbol, AbstractDataEntry}=Dict{Symbol,AbstractDataEntry}(),
292294
solvable::Int=1) where {T <: InferenceVariable}
293295
if timestamp isa DateTime

src/services/DFGVariable.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,14 @@ setSolverData!(v::DFGVariable, data::VariableNodeData, key::Symbol=:default) = v
273273
$(SIGNATURES)
274274
Get the small data for a variable.
275275
"""
276-
getSmallData(v::DFGVariable)::Dict{String, String} = v.smallData
276+
getSmallData(v::DFGVariable)::Dict{String, SmallDataType} = v.smallData
277277

278278
"""
279279
$(SIGNATURES)
280280
Set the small data for a variable.
281281
This will overwrite old smallData.
282282
"""
283-
function setSmallData!(v::DFGVariable, smallData::Dict{String, String})::Dict{String, String}
283+
function setSmallData!(v::DFGVariable, smallData::Dict{String, SmallDataType})
284284
empty!(v.smallData)
285285
merge!(v.smallData, smallData)
286286
end

src/services/Serialization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function unpackVariable(dfg::G,
3939
tags = Symbol.(packedProps["tags"])
4040
end
4141
ppeDict = unpackPPEs ? JSON2.read(packedProps["ppeDict"], Dict{Symbol, MeanMaxPPE}) : Dict{Symbol, MeanMaxPPE}()
42-
smallData = JSON2.read(packedProps["smallData"], Dict{String, String})
42+
smallData = JSON2.read(packedProps["smallData"], Dict{String, SmallDataType})
4343

4444
softtypeString = packedProps["softtype"]
4545
softtype = getTypeFromSerializationModule(dfg, Symbol(softtypeString))

0 commit comments

Comments
 (0)