diff --git a/src/DistributedFactorGraphs.jl b/src/DistributedFactorGraphs.jl index 9531f798..b1f0a2bb 100644 --- a/src/DistributedFactorGraphs.jl +++ b/src/DistributedFactorGraphs.jl @@ -105,7 +105,9 @@ export InMemoryDFGTypes, LocalDFG # AbstractDFG Interface export exists, addVariable!, + addVariables!, addFactor!, + addFactors!, getVariable, getFactor, updateVariable!, diff --git a/src/FileDFG/services/FileDFG.jl b/src/FileDFG/services/FileDFG.jl index 447a0b1d..77d7a229 100644 --- a/src/FileDFG/services/FileDFG.jl +++ b/src/FileDFG/services/FileDFG.jl @@ -123,9 +123,8 @@ function loadDFG!( # do actual unzipping filename = lastdirname[1:(end - length(".tar.gz"))] |> string if unzip - @show sfolder = split(dstname, '.') Base.mkpath(loaddir) - folder = joinpath(loaddir, filename) #splitpath(string(sfolder[end-2]))[end] + folder = joinpath(loaddir, filename) @info "loadDFG! detected a gzip $dstname -- unpacking via $loaddir now..." Base.rm(folder; recursive = true, force = true) # unzip the tar file diff --git a/src/entities/DFGFactor.jl b/src/entities/DFGFactor.jl index 2d4b0bcd..ac4c012f 100644 --- a/src/entities/DFGFactor.jl +++ b/src/entities/DFGFactor.jl @@ -104,10 +104,11 @@ Base.@kwdef struct PackedFactor <: AbstractDFGFactor end #TODO type not in DFG PackedFactor, should it be? # _type::String - # createdTimestamp::DateTime # lastUpdatedTimestamp::DateTime +PackedFactor(f::PackedFactor) = f + # TODO consolidate to just one type """ $(TYPEDEF) diff --git a/src/services/AbstractDFG.jl b/src/services/AbstractDFG.jl index 6dee59bb..c367ac29 100644 --- a/src/services/AbstractDFG.jl +++ b/src/services/AbstractDFG.jl @@ -279,13 +279,33 @@ function addVariable!( end """ -Add a DFGFactor to a DFG. $(SIGNATURES) +Add a Vector{DFGVariable} to a DFG. +""" +function addVariables!(dfg::AbstractDFG, variables::Vector{<:AbstractDFGVariable}) + return asyncmap(variables) do v + return addVariable!(dfg, v) + end +end + +""" + $(SIGNATURES) +Add a DFGFactor to a DFG. """ function addFactor!(dfg::AbstractDFG, factor::F) where {F <: AbstractDFGFactor} return error("addFactor! not implemented for $(typeof(dfg))(dfg, factor)") end +""" + $(SIGNATURES) +Add a Vector{DFGFactor} to a DFG. +""" +function addFactors!(dfg::AbstractDFG, factors::Vector{<:AbstractDFGFactor}) + return asyncmap(factors) do f + return addFactor!(dfg, f) + end +end + """ $(SIGNATURES) Get a DFGVariable from a DFG using its label.