Commit 9c2f0c0a authored by jcarpent's avatar jcarpent
Browse files

[C++] Move operator== to the JointModelBase class

parent 536a9217
......@@ -386,7 +386,17 @@ namespace se3
std::string shortname() const { return derived().shortname(); }
static std::string classname() { return Derived::classname(); }
template <class OtherDerived>
bool operator==(const JointModelBase<OtherDerived> & other) const { return derived().isEqual(other); }
template <class OtherDerived>
bool isEqual(const JointModelBase<OtherDerived> &) const { return false; }
bool isEqual(const JointModelBase<Derived> & other) const
{
return other.id() == id() && other.idx_q() == idx_q() && other.idx_v() == idx_v();
}
/* Acces to dedicated segment in robot config space. */
// Const access
......@@ -420,7 +430,6 @@ namespace se3
typename SizeDepType<NV>::template SegmentReturn<D>::Type
jointVelocitySelector_impl( Eigen::MatrixBase<D>& a) const { return a.template segment<NV>(i_v); }
template<typename D>
typename SizeDepType<NV>::template ColsReturn<D>::ConstType
jointCols(const Eigen::MatrixBase<D>& A) const { return derived().jointCols_impl(A); }
......
......@@ -241,19 +241,6 @@ namespace se3
static std::string classname() { return std::string("JointModelDense"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelDense> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
}; // struct JointModelDense
template<>
......
......@@ -390,18 +390,6 @@ namespace se3
static std::string classname() { return std::string("JointModelFreeFlyer"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelFreeFlyer> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
}; // struct JointModelFreeFlyer
} // namespace se3
......
......@@ -443,18 +443,6 @@ namespace se3
static std::string classname() { return std::string("JointModelPlanar");}
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelPlanar> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
}; // struct JointModelPlanar
} // namespace se3
......
......@@ -449,20 +449,6 @@ namespace se3
static std::string classname() { return std::string("JointModelPrismaticUnaligned"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator== (const JointModelBase<D> &) const
{
return false;
}
bool operator== (const JointModelBase<JointModelPrismaticUnaligned> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
public:
Vector3 axis;
}; // struct JointModelPrismaticUnaligned
......
......@@ -504,18 +504,6 @@ namespace se3
static std::string classname();
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelPrismatic> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
}; // struct JointModelPrismatic
typedef JointPrismatic<0> JointPX;
......
......@@ -453,20 +453,6 @@ namespace se3
static std::string classname() { return std::string("JointModelRevoluteUnaligned"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelRevoluteUnaligned> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
public:
Motion::Vector3 axis;
}; // struct JointModelRevoluteUnaligned
......
......@@ -254,19 +254,6 @@ namespace se3
static std::string classname();
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelRevoluteUnbounded <axis> > & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
}; // struct JointModelRevoluteUnbounded
typedef JointRevoluteUnbounded<0> JointRUBX;
......
......@@ -538,19 +538,6 @@ namespace se3
static std::string classname();
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelRevolute <axis> > & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
}; // struct JointModelRevolute
typedef JointRevolute<0> JointRX;
......
......@@ -470,19 +470,6 @@ namespace se3
static std::string classname() { return std::string("JointModelSphericalZYX"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelSphericalZYX> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
}; // struct JointModelSphericalZYX
} // namespace se3
......
......@@ -415,18 +415,6 @@ namespace se3
static std::string classname() { return std::string("JointModelSpherical"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelSpherical> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
}; // struct JointModelSpherical
} // namespace se3
......
......@@ -382,18 +382,6 @@ namespace se3
static std::string classname() { return std::string("JointModelTranslation"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModelTranslation> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
}; // struct JointModelTranslation
} // namespace se3
......
......@@ -90,8 +90,9 @@ namespace se3
typedef Joint JointDerived;
SE3_JOINT_TYPEDEF;
SE3_JOINT_USE_INDEXES;
using JointModelBase<JointModel>::id;
using JointModelBase<JointModel>::setIndexes;
using Base::id;
using Base::setIndexes;
using Base::operator==;
JointModelVariant& toVariant() { return *static_cast<JointModelVariant*>(this); }
const JointModelVariant& toVariant() const { return *static_cast<const JointModelVariant*>(this); }
......@@ -159,20 +160,6 @@ namespace se3
std::string shortname() const { return ::se3::shortname(*this); }
static std::string classname() { return "JointModel"; }
template <class D>
bool operator == (const JointModelBase<D> &) const
{
return false;
}
bool operator == (const JointModelBase<JointModel> & jmodel) const
{
return jmodel.id() == id()
&& jmodel.idx_q() == idx_q()
&& jmodel.idx_v() == idx_v();
}
int nq_impl() const { return ::se3::nq(*this); }
int nv_impl() const { return ::se3::nv(*this); }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment