/* * TupleConfig-inl.h * * Created on: Jan 14, 2010 * Author: richard */ #pragma once #include #include "LieConfig-inl.h" #include "TupleConfig.h" #define INSTANTIATE_PAIR_CONFIG(J1,X1,J2,X2) \ /*INSTANTIATE_LIE_CONFIG(J1,X1);*/ \ /*INSTANTIATE_LIE_CONFIG(J2,X2);*/ \ template class PairConfig; \ /*template void PairConfig::print(const std::string&) const;*/ \ template PairConfig expmap(const PairConfig&, const VectorConfig&); // TupleConfig instantiations for N = 1-6 #define INSTANTIATE_TUPLE_CONFIG2(Config1, Config2) \ template class TupleConfig2; #define INSTANTIATE_TUPLE_CONFIG3(Config1, Config2, Config3) \ template class TupleConfig3; #define INSTANTIATE_TUPLE_CONFIG4(Config1, Config2, Config3, Config4) \ template class TupleConfig4; #define INSTANTIATE_TUPLE_CONFIG5(Config1, Config2, Config3, Config4, Config5) \ template class TupleConfig5; #define INSTANTIATE_TUPLE_CONFIG6(Config1, Config2, Config3, Config4, Config5, Config6) \ template class TupleConfig6; namespace gtsam { /* ************************************************************************* */ /** PairConfig implementations */ /* ************************************************************************* */ template void PairConfig::print(const std::string& s) const { std::cout << "TupleConfig " << s << ", size " << size() << "\n"; first().print(s + "Config1: "); second().print(s + "Config2: "); } /* ************************************************************************* */ template void PairConfig::insert(const PairConfig& config) { for (typename Config1::const_iterator it = config.first().begin(); it!=config.first().end(); it++) { insert(it->first, it->second); } for (typename Config2::const_iterator it = config.second().begin(); it!=config.second().end(); it++) { insert(it->first, it->second); } } /* ************************************************************************* */ /** TupleConfig Implementations */ /* ************************************************************************* */ template void TupleConfig::print(const std::string& s) const { std::cout << s << " : " << std::endl; first_.print(); second_.print(); } template void TupleConfigEnd::print(const std::string& s ) const { first_.print(); } /* ************************************************************************* */ /** TupleConfigN Implementations */ /* ************************************************************************* */ /* ************************************************************************* */ /** TupleConfig 2 */ template TupleConfig2::TupleConfig2(const TupleConfig2& config) : TupleConfig >(config) {} template TupleConfig2::TupleConfig2(const Config1& cfg1, const Config2& cfg2) : TupleConfig >( cfg1, TupleConfigEnd(cfg2)) {} template TupleConfig2::TupleConfig2(const TupleConfig >& config) : TupleConfig >(config) {} /* ************************************************************************* */ /** TupleConfig 3 */ template TupleConfig3::TupleConfig3( const TupleConfig3& config) : TupleConfig > >(config) {} template TupleConfig3::TupleConfig3( const Config1& cfg1, const Config2& cfg2, const Config3& cfg3) : TupleConfig > >( cfg1, TupleConfig >( cfg2, TupleConfigEnd(cfg3))) {} template TupleConfig3::TupleConfig3( const TupleConfig > >& config) : TupleConfig > >(config) {} /* ************************************************************************* */ /** TupleConfig 4 */ template TupleConfig4::TupleConfig4( const TupleConfig4& config) : TupleConfig > > >(config) {} template TupleConfig4::TupleConfig4( const Config1& cfg1, const Config2& cfg2, const Config3& cfg3,const Config4& cfg4) : TupleConfig > > >( cfg1, TupleConfig > >( cfg2, TupleConfig >( cfg3, TupleConfigEnd(cfg4)))) {} template TupleConfig4::TupleConfig4( const TupleConfig > > >& config) : TupleConfig > > >(config) {} /* ************************************************************************* */ /** TupleConfig 5 */ template TupleConfig5::TupleConfig5( const TupleConfig5& config) : TupleConfig > > > >(config) {} template TupleConfig5::TupleConfig5( const Config1& cfg1, const Config2& cfg2, const Config3& cfg3, const Config4& cfg4, const Config5& cfg5) : TupleConfig > > > >( cfg1, TupleConfig > > >( cfg2, TupleConfig > >( cfg3, TupleConfig >( cfg4, TupleConfigEnd(cfg5))))) {} template TupleConfig5::TupleConfig5( const TupleConfig > > > >& config) : TupleConfig > > > >(config) {} /* ************************************************************************* */ /** TupleConfig 6 */ template TupleConfig6::TupleConfig6( const TupleConfig6& config) : TupleConfig > > > > >(config) {} template TupleConfig6::TupleConfig6( const Config1& cfg1, const Config2& cfg2, const Config3& cfg3, const Config4& cfg4, const Config5& cfg5, const Config6& cfg6) : TupleConfig > > > > >( cfg1, TupleConfig > > > >( cfg2, TupleConfig > > >( cfg3, TupleConfig > >( cfg4, TupleConfig >( cfg5, TupleConfigEnd(cfg6)))))) {} template TupleConfig6::TupleConfig6( const TupleConfig > > > > >& config) : TupleConfig > > > > >(config) {} }