Skip to content

Commit 574a309

Browse files
committed
Update as per #533
1 parent cdcc0dd commit 574a309

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
lines changed

src/Deprecated.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ function buildSubgraphFromLabels!(dfg::AbstractDFG,
4545

4646
end
4747

48+
# These will become AbstractPrior, AbstractRelativeFactor, and AbstractRelativeFactorMinimize in 0.9.
49+
abstract type FunctorSingleton <: FunctorInferenceType end
50+
abstract type FunctorPairwise <: FunctorInferenceType end
51+
abstract type FunctorPairwiseMinimize <: FunctorInferenceType end
4852

4953
##==============================================================================
5054
## Remove in 0.10

src/DistributedFactorGraphs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ export addData!, fetchData, fetchDataEntryBlob
182182
# Factor Data
183183
export GenericFunctionNodeData, PackedFunctionNodeData, FunctionNodeData
184184
export InferenceType, PackedInferenceType, FunctorInferenceType, FactorOperationalMemory
185+
export AbstractPrior, AbstractRelativeFactor, AbstractRelativeFactorMinimize
186+
#Deprecated
185187
export FunctorSingleton, FunctorPairwise, FunctorPairwiseMinimize
186188

187189
# accessors
@@ -236,8 +238,6 @@ export
236238

237239

238240
## Deprecated exports should be listed in Deprecated.jl if possible, otherwise here
239-
#TODO remove export in DFG v0.8.0
240-
# export ConvolutionObject
241241

242242
## CustomPrinting.jl
243243
export printFactor, printVariable, printNode

src/entities/DFGFactor.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ abstract type FactorOperationalMemory <: Function end
1414
# we can add to IIF or have IIF.CommonConvWrapper <: FactorOperationalMemory directly
1515
# abstract type ConvolutionObject <: FactorOperationalMemory end
1616

17-
abstract type FunctorSingleton <: FunctorInferenceType end
18-
abstract type FunctorPairwise <: FunctorInferenceType end
19-
abstract type FunctorPairwiseMinimize <: FunctorInferenceType end
17+
abstract type AbstractPrior <: FunctorInferenceType end
18+
abstract type AbstractRelativeFactor <: FunctorInferenceType end
19+
abstract type AbstractRelativeFactorMinimize <: FunctorInferenceType end
2020

2121
##==============================================================================
2222
## GenericFunctionNodeData

src/services/DFGFactor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Return `::Bool` on whether given factor `fc::Symbol` is a prior in factor graph
135135
"""
136136
function isPrior(dfg::G, fc::Symbol)::Bool where G <: AbstractDFG
137137
fco = getFactor(dfg, fc)
138-
getFactorType(fco) isa FunctorSingleton
138+
getFactorType(fco) isa AbstractPrior
139139
end
140140

141141

test/testBlocks.jl

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ end
2222
struct TestFunctorInferenceType1 <: FunctorInferenceType end
2323
struct TestFunctorInferenceType2 <: FunctorInferenceType end
2424

25-
struct TestFunctorSingleton <: FunctorSingleton end
26-
struct TestFunctorPairwise <: FunctorPairwise end
27-
struct TestFunctorPairwiseMinimize <: FunctorPairwiseMinimize end
25+
struct TestAbstractPrior <: AbstractPrior end
26+
struct TestAbstractRelativeFactor <: AbstractRelativeFactor end
27+
struct TestAbstractRelativeFactorMinimize <: AbstractRelativeFactorMinimize end
2828

2929
struct PackedTestFunctorInferenceType1 <: PackedInferenceType
3030
s::String
@@ -41,19 +41,19 @@ function Base.convert(::Type{TestFunctorInferenceType1}, d::PackedTestFunctorInf
4141
TestFunctorInferenceType1()
4242
end
4343

44-
struct PackedTestFunctorSingleton <: PackedInferenceType
44+
struct PackedTestAbstractPrior <: PackedInferenceType
4545
s::String
4646
end
47-
PackedTestFunctorSingleton() = PackedTestFunctorSingleton("")
47+
PackedTestAbstractPrior() = PackedTestAbstractPrior("")
4848

49-
function Base.convert(::Type{PackedTestFunctorSingleton}, d::TestFunctorSingleton)
50-
# @info "convert(::Type{PackedTestFunctorSingleton}, d::TestFunctorSingleton)"
51-
PackedTestFunctorSingleton()
49+
function Base.convert(::Type{PackedTestAbstractPrior}, d::TestAbstractPrior)
50+
# @info "convert(::Type{PackedTestAbstractPrior}, d::TestAbstractPrior)"
51+
PackedTestAbstractPrior()
5252
end
5353

54-
function Base.convert(::Type{TestFunctorSingleton}, d::PackedTestFunctorSingleton)
55-
# @info "onvert(::Type{TestFunctorSingleton}, d::PackedTestFunctorSingleton)"
56-
TestFunctorSingleton()
54+
function Base.convert(::Type{TestAbstractPrior}, d::PackedTestAbstractPrior)
55+
# @info "onvert(::Type{TestAbstractPrior}, d::PackedTestAbstractPrior)"
56+
TestAbstractPrior()
5757
end
5858

5959
struct TestCCW{T} <: FactorOperationalMemory where {T<:FunctorInferenceType}
@@ -315,7 +315,7 @@ function DFGFactorSCA()
315315
f1_tags = Set([:FACTOR])
316316
testTimestamp = now()
317317

318-
gfnd_prior = GenericFunctionNodeData(false, false, Int[], TestCCW(TestFunctorSingleton()))
318+
gfnd_prior = GenericFunctionNodeData(false, false, Int[], TestCCW(TestAbstractPrior()))
319319

320320
gfnd = GenericFunctionNodeData(false, false, Int[], TestCCW(TestFunctorInferenceType1()))
321321

@@ -513,7 +513,7 @@ end
513513

514514
# simple broadcast test
515515
if f0 isa DFGFactor
516-
@test issetequal(getFactorType.(fg, lsf(fg)), [TestFunctorInferenceType1(), TestFunctorSingleton()])
516+
@test issetequal(getFactorType.(fg, lsf(fg)), [TestFunctorInferenceType1(), TestAbstractPrior()])
517517
end
518518
@test getVariable.(fg, [:a]) == [getVariable(fg, :a)]
519519
end
@@ -836,15 +836,15 @@ function testGroup!(fg, v1, v2, f0, f1)
836836
@test isPrior(fg, :af1) # if f1 is prior
837837
@test lsfPriors(fg) == [:af1]
838838

839-
@test issetequal([:TestFunctorInferenceType1, :TestFunctorSingleton], lsfTypes(fg))
839+
@test issetequal([:TestFunctorInferenceType1, :TestAbstractPrior], lsfTypes(fg))
840840

841841
facTypesDict = lsfTypesDict(fg)
842842
@test issetequal(collect(keys(facTypesDict)), lsfTypes(fg))
843843
@test issetequal(facTypesDict[:TestFunctorInferenceType1], [:abf1])
844-
@test issetequal(facTypesDict[:TestFunctorSingleton], [:af1])
844+
@test issetequal(facTypesDict[:TestAbstractPrior], [:af1])
845845

846846
@test ls(fg, TestFunctorInferenceType1) == [:abf1]
847-
@test lsf(fg, TestFunctorSingleton) == [:af1]
847+
@test lsf(fg, TestAbstractPrior) == [:af1]
848848
@test lsfWho(fg, :TestFunctorInferenceType1) == [:abf1]
849849

850850
@test getSofttype(v1) == TestSofttype1()
@@ -899,7 +899,7 @@ function testGroup!(fg, v1, v2, f0, f1)
899899
@test issetequal(ls(fg, tags=[:POSE, :LANDMARK]), ls(fg, tags=[:VARIABLE]))
900900

901901
@test lsf(fg, tags=[:NONE]) == []
902-
@test lsf(fg, tags=[:PRIOR]) == [:af1]
902+
@test lsf(fg, tags=[:PRIOR]) == [:af1]
903903

904904
# Regexes
905905
@test ls(fg, r"a") == [v1.label]

0 commit comments

Comments
 (0)