Skip to content

Commit ba3fca0

Browse files
committed
Rest of the functions
1 parent 860b8fc commit ba3fca0

File tree

5 files changed

+38
-7
lines changed

5 files changed

+38
-7
lines changed

src/DistributedFactorGraphs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export DFGNode, DFGVariable, DFGFactor, AbstractDFGVariable, AbstractDFGFactor
2222
export InferenceType, PackedInferenceType, FunctorInferenceType, InferenceVariable, ConvolutionObject
2323
export FunctorSingleton, FunctorPairwise, FunctorPairwiseMinimize
2424
export getMaxPPE, getMeanPPE, getSuggestedPPE
25-
export label, timestamp, tags, estimates, estimate, data, softtype, solverData, getData, solverDataDict, setSolverData, internalId, smallData, bigData
25+
export label, timestamp, setTimestamp!, tags, setTags!, estimates, estimate, data, softtype, solverData, getData, solverDataDict, setSolverData, setSolverData!, internalId, smallData, setSmallData!, bigData
2626
export DFGVariableSummary, DFGFactorSummary, AbstractDFGSummary
2727

2828
#Skeleton types

src/entities/DFGFactor.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,21 @@ $SIGNATURES
8787
Return the label for a factor.
8888
"""
8989
label(f::FactorDataLevel0) = f.label
90+
9091
"""
9192
$SIGNATURES
9293
9394
Return the tags for a variable.
9495
"""
9596
tags(f::FactorDataLevel0) = f.tags
97+
98+
"""
99+
$SIGNATURES
100+
101+
Set the tags for a factor.
102+
"""
103+
setTag!s(f::FactorDataLevel0, tags::Vector{Symbol}) = f.tags = tags
104+
96105
"""
97106
$SIGNATURES
98107

src/entities/DFGVariable.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ tags(v::VariableDataLevel0) = v.tags
207207
"""
208208
$SIGNATURES
209209
210-
Get the small data for a variable.
210+
Set the tags for a variable.
211211
"""
212-
setTags(v::VariableDataLevel0, tags::Vector{Symbol}) = v.tags = tags
212+
setTags!(v::VariableDataLevel0, tags::Vector{Symbol}) = v.tags = tags
213213

214214
"""
215215
$SIGNATURES
@@ -221,9 +221,9 @@ timestamp(v::VariableDataLevel1) = v.timestamp
221221
"""
222222
$SIGNATURES
223223
224-
Get the small data for a variable.
224+
Set the timestamp for a variable.
225225
"""
226-
setTimestamp(v::VariableDataLevel1, timestamp::DateTime) = v.timestamp = timestamp
226+
setTimestamp!(v::VariableDataLevel1, timestamp::DateTime) = v.timestamp = timestamp
227227

228228
"""
229229
$SIGNATURES
@@ -281,6 +281,13 @@ end
281281
Set solver data structure stored in a variable.
282282
"""
283283
setSolverData(v::DFGVariable, data::VariableNodeData, key::Symbol=:default) = v.solverDataDict[key] = data
284+
"""
285+
$SIGNATURES
286+
287+
Set solver data structure stored in a variable.
288+
"""
289+
setSolverData!(v::DFGVariable, data::VariableNodeData, key::Symbol=:default) = setSolverData(v, data, key)
290+
284291
"""
285292
$SIGNATURES
286293
@@ -298,9 +305,9 @@ smallData(v::DFGVariable) = v.smallData
298305
"""
299306
$SIGNATURES
300307
301-
Get the small data for a variable.
308+
Set the small data for a variable.
302309
"""
303-
setSmallData(v::DFGVariable, smallData::String) = v.smallData = smallData
310+
setSmallData!(v::DFGVariable, smallData::String) = v.smallData = smallData
304311

305312
# Todo: Complete this.
306313
bigData(v::DFGVariable) = v.bigData

test/interfaceTests.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,22 @@ end
125125
f1Prime = deepcopy(f1)
126126
#updateFactor! returns the factor updated, so should be equal
127127
@test updateFactor!(dfg, f1Prime) == f1
128+
# Revert
129+
v1 = getVariable(dfg, v1.label)
130+
f1 = getFactor(dfg, f1.label)
128131

129132
# Accessors
130133
@test label(v1) == v1.label
131134
@test tags(v1) == v1.tags
135+
testTags = [:ha, :ha23]
136+
@test setTags!(v1, testTags) == testTags
137+
@test tags(v1) == testTags
138+
132139
@test timestamp(v1) == v1.timestamp
140+
testTimestamp = now()
141+
@test setTimestamp!(v1, testTimestamp) == testTimestamp
142+
@test timestamp(v1) == testTimestamp
143+
133144
@test estimates(v1) == v1.estimateDict
134145
@test estimate(v1, :notfound) == nothing
135146
@test solverData(v1) === v1.solverDataDict[:default]
@@ -144,6 +155,9 @@ end
144155

145156
@test label(f1) == f1.label
146157
@test tags(f1) == f1.tags
158+
@test setTags!(v1, testTags) == testTags
159+
@test tags(v1) == testTags
160+
147161
@test solverData(f1) == f1.data
148162
# Deprecated functions
149163
@test data(f1) == f1.data

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ using GraphPlot # For plotting tests
33
using Neo4j
44
using DistributedFactorGraphs
55
using Pkg
6+
using Dates
67

78
## To run the IIF tests, you need a local Neo4j with user/pass neo4j:test
89
# To run a Docker image

0 commit comments

Comments
 (0)