diff --git a/cpp/TupleConfig.h b/cpp/TupleConfig.h index 566c51598..3893108dd 100644 --- a/cpp/TupleConfig.h +++ b/cpp/TupleConfig.h @@ -141,7 +141,6 @@ namespace gtsam { template inline VectorConfig logmap(const PairConfig c0, const PairConfig& cp) { return c0.logmap(cp); } - /** * Tuple configs to handle subconfigs of LieConfigs * @@ -311,4 +310,42 @@ namespace gtsam { inline VectorConfig logmap(const TupleConfigEnd c0, const TupleConfigEnd& cp) { return c0.logmap(cp); } + + /** + * Typedefs for existing config types + */ + template + struct TupleConfig2 : TupleConfig > { + TupleConfig2() {} + TupleConfig2(const TupleConfig2& config) : + TupleConfig >(config) {} + }; + + template + struct TupleConfig3 : TupleConfig > > { + TupleConfig3() {} + TupleConfig3(const TupleConfig3& config) : + TupleConfig > >(config) {} + }; + + template + struct TupleConfig4 : TupleConfig > > > { + TupleConfig4() {} + TupleConfig4(const TupleConfig4& config) : + TupleConfig > > >(config) {} + }; + + template + struct TupleConfig5 : TupleConfig > > > > { + TupleConfig5() {} + TupleConfig5(const TupleConfig5& config) : + TupleConfig > > > >(config) {} + }; + + template + struct TupleConfig6 : TupleConfig > > > > > { + TupleConfig6() {} + TupleConfig6(const TupleConfig6& config) : + TupleConfig > > > > >(config) {} + }; } diff --git a/cpp/testTupleConfig.cpp b/cpp/testTupleConfig.cpp index a1ddec4f4..82fd76354 100644 --- a/cpp/testTupleConfig.cpp +++ b/cpp/testTupleConfig.cpp @@ -12,6 +12,8 @@ #include #include +#include +#include #include "Vector.h" #include "Key.h" @@ -169,14 +171,18 @@ TEST(PairConfig, expmap) /* ************************************************************************* */ // some key types -typedef TypedSymbol PoseKey; -typedef TypedSymbol PointKey; typedef TypedSymbol LamKey; +typedef TypedSymbol Pose3Key; +typedef TypedSymbol Point3Key; +typedef TypedSymbol Point3Key2; // some config types typedef LieConfig PoseConfig; typedef LieConfig PointConfig; typedef LieConfig LamConfig; +typedef LieConfig Pose3Config; +typedef LieConfig Point3Config; +typedef LieConfig Point3Config2; // some TupleConfig types typedef TupleConfig > ConfigA; @@ -312,6 +318,16 @@ TEST(TupleConfig, expmap) CHECK(assert_equal(increment, logmap(cfg1, expected))); } +/* ************************************************************************* */ +TEST(TupleConfig, typedefs) +{ + TupleConfig2 cfg1; + TupleConfig3 cfg2; + TupleConfig4 cfg3; + TupleConfig5 cfg4; + TupleConfig6 cfg5; +} + /* ************************************************************************* */ int main() { TestResult tr; return TestRegistry::runAllTests(tr); }