Skip to content

Commit 1fdc118

Browse files
committed
Clearer depreciation error in Symbol and Light DFG
for direct field access on nodeCounter and labelDict
1 parent 735e8ec commit 1fdc118

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/LightDFG/entities/LightDFG.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Base.propertynames(x::LightDFG, private::Bool=false) =
3434

3535
Base.getproperty(x::LightDFG,f::Symbol) = begin
3636
if f == :nodeCounter
37-
@error "Depreciated? returning number of nodes"
37+
@error "Field nodeCounter depreciated. returning number of nodes"
3838
nv(x.g)
3939
elseif f == :labelDict
40-
@error "Depreciated? Consider using exists(dfg,label) instead. Returning internals copy"
40+
@error "Field labelDict depreciated. Consider using exists(dfg,label) or getLabelDict(dfg) instead. Returning internals copy"
4141
#TODO: https://github.com/JuliaRobotics/DistributedFactorGraphs.jl/issues/111
4242
copy(x.g.labels.sym_int)
4343
else

src/LightDFG/services/LightDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

33
# Accessors
4-
getLabelDict(dfg::LightDFG) = dfg.labelDict
4+
getLabelDict(dfg::LightDFG) = copy(dfg.g.labels.sym_int)
55
getDescription(dfg::LightDFG) = dfg.description
66
setDescription(dfg::LightDFG, description::String) = dfg.description = description
77
getInnerGraph(dfg::LightDFG) = dfg.g

src/SymbolDFG/entities/SymbolDFG.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ Base.propertynames(x::SymbolDFG, private::Bool=false) =
3232

3333
Base.getproperty(x::SymbolDFG,f::Symbol) = begin
3434
if f == :nodeCounter
35-
@error "Depreciated? returning number of nodes"
35+
@error "Field nodeCounter depreciated. returning number of nodes"
3636
nv(x.g)
3737
elseif f == :labelDict
38-
@error "Maybe depreciated? using internals"
39-
x.g.fadjdict
38+
@error "Field labelDict depreciated. Consider using exists(dfg,label) or getLabelDict(dfg) instead. Returning internals copy"
39+
copy(x.g.fadjdict)
4040
else
4141
getfield(x,f)
4242
end

src/SymbolDFG/services/SymbolDFG.jl

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

22
# Accessors
3-
getLabelDict(dfg::SymbolDFG) = dfg.labelDict
3+
getLabelDict(dfg::SymbolDFG) = copy(dfg.g.fadjdict)
44
getDescription(dfg::SymbolDFG) = dfg.description
55
setDescription(dfg::SymbolDFG, description::String) = dfg.description = description
66
getInnerGraph(dfg::SymbolDFG) = dfg.g

test/interfaceTests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ addFactor!(dfg, [v1, v2], f1)
1717
# end
1818

1919
@testset "Adding Removing Nodes" begin
20-
dfg2 = GraphsDFG{NoSolverParams}()
20+
dfg2 = testDFGAPI{NoSolverParams}()
2121
v1 = DFGVariable(:a)
2222
v2 = DFGVariable(:b)
2323
v3 = DFGVariable(:c)

0 commit comments

Comments
 (0)