Skip to content

Commit 57769a3

Browse files
authored
Merge pull request #661 from JuliaRobotics/master
v0.10.4-rc1
2 parents 07ea97e + 1426517 commit 57769a3

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.10.3"
3+
version = "0.10.4"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/CloudGraphsDFG/services/CommonFunctions.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ Build a Cypher-compliant set of properies from a subnode type.
133133
Note: Individual values are serialized if they are not already.
134134
If the additional properties is provided, the additional
135135
properties will be added in verbatim when serializing.
136+
137+
Related
138+
139+
_Neo4jTo???
136140
"""
137141
function _structToNeo4jProps(inst::Union{User, Robot, Session, PVND, N, APPE, ABDE},
138142
addProps::Dict{String, String}=Dict{String, String}();
@@ -175,7 +179,7 @@ function _structToNeo4jProps(inst::Union{User, Robot, Session, PVND, N, APPE, AB
175179
if fieldname == :solverData
176180
fnctype = getSolverData(inst).fnc.usrfnc!
177181
try
178-
packtype = getfield(_getmodule(fnctype), Symbol("Packed$(_getname(fnctype))"))
182+
packtype = convertPackedType(fnctype)
179183
packed = convert(PackedFunctionNodeData{packtype}, getSolverData(inst))
180184
packedJson = JSON2.write(packed)
181185
val = "\"$(replace(packedJson, "\"" => "\\\""))\"" # Escape slashes too

src/Common.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
## Utility functions for getting type names and modules (from IncrementalInference)
3-
function _getmodule(t::T) where T
4-
T.name.module
5-
end
6-
function _getname(t::T) where T
7-
T.name.name
8-
end
3+
_getmodule(t::T) where T = T.name.module
4+
_getname(t::T) where T = T.name.name
5+
6+
7+
convertPackedType(t::Union{T, Type{T}}) where {T <: FunctorInferenceType} = getfield(_getmodule(t), Symbol("Packed$(_getname(t))"))
8+
convertStructType(::Type{PT}) where {PT <: PackedInferenceType} = getfield(PT.name.module, Symbol(string(PT.name.name)[7:end]))
99

1010

1111
##==============================================================================

src/DistributedFactorGraphs.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ export getFactorType, getFactorFunction
200200
# Node Data
201201
export mergeVariableData!, mergeGraphVariableData!
202202

203+
# Serialization type conversion
204+
export convertPackedType, convertStructType
205+
203206
##------------------------------------------------------------------------------
204207
## Other utility functions
205208
##------------------------------------------------------------------------------

src/services/Serialization.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ end
227227
## Factor Packing and unpacking
228228
##==============================================================================
229229

230+
230231
function packFactor(dfg::G, f::DFGFactor)::Dict{String, Any} where G <: AbstractDFG
231232
# Construct the properties to save
232233
props = Dict{String, Any}()
@@ -237,7 +238,7 @@ function packFactor(dfg::G, f::DFGFactor)::Dict{String, Any} where G <: Abstract
237238
# Pack the node data
238239
fnctype = getSolverData(f).fnc.usrfnc!
239240
try
240-
packtype = getfield(_getmodule(fnctype), Symbol("Packed$(_getname(fnctype))"))
241+
packtype = convertPackedType(fnctype)
241242
packed = convert(PackedFunctionNodeData{packtype}, getSolverData(f))
242243
props["data"] = JSON2.write(packed)
243244
catch ex
@@ -255,11 +256,10 @@ function packFactor(dfg::G, f::DFGFactor)::Dict{String, Any} where G <: Abstract
255256
return props
256257
end
257258

258-
259259
function decodePackedType(::Type{T}, packeddata::GenericFunctionNodeData{PT}) where {T<:FactorOperationalMemory, PT}
260260
# usrtyp = convert(FunctorInferenceType, packeddata.fnc)
261261
# Also look at parentmodule
262-
usrtyp = getfield(PT.name.module, Symbol(string(PT.name.name)[7:end]))
262+
usrtyp = convertStructType(PT)
263263
fulltype = DFG.FunctionNodeData{T{usrtyp}}
264264
factordata = convert(fulltype, packeddata)
265265
return factordata

0 commit comments

Comments
 (0)