Skip to content

Commit c451df9

Browse files
committed
Fix nstime serialised as a string
1 parent 3e91117 commit c451df9

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

docs/src/variable_factor_serialization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ prior = addFactor!(dfg, [:x0], PriorPose2( MvNormal([10; 10; 1.0/8.0], Matrix(Di
2626

2727
# Now serialize them:
2828
pVariable = packVariable(dfg, x0)
29-
pFactor = packFactor(dfg, prior)
29+
pFactor = packFactor(prior)
3030

3131
# And we can deserialize them
3232
upVariable = unpackVariable(dfg, pVariable)
@@ -60,7 +60,7 @@ for v in getVariables(dfg)
6060
end
6161
# Factors
6262
for f in getFactors(dfg)
63-
fPacked = packFactor(dfg, f)
63+
fPacked = packFactor(f)
6464
io = open("$folder/factors/$(f.label).json", "w")
6565
JSON3.write(io, fPacked)
6666
close(io)

src/Deprecated.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## ================================================================================
33
## Remove in v0.21
44
##=================================================================================
5-
5+
@deprecate packFactor(dfg::AbstractDFG, f::DFGFactor) packFactor(f::DFGFactor)
66

77
# #TODO check this one
88
# function addData!(

src/entities/DFGFactor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Base.@kwdef struct PackedFactor <: AbstractDFGFactor
8989
tags::Vector{Symbol}
9090
_variableOrderSymbols::Vector{Symbol}
9191
timestamp::ZonedDateTime
92-
nstime::Int
92+
nstime::String
9393
fnctype::String
9494
solvable::Int
9595
data::String

src/entities/DFGVariable.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Base.@kwdef struct PackedVariable <: AbstractDFGVariable
183183
label::Symbol
184184
tags::Vector{Symbol} = Symbol[]
185185
timestamp::ZonedDateTime = now(tz"UTC")
186-
nstime::Int = 0
186+
nstime::String = "0"
187187
ppes::Vector{MeanMaxPPE} = MeanMaxPPE[]
188188
blobEntries::Vector{BlobEntry} = BlobEntry[]
189189
variableType::String

src/services/Serialization.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function packVariable(v::AbstractDFGVariable; includePPEs::Bool=true, includeSol
151151
id=v.id,
152152
label = v.label,
153153
timestamp = v.timestamp,
154-
nstime = v.nstime.value,
154+
nstime = string(v.nstime.value),
155155
tags = collect(v.tags), # Symbol.()
156156
ppes = collect(values(v.ppeDict)),
157157
solverData = packVariableNodeData.(collect(values(v.solverDataDict))),
@@ -216,15 +216,15 @@ function _packSolverData(
216216
end
217217

218218
# returns PackedFactor
219-
function packFactor(dfg::AbstractDFG, f::DFGFactor)
219+
function packFactor(f::DFGFactor)
220220
fnctype = getSolverData(f).fnc.usrfnc!
221221
return PackedFactor(;
222222
id = f.id,
223223
label = f.label,
224224
tags = collect(f.tags),
225225
_variableOrderSymbols = f._variableOrderSymbols,
226226
timestamp = f.timestamp,
227-
nstime = f.nstime.value,
227+
nstime = string(f.nstime.value),
228228
fnctype = String(_getname(fnctype)),
229229
solvable = getSolvable(f),
230230
metadata = base64encode(JSON3.write(f.smallData)),

0 commit comments

Comments
 (0)