Skip to content

Commit 3ffc29a

Browse files
authored
Merge pull request #705 from JuliaRobotics/4Q20/fixing_cg_types_head
Fixing an issue with the _type field in CGDFG
2 parents 9f01626 + 95b0cde commit 3ffc29a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,9 @@ function _unpackPPE(dfg::G, packedPPE::Dict{String, Any})::AbstractPointParametr
535535
packedPPE["lastUpdatedTimestamp"] = packedPPE["lastUpdatedTimestamp"][1:end-1]
536536
end
537537

538-
!haskey(packedPPE, "_type") && error("Cannot find type key '$TYPEKEY' in packed PPE data")
538+
!haskey(packedPPE, "_type") && error("Cannot find type key '_type' in packed PPE data")
539539
type = pop!(packedPPE, "_type")
540-
(type == nothing || type == "") && error("Cannot deserialize PPE, type key is empty")
540+
(type === nothing || type == "") && error("Cannot deserialize PPE, type key is empty")
541541
ppe = Unmarshal.unmarshal(
542542
DistributedFactorGraphs.getTypeFromSerializationModule(dfg, Symbol(type)),
543543
packedPPE)
@@ -555,6 +555,9 @@ end
555555

556556
function _generateAdditionalProperties(variableType::ST, ppe::P)::Dict{String, String} where {P <: AbstractPointParametricEst, ST <: InferenceVariable}
557557
addProps = Dict{String, String}()
558+
# Save in the type for PPEs
559+
addProps["_type"]="\"$(typeof(ppe))\""
560+
558561
# Try get the projectCartesian function for this variableType
559562
projectCartesianFunc = nothing
560563
if isdefined(Main, :projectCartesian)

src/CloudGraphsDFG/services/CommonFunctions.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,10 @@ function _structToNeo4jProps(inst::Union{User, Robot, Session, PVND, N, APPE, AB
204204
write(io, "$cypherNodeName.$k= $v,")
205205
end
206206
# Write in the version and node type
207-
write(io, "$cypherNodeName._version=\"$(_getDFGVersion())\",")
208-
write(io, "$cypherNodeName._type=\"$(typeof(inst))\"")
207+
write(io, "$cypherNodeName._version=\"$(_getDFGVersion())\"")
209208
# Ref String(): "When possible, the memory of v will be used without copying when the String object is created.
210-
# This is guaranteed to be the case for byte vectors returned by take!" # Apparent replacement for takebuf_string()
209+
# This is guaranteed to be the case for byte vectors returned by take!"
210+
# Apparent replacement for takebuf_string()
211211
return String(take!(io))
212212
end
213213

0 commit comments

Comments
 (0)