Skip to content

Commit b5cf8a6

Browse files
committed
Also dispach on solverData type for rebuildFactorMetadata!
1 parent 130c679 commit b5cf8a6

File tree

16 files changed

+37
-36
lines changed

16 files changed

+37
-36
lines changed

attic/GraphsDFG/entities/GraphsDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mutable struct GraphsNode
88
end
99
const FGType = Graphs.GenericIncidenceList{GraphsNode,Graphs.Edge{GraphsNode},Dict{Int,GraphsNode},Dict{Int,Array{Graphs.Edge{GraphsNode},1}}}
1010

11-
mutable struct GraphsDFG{T <: AbstractParams} <: AbstractDFG
11+
mutable struct GraphsDFG{T <: AbstractParams} <: AbstractDFG{T}
1212
g::FGType
1313
description::String
1414
userId::String

src/CloudGraphsDFG/entities/CloudGraphsDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mutable struct Neo4jInstance
55
graph::Neo4j.Graph
66
end
77

8-
mutable struct CloudGraphsDFG{T <: AbstractParams} <: AbstractDFG
8+
mutable struct CloudGraphsDFG{T <: AbstractParams} <: AbstractDFG{T}
99
neo4jInstance::Neo4jInstance
1010
userId::String
1111
robotId::String

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ function getFactor(dfg::CloudGraphsDFG, label::Union{Symbol, String})::DFGFactor
242242
factor = unpackFactor(dfg, props)
243243

244244
# Lastly, rebuild the metadata
245-
factor = dfg.rebuildFactorMetadata!(dfg, factor)
245+
factor = rebuildFactorMetadata!(dfg, factor)
246246

247247
return factor
248248
end

src/Deprecated.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ include("../attic/GraphsDFG/GraphsDFG.jl")
1111
@reexport using .GraphsDFGs
1212

1313

14+
@deprecate loadDFG(source::String, iifModule::Module, dest::AbstractDFG) loadDFG!(dest, source)
15+
1416
@deprecate buildSubgraphFromLabels!(dfg::AbstractDFG, varList::Vector{Symbol}) buildSubgraph(dfg, varList, 1)
1517

1618

src/FileDFG/services/FileDFG.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ loadDFG("/tmp/savedgraph.tar.gz", IncrementalInference, dfg)
8282
ls(dfg)
8383
```
8484
"""
85-
function loadDFG(dst::String,
86-
iifModule::Module,
87-
dfgLoadInto::G) where G <: AbstractDFG
85+
function loadDFG!(dfgLoadInto::AbstractDFG, dst::String)
8886

8987

9088
#
@@ -151,7 +149,7 @@ function loadDFG(dst::String,
151149
# Finally, rebuild the CCW's for the factors to completely reinflate them
152150
@info "Rebuilding CCW's for the factors..."
153151
for factor in factors
154-
iifModule.rebuildFactorMetadata!(dfgLoadInto, factor)
152+
rebuildFactorMetadata!(dfgLoadInto, factor)
155153
end
156154

157155
# remove the temporary unzipped file

src/LightDFG/entities/LightDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ An in-memory DistributedFactorGraph based on LightGraphs.jl with parameters:
77
- V: Variable type
88
- F: Factor type
99
"""
10-
mutable struct LightDFG{T <: AbstractParams, V <: AbstractDFGVariable, F <:AbstractDFGFactor} <: AbstractDFG
10+
mutable struct LightDFG{T <: AbstractParams, V <: AbstractDFGVariable, F <:AbstractDFGFactor} <: AbstractDFG{T}
1111
g::FactorGraph{Int, V, F}
1212
description::String
1313
userId::String

src/entities/AbstractDFG.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ end
3232

3333
"""
3434
$(TYPEDEF)
35-
Abstract parent struct for a DFG graph.
35+
Abstract parent struct for solver parameters.
3636
"""
37-
abstract type AbstractDFG
38-
end
37+
abstract type AbstractParams end
3938

4039
"""
4140
$(TYPEDEF)
42-
Abstract parent struct for solver parameters.
43-
"""
44-
abstract type AbstractParams end
41+
Abstract parent struct for a DFG graph.
42+
"""
43+
abstract type AbstractDFG{T<:AbstractParams} end
4544

4645
"""
4746
$(TYPEDEF)

src/services/AbstractDFG.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ Method must be overloaded by the user for Serialization to work. E.g. Increment
6060
getFactorOperationalMemoryType(dummy) = error("Please extend your workspace with function getFactorOperationalMemoryType(<:AbstractParams) for your usecase, e.g. IncrementalInference uses `CommonConvWrapper <: FactorOperationalMemory`")
6161
getFactorOperationalMemoryType(dfg::AbstractDFG) = getFactorOperationalMemoryType(getSolverParams(dfg))
6262

63+
"""
64+
$(SIGNATURES)
65+
66+
Method must be overloaded by the user for Serialization to work.
67+
"""
68+
rebuildFactorMetadata!(dfg::AbstractDFG{<:AbstractParams}, factor::AbstractDFGFactor) = error("rebuildFactorMetadata! is not implemented for $(typeof(dfg))")
6369

6470
##------------------------------------------------------------------------------
6571
## Setters

src/services/Serialization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any})::DFGFactor where G
167167
factor._variableOrderSymbols = _variableOrderSymbols
168168
setSolvable!(factor, solvable)
169169

170-
# Note, once inserted, you still need to call IIF.rebuildFactorMetadata!
170+
# Note, once inserted, you still need to call rebuildFactorMetadata!
171171
return factor
172172
end
173173

test/CGStructureTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ dfg = CloudGraphsDFG{SolverParams}("localhost", 7474, "neo4j", "test",
44
nothing,
55
nothing,
66
nothing,
7-
IncrementalInference.rebuildFactorMetadata!,
7+
nothing,
88
solverParams=SolverParams())
99

1010
# Nuke the user

0 commit comments

Comments
 (0)