Verified Commit 360bf7d6 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

all: use this new function to expose types

parent 422877f4
...@@ -6,20 +6,35 @@ ...@@ -6,20 +6,35 @@
#ifndef __eigenpy_angle_axis_hpp__ #ifndef __eigenpy_angle_axis_hpp__
#define __eigenpy_angle_axis_hpp__ #define __eigenpy_angle_axis_hpp__
#include "eigenpy/fwd.hpp"
#include <boost/python.hpp> #include <boost/python.hpp>
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Geometry> #include <Eigen/Geometry>
#include "eigenpy/registration.hpp"
namespace eigenpy namespace eigenpy
{ {
namespace bp = boost::python; namespace bp = boost::python;
template<typename AngleAxis> class AngleAxisVisitor;
namespace internal
{
template<typename Scalar>
struct call_expose< Eigen::AngleAxis<Scalar> >
{
typedef Eigen::AngleAxis<Scalar> type;
static inline void run()
{
AngleAxisVisitor<type>::expose();
}
};
} // namespace internal
template<typename AngleAxis> template<typename AngleAxis>
class AngleAxisVisitor class AngleAxisVisitor
: public boost::python::def_visitor< AngleAxisVisitor<AngleAxis> > : public bp::def_visitor< AngleAxisVisitor<AngleAxis> >
{ {
typedef typename AngleAxis::Scalar Scalar; typedef typename AngleAxis::Scalar Scalar;
...@@ -103,8 +118,6 @@ namespace eigenpy ...@@ -103,8 +118,6 @@ namespace eigenpy
static void expose() static void expose()
{ {
if(register_symbolic_link_to_registered_type<AngleAxis>()) return;
bp::class_<AngleAxis>("AngleAxis", bp::class_<AngleAxis>("AngleAxis",
"AngleAxis representation of rotations.\n\n", "AngleAxis representation of rotations.\n\n",
bp::no_init) bp::no_init)
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#ifndef __eigenpy_quaternion_hpp__ #ifndef __eigenpy_quaternion_hpp__
#define __eigenpy_quaternion_hpp__ #define __eigenpy_quaternion_hpp__
#include "eigenpy/fwd.hpp"
#include <Eigen/Core> #include <Eigen/Core>
#include <Eigen/Geometry> #include <Eigen/Geometry>
...@@ -27,9 +29,24 @@ namespace eigenpy ...@@ -27,9 +29,24 @@ namespace eigenpy
namespace bp = boost::python; namespace bp = boost::python;
template<typename QuaternionDerived> class QuaternionVisitor;
namespace internal
{
template<typename Scalar, int Options>
struct call_expose< Eigen::Quaternion<Scalar,Options> >
{
typedef Eigen::Quaternion<Scalar,Options> type;
static inline void run()
{
QuaternionVisitor<type>::expose();
}
};
} // namespace internal
template<typename Quaternion> template<typename Quaternion>
class QuaternionVisitor class QuaternionVisitor
: public boost::python::def_visitor< QuaternionVisitor<Quaternion> > : public bp::def_visitor< QuaternionVisitor<Quaternion> >
{ {
typedef Eigen::QuaternionBase<Quaternion> QuaternionBase; typedef Eigen::QuaternionBase<Quaternion> QuaternionBase;
...@@ -203,8 +220,6 @@ namespace eigenpy ...@@ -203,8 +220,6 @@ namespace eigenpy
static void expose() static void expose()
{ {
if(register_symbolic_link_to_registered_type<Quaternion>()) return;
bp::class_<Quaternion>("Quaternion", bp::class_<Quaternion>("Quaternion",
"Quaternion representing rotation.\n\n" "Quaternion representing rotation.\n\n"
"Supported operations " "Supported operations "
......
...@@ -13,6 +13,6 @@ namespace eigenpy ...@@ -13,6 +13,6 @@ namespace eigenpy
{ {
void exposeAngleAxis() void exposeAngleAxis()
{ {
AngleAxisVisitor<Eigen::AngleAxisd>::expose(); expose<Eigen::AngleAxisd>();
} }
} // namespace eigenpy } // namespace eigenpy
...@@ -13,6 +13,6 @@ namespace eigenpy ...@@ -13,6 +13,6 @@ namespace eigenpy
{ {
void exposeQuaternion() void exposeQuaternion()
{ {
QuaternionVisitor<Eigen::Quaterniond>::expose(); expose<Eigen::Quaterniond>();
} }
} // namespace eigenpy } // namespace eigenpy
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