Skip to content

Commit 989a1d0

Browse files
authored
getSofttype fix and no keyword arg on solverkey as standard (#289)
1 parent 74aef9e commit 989a1d0

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

src/Common.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ sortDFG(vars::Vector{Symbol})::Vector{Symbol} = sortVarNested(vars)
137137
# # this looks right
138138
# return data.fnc.usrfnc!
139139
# end
140-
# function getfnctype(fact::DFGFactor; solveKey::Symbol=:default)
141-
# data = getSolverData(fact) # TODO , solveKey=solveKey)
140+
# function getfnctype(fact::DFGFactor, solveKey::Symbol=:default)
141+
# data = getSolverData(fact) # TODO , solveKey)
142142
# return getfnctype(data)
143143
# end
144-
# function getfnctype(dfg::T, lbl::Symbol; solveKey::Symbol=:default) where T <: AbstractDFG
144+
# function getfnctype(dfg::T, lbl::Symbol, solveKey::Symbol=:default) where T <: AbstractDFG
145145
# getfnctype(getFactor(dfg, exvertid))
146146
# end
147147

src/Deprecated.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ getPPEs(vari::VariableDataLevel1)::Dict = getVariablePPEs(vari)
141141
#FIXME TODO based on API definition of merge, in some cases the Noun is really not needed.
142142
# @deprecate mergeUpdateVariableSolverData!(args...) mergeVariableSolverData!(args...)
143143

144+
@deprecate pack(dfg::AbstractDFG, d::VariableNodeData) packVariableNodeData(dfg, d)
145+
@deprecate unpack(dfg::AbstractDFG, d::PackedVariableNodeData) unpackVariableNodeData(dfg, d)
144146

145147
export getLabelDict
146148
getLabelDict(dfg::AbstractDFG) = error("getLabelDict is deprecated, consider using listing functions")

src/services/AbstractDFG.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ Returns state of vertex data `.initialized` flag.
10091009
Notes:
10101010
- used by both factor graph variable and Bayes tree clique logic.
10111011
"""
1012-
function isInitialized(var::DFGVariable; key::Symbol=:default)::Bool
1012+
function isInitialized(var::DFGVariable, key::Symbol=:default)::Bool
10131013
data = getSolverData(var, key)
10141014
if data == nothing
10151015
@error "Variable does not have solver data $(key)"
@@ -1019,8 +1019,8 @@ function isInitialized(var::DFGVariable; key::Symbol=:default)::Bool
10191019
end
10201020
end
10211021

1022-
function isInitialized(dfg::AbstractDFG, label::Symbol; key::Symbol=:default)::Bool
1023-
return isInitialized(getVariable(dfg, label), key=key)
1022+
function isInitialized(dfg::AbstractDFG, label::Symbol, key::Symbol=:default)::Bool
1023+
return isInitialized(getVariable(dfg, label), key)
10241024
end
10251025

10261026

src/services/DFGFactor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any})::DFGFactor where G
3838

3939
data = packedProps["data"]
4040
datatype = packedProps["fnctype"]
41-
@debug "DECODING Softtype = '$unpackedTypeName' for factor '$label'"
41+
@debug "DECODING Softtype = '$(datatype)' for factor '$label'"
4242
packtype = getTypeFromSerializationModule(dfg, Symbol("Packed"*datatype))
4343

4444
packed = nothing

src/services/DFGVariable.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ getVariableType
288288
function getSofttype(vnd::VariableNodeData)
289289
return vnd.softtype
290290
end
291-
function getSofttype(v::DFGVariable)
292-
return typeof(v).parameters[1]() # Get instantiated form of the parameter for the DFGVariable
291+
function getSofttype(v::DFGVariable, solvekey::Symbol=:default)
292+
return v.solverDataDict[solvekey].softtype # Get instantiated form of the parameter for the DFGVariable
293293
end
294294

295295
"""

test/iifInterfaceTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ end
215215
@test !isInitialized(dfg, :a)
216216
@test !isInitialized(v2)
217217

218-
@test !isInitialized(v2, key=:second)
218+
@test !isInitialized(v2, :second)
219219

220220
# Session, robot, and user small data tests
221221
# NOTE: CloudGraphDFG isnt supporting this yet.

test/testBlocks.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ function VariablesandFactorsCRUD_SET!(fg, v1, v2, v3, f0, f1, f2)
390390
@test isPrior(fg, :af1)
391391
@test !isPrior(fg, :abf1)
392392
end
393-
393+
394394
#list
395395
@test length(getVariables(fg)) == 2
396396
@test issetequal(getLabel.(getFactors(fg)), [:af1, :abf1])
@@ -781,7 +781,7 @@ function testGroup!(fg, v1, v2, f0, f1)
781781
#solver data is initialized
782782
@test !isInitialized(fg, :a)
783783
@test !isInitialized(v2)
784-
@test @test_logs (:error, r"Variable does not have solver data") !isInitialized(v2, key=:second)
784+
@test @test_logs (:error, r"Variable does not have solver data") !isInitialized(v2, :second)
785785

786786
# solvables
787787
@test getSolvable(v1) == 0

0 commit comments

Comments
 (0)