Skip to content

Commit 5069847

Browse files
authored
Merge pull request #810 from JuliaRobotics/809/cgdfg_iifdeletion
Adding flag to deleteFactor
2 parents 94fcd59 + c5743ab commit 5069847

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ 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+
function deleteFactor!(dfg::CloudGraphsDFG, label::Symbol; suppressGetFactor::Bool=false)::Union{Nothing, DFGFactor}
364+
factor = suppressGetFactor ? nothing : getFactor(dfg, label)
365+
if factor === nothing && !suppressGetFactor
366366
error("Unable to retrieve the ID for factor '$label'. Please check your connection to the database and that the factor exists.")
367367
end
368368
# Perform detach+deletion
@@ -378,7 +378,7 @@ function deleteFactor!(dfg::CloudGraphsDFG, label::Symbol)::DFGFactor
378378
end
379379

380380
# Alias
381-
deleteFactor!(dfg::CloudGraphsDFG, factor::DFGFactor)::DFGFactor = deleteFactor!(dfg, factor.label)
381+
deleteFactor!(dfg::CloudGraphsDFG, factor::DFGFactor; suppressGetFactor::Bool=false)::Union{Nothing, DFGFactor} = deleteFactor!(dfg, factor.label, suppressGetFactor=suppressGetFactor)
382382

383383
function getVariables(dfg::CloudGraphsDFG, regexFilter::Union{Nothing, Regex}=nothing; tags::Vector{Symbol}=Symbol[], solvable::Int=0)::Vector{DFGVariable}
384384
variableIds = listVariables(dfg, regexFilter, tags=tags, solvable=solvable)

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)