5 #ifndef __pinocchio_lie_group_generic_hpp__
6 #define __pinocchio_lie_group_generic_hpp__
8 #include "pinocchio/multibody/liegroup/liegroup-base.hpp"
9 #include "pinocchio/multibody/liegroup/liegroup-variant-visitors.hpp"
13 template<
typename LieGroupCollection>
struct LieGroupGenericTpl;
15 template<
typename LieGroupCollection>
18 typedef typename LieGroupCollection::Scalar Scalar;
20 Options = LieGroupCollection::Options,
26 template<
typename LieGroupCollection>
28 :
LieGroupBase< LieGroupGenericTpl<LieGroupCollection> >, LieGroupCollection::LieGroupVariant
30 typedef typename LieGroupCollection::LieGroupVariant Base;
31 typedef typename LieGroupCollection::LieGroupVariant LieGroupVariant;
33 typedef typename LieGroupCollection::Scalar Scalar;
34 enum { Options = LieGroupCollection::Options };
36 template<
typename LieGroupDerived>
37 LieGroupGenericTpl(
const LieGroupBase<LieGroupDerived> & lg_base)
38 : Base(lg_base.derived())
41 template<
typename LieGroup>
42 LieGroupGenericTpl(
const LieGroupVariant & lg_variant)
46 LieGroupGenericTpl(
const LieGroupGenericTpl & lg_generic) =
default;
47 LieGroupGenericTpl & operator=(
const LieGroupGenericTpl & other) =
default;
49 const LieGroupVariant & toVariant()
const
50 {
return static_cast<const LieGroupVariant &
>(*this); }
52 LieGroupVariant & toVariant()
53 {
return static_cast<LieGroupVariant &
>(*this); }
55 bool isEqual_impl (
const LieGroupGenericTpl& other)
const
57 return boost::apply_visitor(visitor::LieGroupEqual<Scalar, Options>(), toVariant(), other.toVariant());
60 int nq()
const { return ::pinocchio::nq(*
this); }
61 int nv()
const { return ::pinocchio::nv(*
this); }
63 bool operator== (
const LieGroupGenericTpl& other)
const
65 return isEqual_impl(other);
68 bool operator!= (
const LieGroupGenericTpl& other)
const
70 return this->isDifferent_impl(other);
73 std::string name()
const
75 return LieGroupNameVisitor::run(*
this);
81 #endif // ifndef __pinocchio_lie_group_generic_hpp__