2
2
# # Abstract Types
3
3
# #==============================================================================
4
4
5
- abstract type InferenceType end
6
- abstract type PackedInferenceType end
7
-
8
5
abstract type FunctorInferenceType <: Function end
6
+ abstract type PackedInferenceType end
9
7
10
8
# NOTE DF, Convolution is IIF idea, but DFG should know about "FactorOperationalMemory"
11
9
# DF, IIF.CommonConvWrapper <: FactorOperationalMemory #
@@ -14,9 +12,9 @@ abstract type FactorOperationalMemory <: Function end
14
12
# we can add to IIF or have IIF.CommonConvWrapper <: FactorOperationalMemory directly
15
13
# abstract type ConvolutionObject <: FactorOperationalMemory end
16
14
17
- abstract type FunctorSingleton <: FunctorInferenceType end
18
- abstract type FunctorPairwise <: FunctorInferenceType end
19
- abstract type FunctorPairwiseMinimize <: FunctorInferenceType end
15
+ abstract type AbstractPrior <: FunctorInferenceType end
16
+ abstract type AbstractRelativeFactor <: FunctorInferenceType end
17
+ abstract type AbstractRelativeFactorMinimize <: FunctorInferenceType end
20
18
21
19
# #==============================================================================
22
20
# # GenericFunctionNodeData
@@ -30,32 +28,39 @@ Notes
30
28
31
29
Designing (WIP)
32
30
- T <: Union{FactorOperationalMemory, PackedInferenceType}
33
- - in IIF.CCW{T <: DFG.InferenceType }
34
- - in IIF.FunctorPairwiseMinimize <: InferenceType # DFG whatever, something, we'll figure it out
35
- - in Main/User, SomeFactor <: FunctorPairwiseMinimize
31
+ - in IIF.CCW{T <: DFG.FunctorInferenceType }
32
+ - in DFG.AbstractRelativeFactorMinimize <: FunctorInferenceType
33
+ - in Main. SomeFactor <: AbstractRelativeFactorMinimize
36
34
"""
37
35
mutable struct GenericFunctionNodeData{T<: Union{PackedInferenceType, FunctorInferenceType, FactorOperationalMemory} }
38
36
eliminated:: Bool
39
37
potentialused:: Bool
40
38
edgeIDs:: Vector{Int}
41
39
fnc:: T
42
- multihypo:: Vector{Float64} # FIXME likely to moved when GenericWrapParam is refactored #477
40
+ multihypo:: Vector{Float64} # TODO re-evaluate after refactoring w #477
43
41
certainhypo:: Vector{Int}
42
+ nullhypo:: Float64
44
43
solveInProgress:: Int
44
+
45
+ # TODO deprecate all these inner constructors at end of DFG v0.9.x (was added for GFND.nullhypo::Float64 breaking change)
46
+ GenericFunctionNodeData {T} (el,po,ed,fn,mu:: Vector{<:Real} ,ce:: Vector{Int} ,so:: Int ) where T = new {T} (el,po,ed,fn,mu,ce,0.0 ,so)
47
+ GenericFunctionNodeData {T} (el,po,ed,fn,mu:: Vector{<:Real} ,ce:: Vector{Int} ,nu:: Real ,so:: Int ) where T = new {T} (el,po,ed,fn,mu,ce,nu,so)
45
48
end
46
49
47
50
# # Constructors
48
51
49
52
GenericFunctionNodeData {T} () where T =
50
- GenericFunctionNodeData {T} (false , false , Int[], T (), Float64[], Int[], 0 )
51
-
52
- function GenericFunctionNodeData (eliminated,
53
- potentialused,
54
- edgeIDs,
55
- fnc,
56
- multihypo= Float64[],
57
- certainhypo= Int[])
58
- return GenericFunctionNodeData (eliminated, potentialused, edgeIDs, fnc, multihypo, certainhypo, 0 )
53
+ GenericFunctionNodeData {T} (false , false , Int[], T (), Float64[], Int[], 0 , 0 )
54
+
55
+ function GenericFunctionNodeData (eliminated:: Bool ,
56
+ potentialused:: Bool ,
57
+ edgeIDs:: Vector{Int} ,
58
+ fnc:: T ,
59
+ multihypo:: Vector{<:Real} = Float64[],
60
+ certainhypo:: Vector{Int} = Int[],
61
+ nullhypo:: Real = 0 ,
62
+ solveInP:: Int = 0 ) where T
63
+ return GenericFunctionNodeData {T} (eliminated, potentialused, edgeIDs, fnc, multihypo, certainhypo, nullhypo, solveInP)
59
64
end
60
65
61
66
@@ -100,7 +105,7 @@ struct DFGFactor{T, N} <: AbstractDFGFactor
100
105
label:: Symbol
101
106
""" Variable timestamp.
102
107
Accessors: [`getTimestamp`](@ref), [`setTimestamp`](@ref)"""
103
- timestamp:: DateTime
108
+ timestamp:: ZonedDateTime
104
109
""" Nano second time, for more resolution on timestamp (only subsecond information)"""
105
110
nstime:: Nanosecond
106
111
""" Factor tags, e.g [:FACTOR].
@@ -116,14 +121,21 @@ struct DFGFactor{T, N} <: AbstractDFGFactor
116
121
Accessors: [`getVariableOrder`](@ref)"""
117
122
_variableOrderSymbols:: NTuple{N,Symbol}
118
123
# Inner constructor
119
- DFGFactor {T} (label:: Symbol ,
120
- timestamp:: DateTime ,
124
+ function DFGFactor {T} (label:: Symbol ,
125
+ timestamp:: Union{ DateTime,ZonedDateTime} ,
121
126
nstime:: Nanosecond ,
122
127
tags:: Set{Symbol} ,
123
128
solverData:: GenericFunctionNodeData{T} ,
124
129
solvable:: Int ,
125
- _variableOrderSymbols:: NTuple{N,Symbol} ) where {T,N} =
126
- new {T,N} (label, timestamp, nstime, tags, Ref (solverData), Ref (solvable), _variableOrderSymbols)
130
+ _variableOrderSymbols:: NTuple{N,Symbol} ) where {T,N}
131
+
132
+ # TODO Deprecate remove in v0.10.
133
+ if timestamp isa DateTime
134
+ Base. depwarn (" DFGFactor timestamp field is now a ZonedTimestamp" , :DFGFactor )
135
+ return new {T,N} (label, ZonedDateTime (timestamp, localzone ()), nstime, tags, Ref (solverData), Ref (solvable), _variableOrderSymbols)
136
+ end
137
+ return new {T,N} (label, timestamp, nstime, tags, Ref (solverData), Ref (solvable), _variableOrderSymbols)
138
+ end
127
139
128
140
end
129
141
@@ -136,7 +148,7 @@ $(SIGNATURES)
136
148
Construct a DFG factor given a label.
137
149
"""
138
150
DFGFactor (label:: Symbol ,
139
- timestamp:: DateTime ,
151
+ timestamp:: Union{ DateTime,ZonedDateTime} ,
140
152
nstime:: Nanosecond ,
141
153
tags:: Set{Symbol} ,
142
154
solverData:: GenericFunctionNodeData{T} ,
@@ -145,15 +157,15 @@ DFGFactor(label::Symbol,
145
157
DFGFactor {T} (label, timestamp, nstime, tags, solverData, solvable, _variableOrderSymbols)
146
158
147
159
148
- DFGFactor {T} (label:: Symbol , variableOrderSymbols:: Vector{Symbol} , timestamp:: DateTime = now (), data:: GenericFunctionNodeData{T} = GenericFunctionNodeData {T} ()) where {T} =
160
+ DFGFactor {T} (label:: Symbol , variableOrderSymbols:: Vector{Symbol} , timestamp:: Union{ DateTime,ZonedDateTime} = now (localzone () ), data:: GenericFunctionNodeData{T} = GenericFunctionNodeData {T} ()) where {T} =
149
161
DFGFactor (label, timestamp, Nanosecond (0 ), Set {Symbol} (), data, 1 , Tuple (variableOrderSymbols))
150
162
151
163
152
164
DFGFactor (label:: Symbol ,
153
165
variableOrderSymbols:: Vector{Symbol} ,
154
166
data:: GenericFunctionNodeData{T} ;
155
167
tags:: Set{Symbol} = Set {Symbol} (),
156
- timestamp:: DateTime = now (),
168
+ timestamp:: Union{ DateTime,ZonedDateTime} = now (localzone () ),
157
169
solvable:: Int = 1 ,
158
170
nstime:: Nanosecond = Nanosecond (0 )) where {T} =
159
171
DFGFactor {T} (label, timestamp, nstime, tags, data, solvable, Tuple (variableOrderSymbols))
173
185
Base. setproperty! (x:: DFGFactor ,f:: Symbol , val) = begin
174
186
if f == :solvable || f == :solverData
175
187
getfield (x,f)[] = val
188
+ elseif f == :timestamp && val isa DateTime
189
+ # #TODO Deprecation - Remove in v0.10
190
+ Base. depwarn (" DFGFactor timestamp field is now a ZonedTimestamp" , :setproperty! )
191
+ setfield! (x,:timestamp , ZonedDateTime (val, localzone ()))
176
192
else
177
193
setfield! (x,f,val)
178
194
end
@@ -195,7 +211,7 @@ struct DFGFactorSummary <: AbstractDFGFactor
195
211
label:: Symbol
196
212
""" Variable timestamp.
197
213
Accessors: [`getTimestamp`](@ref)"""
198
- timestamp:: DateTime
214
+ timestamp:: ZonedDateTime
199
215
""" Factor tags, e.g [:FACTOR].
200
216
Accessors: [`getTags`](@ref), [`mergeTags!`](@ref), and [`removeTags!`](@ref)"""
201
217
tags:: Set{Symbol}
0 commit comments