Skip to content

Commit 0022ff8

Browse files
authored
Merge pull request #811 from JuliaRobotics/master
Release 0.16.2
2 parents e8a8ce1 + e602da9 commit 0022ff8

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
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.16.1"
3+
version = "0.16.2"
44

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

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,10 @@ end
360360
#Alias
361361
deleteVariable!(dfg::CloudGraphsDFG, variable::DFGVariable) = deleteVariable!(dfg, variable.label)
362362

363-
function deleteFactor!(dfg::CloudGraphsDFG, label::Symbol)::DFGFactor
364-
factor = getFactor(dfg, label)
365-
if factor == nothing
363+
# return ::DFGFactor, or workaround ::Nothing, #809
364+
function deleteFactor!(dfg::CloudGraphsDFG, label::Symbol; suppressGetFactor::Bool=false)
365+
factor = suppressGetFactor ? nothing : getFactor(dfg, label)
366+
if factor === nothing && !suppressGetFactor
366367
error("Unable to retrieve the ID for factor '$label'. Please check your connection to the database and that the factor exists.")
367368
end
368369
# Perform detach+deletion
@@ -378,7 +379,7 @@ function deleteFactor!(dfg::CloudGraphsDFG, label::Symbol)::DFGFactor
378379
end
379380

380381
# Alias
381-
deleteFactor!(dfg::CloudGraphsDFG, factor::DFGFactor)::DFGFactor = deleteFactor!(dfg, factor.label)
382+
deleteFactor!(dfg::CloudGraphsDFG, factor::DFGFactor; suppressGetFactor::Bool=false) = deleteFactor!(dfg, factor.label, suppressGetFactor=suppressGetFactor)
382383

383384
function getVariables(dfg::CloudGraphsDFG, regexFilter::Union{Nothing, Regex}=nothing; tags::Vector{Symbol}=Symbol[], solvable::Int=0)::Vector{DFGVariable}
384385
variableIds = listVariables(dfg, regexFilter, tags=tags, solvable=solvable)
@@ -980,4 +981,4 @@ function SkeletonDFG(cfg::CloudGraphsDFG)
980981
addVariable!.(sfg, _getSkeletonVariables(cfg))
981982
addFactor!.(sfg, _getSkeletonFactors(cfg))
982983
return sfg
983-
end
984+
end

src/LightDFG/services/LightDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function deleteVariable!(dfg::LightDFG, label::Symbol)#::Tuple{AbstractDFGVariab
146146
return variable, neigfacs
147147
end
148148

149-
function deleteFactor!(dfg::LightDFG, label::Symbol)::AbstractDFGFactor
149+
function deleteFactor!(dfg::LightDFG, label::Symbol; suppressGetFactor::Bool=false)::AbstractDFGFactor
150150
if !haskey(dfg.g.factors, label)
151151
error("Factor label '$(label)' does not exist in the factor graph")
152152
end

src/services/AbstractDFG.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ end
285285
$(SIGNATURES)
286286
Delete a DFGFactor from the DFG using its label.
287287
"""
288-
function deleteFactor!(dfg::G, label::Symbol) where G <: AbstractDFG
288+
function deleteFactor!(dfg::G, label::Symbol; suppressGetFactor::Bool=false) where G <: AbstractDFG
289289
error("deleteFactors not implemented for $(typeof(dfg))")
290290
end
291291

@@ -449,8 +449,8 @@ end
449449
$(SIGNATURES)
450450
Delete the referened DFGFactor from the DFG.
451451
"""
452-
function deleteFactor!(dfg::G, factor::F) where {G <: AbstractDFG, F <: AbstractDFGFactor}
453-
return deleteFactor!(dfg, factor.label)
452+
function deleteFactor!(dfg::G, factor::F; suppressGetFactor::Bool=false) where {G <: AbstractDFG, F <: AbstractDFGFactor}
453+
return deleteFactor!(dfg, factor.label, suppressGetFactor=suppressGetFactor)
454454
end
455455

456456
# Alias - bit ridiculous but know it'll come up at some point. Does existential and type check.

0 commit comments

Comments
 (0)