@@ -332,17 +332,22 @@ function packFactor(dfg::AbstractDFG, f::DFGFactor)
332
332
return props
333
333
end
334
334
335
- function decodePackedType (:: Type{T} , packeddata:: GenericFunctionNodeData{PT} ) where {T<: FactorOperationalMemory , PT}
336
- # usrtyp = convert(FunctorInferenceType, packeddata.fnc)
335
+ function reconstFactorData () end
336
+
337
+ function decodePackedType (dfg:: AbstractDFG , varOrder:: AbstractVector{Symbol} , :: Type{T} , packeddata:: GenericFunctionNodeData{PT} ) where {T<: FactorOperationalMemory , PT}
338
+ #
339
+ # TODO , to solve IIF 1424
340
+ # variables = map(lb->getVariable(dfg, lb), varOrder)
341
+
337
342
# Also look at parentmodule
338
343
usrtyp = convertStructType (PT)
339
344
fulltype = DFG. FunctionNodeData{T{usrtyp}}
340
- factordata = convert ( fulltype, packeddata)
345
+ factordata = reconstFactorData (dfg, varOrder, fulltype, packeddata)
341
346
return factordata
342
347
end
343
348
344
-
345
- function unpackFactor (dfg:: G , packedProps:: Dict{String, Any} ):: DFGFactor where G <: AbstractDFG
349
+ # Returns `::DFGFactor`
350
+ function unpackFactor (dfg:: G , packedProps:: Dict{String, Any} ) where G <: AbstractDFG
346
351
# Version checking.
347
352
_versionCheck (packedProps)
348
353
@@ -369,10 +374,18 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any})::DFGFactor where G
369
374
# FIXME type instability from nothing to T
370
375
packed = nothing
371
376
fullFactorData = nothing
377
+
378
+ # Get the stored variable order
379
+ _variableOrderSymbols = if packedProps[" _variableOrderSymbols" ] isa String
380
+ JSON2. read (packedProps[" _variableOrderSymbols" ], Vector{Symbol})
381
+ else
382
+ Symbol .(packedProps[" _variableOrderSymbols" ])
383
+ end
384
+
372
385
try
373
386
packed = JSON2. read (data, GenericFunctionNodeData{packtype})
374
387
decodeType = getFactorOperationalMemoryType (dfg)
375
- fullFactorData = decodePackedType (decodeType, packed)
388
+ fullFactorData = decodePackedType (dfg, _variableOrderSymbols, decodeType, packed)
376
389
catch ex
377
390
io = IOBuffer ()
378
391
showerror (io, ex, catch_backtrace ())
@@ -381,12 +394,6 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any})::DFGFactor where G
381
394
error (msg)
382
395
end
383
396
384
- # Include the type
385
- if packedProps[" _variableOrderSymbols" ] isa String
386
- _variableOrderSymbols = JSON2. read (packedProps[" _variableOrderSymbols" ], Vector{Symbol})
387
- else
388
- _variableOrderSymbols = Symbol .(packedProps[" _variableOrderSymbols" ])
389
- end
390
397
solvable = packedProps[" solvable" ]
391
398
392
399
# Rebuild DFGFactor
0 commit comments