20
20
$(SIGNATURES)
21
21
Add Big Data Entry to a DFG variable
22
22
"""
23
- function addBigDataEntry! (var:: AbstractDFGVariable , bde:: AbstractBigDataEntry ):: AbstractBigDataEntry
23
+ function addBigDataEntry! (var:: AbstractDFGVariable , bde:: AbstractBigDataEntry )
24
24
haskey (var. bigData,bde. key) && error (" BigData entry $(bde. key) already exists in variable" )
25
25
var. bigData[bde. key] = bde
26
26
return bde
31
31
Add Big Data Entry to distributed factor graph.
32
32
Should be extended if DFG variable is not returned by reference.
33
33
"""
34
- function addBigDataEntry! (dfg:: AbstractDFG , label:: Symbol , bde:: AbstractBigDataEntry ):: AbstractBigDataEntry
34
+ function addBigDataEntry! (dfg:: AbstractDFG , label:: Symbol , bde:: AbstractBigDataEntry )
35
35
return addBigDataEntry! (getVariable (dfg, label), bde)
36
36
end
37
37
38
+ """
39
+ $SIGNATURES
40
+
41
+ Does a data entry (element) exist at `key`.
42
+ """
43
+ hasDataEntry (var:: DFGVariable , key:: Symbol ) = haskey (var. bigData, key)
44
+ const hasBigDataEntry = hasDataEntry
45
+
38
46
"""
39
47
$(SIGNATURES)
40
48
Get big data entry
41
49
"""
42
- function getBigDataEntry (var:: AbstractDFGVariable , key:: Symbol ):: Union{Nothing, AbstractBigDataEntry}
43
- ! haskey (var. bigData , key) && (error (" BigData entry $(key) does not exist in variable" ); return nothing )
50
+ function getBigDataEntry (var:: AbstractDFGVariable , key:: Symbol )
51
+ ! hasDataEntry (var, key) && (error (" BigData entry $(key) does not exist in variable" ); return nothing )
44
52
return var. bigData[key]
45
53
end
46
54
47
- function getBigDataEntry (dfg:: AbstractDFG , label:: Symbol , key:: Symbol ):: Union{Nothing, AbstractBigDataEntry}
55
+ function getBigDataEntry (dfg:: AbstractDFG , label:: Symbol , key:: Symbol )
48
56
return getBigDataEntry (getVariable (dfg, label), key)
49
57
end
50
58
51
59
"""
52
60
$(SIGNATURES)
53
61
Update big data entry
54
62
"""
55
- function updateBigDataEntry! (var:: AbstractDFGVariable , bde:: AbstractBigDataEntry ):: Union{Nothing, AbstractBigDataEntry}
63
+ function updateBigDataEntry! (var:: AbstractDFGVariable , bde:: AbstractBigDataEntry )
56
64
! haskey (var. bigData,bde. key) && (@warn " $(bde. key) does not exist in variable, adding" )
57
65
var. bigData[bde. key] = bde
58
66
return bde
59
67
end
60
- function updateBigDataEntry! (dfg:: AbstractDFG , label:: Symbol , bde:: AbstractBigDataEntry ):: Union{Nothing, AbstractBigDataEntry}
68
+ function updateBigDataEntry! (dfg:: AbstractDFG , label:: Symbol , bde:: AbstractBigDataEntry )
61
69
# !isVariable(dfg, label) && return nothing
62
70
return updateBigDataEntry! (getVariable (dfg, label), bde)
63
71
end
66
74
$(SIGNATURES)
67
75
Delete big data entry from the factor graph.
68
76
Note this doesn't remove it from any data stores.
77
+
78
+ Notes:
79
+ - users responsibility to delete big data in db before deleting entry
69
80
"""
70
- function deleteBigDataEntry! (var:: AbstractDFGVariable , key:: Symbol ):: Union{Nothing, AbstractDFGVariable} # users responsibility to delete big data in db before deleting entry
81
+ function deleteBigDataEntry! (var:: AbstractDFGVariable , key:: Symbol )
71
82
bde = getBigDataEntry (var, key)
72
83
bde == nothing && return nothing
73
84
delete! (var. bigData, key)
74
85
return var
75
86
end
76
- function deleteBigDataEntry! (dfg:: AbstractDFG , label:: Symbol , key:: Symbol ):: Union{Nothing, AbstractDFGVariable} # users responsibility to delete big data in db before deleting entry
87
+ function deleteBigDataEntry! (dfg:: AbstractDFG , label:: Symbol , key:: Symbol )
88
+ # users responsibility to delete big data in db before deleting entry
77
89
! isVariable (dfg, label) && return nothing
78
90
return deleteBigDataEntry! (getVariable (dfg, label), key)
79
91
end
80
92
81
- function deleteBigDataEntry! (var:: AbstractDFGVariable , entry:: AbstractBigDataEntry ):: Union{Nothing, AbstractDFGVariable} # users responsibility to delete big data in db before deleting entry
93
+ function deleteBigDataEntry! (var:: AbstractDFGVariable , entry:: AbstractBigDataEntry )
94
+ # users responsibility to delete big data in db before deleting entry
82
95
return deleteBigDataEntry! (var, entry. key)
83
96
end
84
97
85
98
"""
86
99
$(SIGNATURES)
87
100
Get big data entries, Vector{AbstractBigDataEntry}
88
101
"""
89
- function getBigDataEntries (var:: AbstractDFGVariable ):: Vector{AbstractBigDataEntry}
102
+ function getBigDataEntries (var:: AbstractDFGVariable )
90
103
# or should we return the iterator, Base.ValueIterator{Dict{Symbol,AbstractBigDataEntry}}?
91
104
collect (values (var. bigData))
92
105
end
93
- function getBigDataEntries (dfg:: AbstractDFG , label:: Symbol ):: Union{Nothing, Vector{AbstractBigDataEntry}}
106
+ function getBigDataEntries (dfg:: AbstractDFG , label:: Symbol )
94
107
! isVariable (dfg, label) && return nothing
95
108
# or should we return the iterator, Base.ValueIterator{Dict{Symbol,AbstractBigDataEntry}}?
96
109
getBigDataEntries (getVariable (dfg, label))
@@ -101,10 +114,10 @@ end
101
114
$(SIGNATURES)
102
115
getBigDataKeys
103
116
"""
104
- function getBigDataKeys (var:: AbstractDFGVariable ):: Vector{Symbol}
117
+ function getBigDataKeys (var:: AbstractDFGVariable )
105
118
collect (keys (var. bigData))
106
119
end
107
- function getBigDataKeys (dfg:: AbstractDFG , label:: Symbol ):: Union{Nothing, Vector{Symbol}}
120
+ function getBigDataKeys (dfg:: AbstractDFG , label:: Symbol )
108
121
! isVariable (dfg, label) && return nothing
109
122
getBigDataKeys (getVariable (dfg, label))
110
123
end
0 commit comments