@@ -91,8 +91,8 @@ function mergeVariable!(dfg::GraphsDFG, variable::AbstractGraphVariable)
9191 return 1
9292end
9393
94- function mergeVariables! (dfg:: GraphsDFG , variables)
95- cnts = map (mergeVariable!, variables)
94+ function DFG . mergeVariables! (dfg:: GraphsDFG , variables)
95+ cnts = map (v -> mergeVariable! (dfg, v) , variables)
9696 return sum (cnts)
9797end
9898
@@ -112,6 +112,11 @@ function mergeFactor!(dfg::GraphsDFG, factor::AbstractGraphFactor)
112112 return 1
113113end
114114
115+ function DFG. mergeFactors! (dfg:: GraphsDFG , factors)
116+ cnts = map (f -> mergeFactor! (dfg, f), factors)
117+ return sum (cnts)
118+ end
119+
115120function deleteVariable! (dfg:: GraphsDFG , label:: Symbol )# ::Tuple{AbstractGraphVariable, Vector{<:AbstractGraphFactor}}
116121 if ! haskey (dfg. g. variables, label)
117122 throw (LabelNotFoundError (" Variable" , label))
@@ -592,3 +597,81 @@ function addGraphBlobentries!(fg::GraphsDFG, entries::Vector{Blobentry})
592597 return addGraphBlobentry! (fg, entry)
593598 end
594599end
600+
601+ function DFG. addAgentBlobentry! (fg:: GraphsDFG , entry:: Blobentry )
602+ if haskey (fg. agent. blobEntries, entry. label)
603+ throw (LabelExistsError (" Blobentry" , entry. label))
604+ end
605+ push! (fg. agent. blobEntries, entry. label => entry)
606+ return entry
607+ end
608+
609+ function DFG. addAgentBlobentries! (fg:: GraphsDFG , entries:: Vector{Blobentry} )
610+ return map (entries) do entry
611+ return addAgentBlobentry! (fg, entry)
612+ end
613+ end
614+
615+ function DFG. getAgentBlobentry (fg:: GraphsDFG , label:: Symbol )
616+ if ! haskey (fg. agent. blobEntries, label)
617+ throw (LabelNotFoundError (" Blobentry" , label))
618+ end
619+ return fg. agent. blobEntries[label]
620+ end
621+
622+ function DFG. getAgentBlobentries (
623+ fg:: GraphsDFG ;
624+ labelFilter:: Union{Nothing, Function} = nothing ,
625+ )
626+ entries = collect (values (fg. agent. blobEntries))
627+ filterDFG! (entries, labelFilter, getLabel)
628+ return entries
629+ end
630+
631+ function DFG. mergeGraphBlobentry! (dfg:: GraphsDFG , entry:: Blobentry )
632+ DFG. refBlobentries (dfg. graph)[getLabel (entry)] = entry
633+ return 1
634+ end
635+
636+ function DFG. mergeAgentBlobentry! (dfg:: GraphsDFG , entry:: Blobentry )
637+ DFG. refBlobentries (dfg. agent)[getLabel (entry)] = entry
638+ return 1
639+ end
640+
641+ function DFG. mergeGraphBlobentries! (dfg:: GraphsDFG , entries:: Vector{Blobentry} )
642+ cnts = map (entries) do entry
643+ return mergeGraphBlobentry! (dfg, entry)
644+ end
645+ return sum (cnts)
646+ end
647+
648+ function DFG. mergeAgentBlobentries! (dfg:: GraphsDFG , entries:: Vector{Blobentry} )
649+ cnts = map (entries) do entry
650+ return mergeAgentBlobentry! (dfg, entry)
651+ end
652+ return sum (cnts)
653+ end
654+
655+ function DFG. deleteGraphBlobentry! (dfg:: GraphsDFG , label:: Symbol )
656+ if ! haskey (dfg. graph. blobEntries, label)
657+ throw (LabelNotFoundError (" Blobentry" , label))
658+ end
659+ delete! (dfg. graph. blobEntries, label)
660+ return 1
661+ end
662+
663+ function DFG. deleteAgentBlobentry! (dfg:: GraphsDFG , label:: Symbol )
664+ if ! haskey (dfg. agent. blobEntries, label)
665+ throw (LabelNotFoundError (" Blobentry" , label))
666+ end
667+ delete! (dfg. agent. blobEntries, label)
668+ return 1
669+ end
670+
671+ function DFG. hasGraphBlobentry (dfg:: GraphsDFG , label:: Symbol )
672+ return haskey (dfg. graph. blobEntries, label)
673+ end
674+
675+ function DFG. hasAgentBlobentry (dfg:: GraphsDFG , label:: Symbol )
676+ return haskey (dfg. agent. blobEntries, label)
677+ end
0 commit comments