Commit 536a9217 authored by jcarpent's avatar jcarpent
Browse files

[C++] Introduce static classname method to retrieve the name of the class

It replaces the old shortname  method with is no more static
parent c2900ab8
......@@ -378,12 +378,14 @@ namespace se3
;
}
friend std::ostream & operator << (std::ostream & os, const JointModelBase<Derived> & joint) {
friend std::ostream & operator << (std::ostream & os, const JointModelBase<Derived> & joint)
{
joint.disp(os);
return os;
}
std::string shortname() const { return derived().shortname(); }
static std::string classname() { return Derived::classname(); }
/* Acces to dedicated segment in robot config space. */
......@@ -433,6 +435,7 @@ namespace se3
jointCols_impl(Eigen::MatrixBase<D>& A) const { return A.template middleCols<NV>(i_v); }
JointModelDense<NQ, NV> toDense() const { return derived().toDense_impl(); }
}; // struct JointModelBase
} // namespace se3
......
......@@ -238,10 +238,8 @@ namespace se3
return *this;
}
std::string shortname() const
{
return std::string("JointModelDense");
}
static std::string classname() { return std::string("JointModelDense"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......
......@@ -387,10 +387,8 @@ namespace se3
);
}
std::string shortname() const
{
return std::string("JointModelFreeFlyer");
}
static std::string classname() { return std::string("JointModelFreeFlyer"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......
......@@ -440,10 +440,8 @@ namespace se3
);
}
std::string shortname() const
{
return std::string("JointModelPlanar");
}
static std::string classname() { return std::string("JointModelPlanar");}
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......
......@@ -446,10 +446,8 @@ namespace se3
);
}
std::string shortname() const
{
return std::string("JointModelPrismaticUnaligned");
}
static std::string classname() { return std::string("JointModelPrismaticUnaligned"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator== (const JointModelBase<D> &) const
......
......@@ -501,7 +501,8 @@ namespace se3
);
}
std::string shortname() const;
static std::string classname();
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......@@ -522,7 +523,7 @@ namespace se3
typedef JointModelPrismatic<0> JointModelPX;
template<> inline
std::string JointModelPrismatic<0>::shortname() const
std::string JointModelPrismatic<0>::classname()
{
return std::string("JointModelPX");
}
......@@ -532,7 +533,7 @@ namespace se3
typedef JointModelPrismatic<1> JointModelPY;
template<> inline
std::string JointModelPrismatic<1>::shortname() const
std::string JointModelPrismatic<1>::classname()
{
return std::string("JointModelPY");
}
......@@ -542,7 +543,7 @@ namespace se3
typedef JointModelPrismatic<2> JointModelPZ;
template<> inline
std::string JointModelPrismatic<2>::shortname() const
std::string JointModelPrismatic<2>::classname()
{
return std::string("JointModelPZ");
}
......
......@@ -450,10 +450,8 @@ namespace se3
);
}
std::string shortname() const
{
return std::string("JointModelRevoluteUnaligned");
}
static std::string classname() { return std::string("JointModelRevoluteUnaligned"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......
......@@ -251,7 +251,8 @@ namespace se3
);
}
std::string shortname() const;
static std::string classname();
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......@@ -273,7 +274,7 @@ namespace se3
typedef JointModelRevoluteUnbounded<0> JointModelRUBX;
template<> inline
std::string JointModelRevoluteUnbounded<0>::shortname() const
std::string JointModelRevoluteUnbounded<0>::classname()
{
return std::string("JointModelRUBX") ;
}
......@@ -283,7 +284,7 @@ namespace se3
typedef JointModelRevoluteUnbounded<1> JointModelRUBY;
template<> inline
std::string JointModelRevoluteUnbounded<1>::shortname() const
std::string JointModelRevoluteUnbounded<1>::classname()
{
return std::string("JointModelRUBY") ;
}
......@@ -293,7 +294,7 @@ namespace se3
typedef JointModelRevoluteUnbounded<2> JointModelRUBZ;
template<> inline
std::string JointModelRevoluteUnbounded<2>::shortname() const
std::string JointModelRevoluteUnbounded<2>::classname()
{
return std::string("JointModelRUBZ") ;
}
......
......@@ -535,7 +535,8 @@ namespace se3
);
}
std::string shortname() const;
static std::string classname();
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......@@ -557,7 +558,7 @@ namespace se3
typedef JointModelRevolute<0> JointModelRX;
template<> inline
std::string JointModelRevolute<0>::shortname() const
std::string JointModelRevolute<0>::classname()
{
return std::string("JointModelRX") ;
}
......@@ -567,7 +568,7 @@ namespace se3
typedef JointModelRevolute<1> JointModelRY;
template<> inline
std::string JointModelRevolute<1>::shortname() const
std::string JointModelRevolute<1>::classname()
{
return std::string("JointModelRY") ;
}
......@@ -577,7 +578,7 @@ namespace se3
typedef JointModelRevolute<2> JointModelRZ;
template<> inline
std::string JointModelRevolute<2>::shortname() const
std::string JointModelRevolute<2>::classname()
{
return std::string("JointModelRZ") ;
}
......
......@@ -467,10 +467,8 @@ namespace se3
);
}
std::string shortname() const
{
return std::string("JointModelSphericalZYX");
}
static std::string classname() { return std::string("JointModelSphericalZYX"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......
......@@ -412,10 +412,8 @@ namespace se3
);
}
std::string shortname() const
{
return std::string("JointModelSpherical");
}
static std::string classname() { return std::string("JointModelSpherical"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......
......@@ -379,10 +379,8 @@ namespace se3
);
}
std::string shortname() const
{
return std::string("JointModelTranslation");
}
static std::string classname() { return std::string("JointModelTranslation"); }
std::string shortname() const { return classname(); }
template <class D>
bool operator == (const JointModelBase<D> &) const
......
......@@ -156,14 +156,8 @@ namespace se3
return ::se3::neutralConfiguration(*this);
}
JointModel() : JointModelBoostVariant() {}
JointModel( const JointModelVariant & model_variant ) : JointModelBoostVariant(model_variant)
{}
std::string shortname() const
{
return ::se3::shortname(*this);
}
std::string shortname() const { return ::se3::shortname(*this); }
static std::string classname() { return "JointModel"; }
template <class D>
bool operator == (const JointModelBase<D> &) const
......
......@@ -49,9 +49,8 @@ namespace se3
struct exposer {
template<class T> inline void operator()(T)
{
expose_constructors<T>(bp::class_<T>(T::shortname().c_str(),bp::init<>()).def(JointPythonVisitor<T >())
);
bp::implicitly_convertible<T, se3::JointModelVariant>();
expose_constructors<T>(bp::class_<T>(T::classname().c_str(),bp::init<>()).def(JointPythonVisitor<T>()));
bp::implicitly_convertible<T,se3::JointModelVariant>();
}
......
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