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