5454# #==============================================================================
5555# # Default Factors Function Macro
5656# #==============================================================================
57+ export PackedSamplableBelief
58+ # export pack, unpack, packDistribution, unpackDistribution
59+
5760function pack end
5861function unpack end
62+ function packDistribution end
63+ function unpackDistribution end
64+
65+ abstract type PackedSamplableBelief end
66+ StructTypes. StructType (:: Type{<:PackedSamplableBelief} ) = StructTypes. UnorderedStruct ()
67+
5968"""
60- @defFactorFunction StructName factortype<:AbstractFactor manifolds<:ManifoldsBase.AbstractManifold
69+ @defFactorType StructName factortype<:AbstractFactor manifolds<:ManifoldsBase.AbstractManifold
6170
6271A macro to create a new factor function with name `StructName` and manifolds. Note that
6372the `manifolds` is an object and *must* be a subtype of `ManifoldsBase.AbstractManifold`.
6473See documentation in [Manifolds.jl on making your own](https://juliamanifolds.github.io/Manifolds.jl/stable/examples/manifold.html).
6574
6675Example:
6776```
68- DFG.@defFactorFunction Pose2Pos2 AbstractManifoldMinimize SpecialEuclidean(2)
77+ DFG.@defFactorType Pose2Pos2 AbstractManifoldMinimize SpecialEuclidean(2)
6978```
7079"""
71- macro defFactorFunction (structname, factortype, manifold)
80+ macro defFactorType (structname, factortype, manifold)
7281 packedstructname = Symbol (" Packed" , structname)
7382 return esc (
7483 quote
7584 Base. @__doc__ struct $ structname{T} <: $factortype
7685 Z:: T
7786 end
7887
79- # Base.@__doc__ struct $packedstructname{T<:PackedSamplableBelief} <: AbstractPackedFactor
80- Base. @__doc__ struct $ packedstructname{T} <: AbstractPackedFactor
88+ Base. @__doc__ struct $ packedstructname{T<: PackedSamplableBelief } <: AbstractPackedFactor
8189 Z:: T
8290 end
8391
@@ -89,8 +97,8 @@ macro defFactorFunction(structname, factortype, manifold)
8997 " be a subtype of `ManifoldsBase.AbstractManifold`"
9098
9199 DFG. getManifold (:: Type{$structname} ) = $ manifold
92- DFG. pack (d:: $structname ) = $ packedstructname (packDistribution (d. Z))
93- DFG. unpack (d:: $packedstructname ) = $ structname (unpackDistribution (d. Z))
100+ DFG. pack (d:: $structname ) = $ packedstructname (DFG . packDistribution (d. Z))
101+ DFG. unpack (d:: $packedstructname ) = $ structname (DFG . unpackDistribution (d. Z))
94102 end ,
95103 )
96104end
0 commit comments