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