Skip to content

Commit 6164bde

Browse files
committed
Summaries
1 parent 609b3b3 commit 6164bde

File tree

6 files changed

+60
-1
lines changed

6 files changed

+60
-1
lines changed

src/GraphsDFG/services/GraphsDFG.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,3 +527,5 @@ function toDotFile(dfg::GraphsDFG, fileName::String="/tmp/dfg.dot")::Nothing
527527
end
528528
return nothing
529529
end
530+
531+
function getSummary()::

src/entities/DFGFactor.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,40 @@ end
4949

5050
label(f::F) where F <: DFGFactor = f.label
5151
data(f::F) where F <: DFGFactor = f.data
52+
<<<<<<< Updated upstream
5253
id(f::F) where F <: DFGFactor = f._internalId
54+
=======
55+
tags(f::F) where F <: DFGFactor = f.tags
56+
internalId(f::F) where F <: DFGFactor = f._internalId
57+
"""
58+
$SIGNATURES
59+
60+
Retrieve data structure stored in a node.
61+
"""
62+
getData(v::DFGFactor)::GenericFunctionNodeData = v.data
63+
>>>>>>> Stashed changes
5364

5465
# Simply for convenience - don't export
5566
const PackedFunctionNodeData{T} = GenericFunctionNodeData{T, <: AbstractString}
5667
PackedFunctionNodeData(x1, x2, x3, x4, x5::S, x6::T, x7::String="", x8::Vector{Int}=Int[]) where {T <: PackedInferenceType, S <: AbstractString} = GenericFunctionNodeData(x1, x2, x3, x4, x5, x6, x7, x8)
5768
const FunctionNodeData{T} = GenericFunctionNodeData{T, Symbol}
5869
FunctionNodeData(x1, x2, x3, x4, x5::Symbol, x6::T, x7::String="", x8::Vector{Int}=Int[]) where {T <: Union{FunctorInferenceType, ConvolutionObject}}= GenericFunctionNodeData{T, Symbol}(x1, x2, x3, x4, x5, x6, x7, x8)
70+
<<<<<<< Updated upstream
71+
=======
72+
73+
"""
74+
$(SIGNATURES)
75+
Structure for first-class citizens of a DFGFactor.
76+
"""
77+
struct DFGFactorSummary <: DFGNode
78+
label::Symbol
79+
tags::Vector{Symbol}
80+
_internalId::Int64
81+
_variableOrderSymbols::Vector{Symbol}
82+
end
83+
84+
label(f::DFGFactorSummary) = f.label
85+
data(f::DFGFactorSummary) = f.data
86+
tags(f::DFGFactorSummary) = f.tags
87+
internalId(f::DFGFactorSummary) = f._internalId
88+
>>>>>>> Stashed changes

src/entities/DFGVariable.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,20 @@ id(v::DFGVariable) = v._internalId
110110
# Todo: Complete this.
111111
smallData(v::DFGVariable) = v.smallData
112112
bigData(v::DFGVariable) = v.bigData
113+
114+
"""
115+
$(SIGNATURES)
116+
Structure for first-class citizens of a DFGVariable.
117+
"""
118+
struct DFGVariableSummary <: DFGNode
119+
label::Symbol
120+
timestamp::DateTime
121+
tags::Vector{Symbol}
122+
estimateDict::Dict{Symbol, Dict{Symbol, VariableEstimate}}
123+
_internalId::Int64
124+
end
125+
label(v::DFGVariableSummary) = v.label
126+
timestamp(v::DFGVariableSummary) = v.timestamp
127+
tags(v::DFGVariableSummary) = v.tags
128+
estimates(v::DFGVariableSummary) = v.estimateDict
129+
internalId(v::DFGVariableSummary) = v._internalId

src/services/DFGFactor.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
function convert(::DFGFactorSummary, v::DFGFactor)
3+
return DFGFactorSummary(v.label, deepcopy(v.tags), v._internalId, deepcopy(_variableOrderSymbols))
4+
end

src/services/DFGVariable.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function unpack(dfg::G, d::PackedVariableNodeData)::VariableNodeData where G <:
4646
st, d.initialized, d.inferdim, d.ismargin, d.dontmargin )
4747
end
4848

49-
function compare(a::VariableNodeData,b::VariableNodeData)
49+
function compare(a::VariableNodeData, b::VariableNodeData)
5050
TP = true
5151
TP = TP && a.val == b.val
5252
TP = TP && a.bw == b.bw
@@ -65,3 +65,7 @@ end
6565
function ==(a::VariableNodeData,b::VariableNodeData, nt::Symbol=:var)
6666
return DistributedFactorGraphs.compare(a,b)
6767
end
68+
69+
function convert(::DFGVariableSummary, v::DFGVariable)
70+
return DFGVariableSummary(v.label, v.timestamp, deepcopy(v.tags), deepcopy(v.estimateDict), v._internalId)
71+
end

test/interfaceTests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ end
8181

8282
# Accessors
8383
@test label(v1) == v1.label
84+
@test tags(v1) = v1.tags
8485
@test timestamp(v1) == v1.timestamp
8586
@test estimates(v1) == v1.estimateDict
8687
@test estimate(v1, :notfound) == nothing
@@ -90,6 +91,7 @@ end
9091
@test id(v1) == v1._internalId
9192

9293
@test label(f1) == f1.label
94+
@test tags(f1) = f1.tags
9395
@test data(f1) == f1.data
9496
@test id(f1) == f1._internalId
9597
end

0 commit comments

Comments
 (0)