Skip to content

Commit 360bf7d

Browse files
committed
all: use this new function to expose types
1 parent 422877f commit 360bf7d

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

include/eigenpy/angle-axis.hpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,35 @@
66
#ifndef __eigenpy_angle_axis_hpp__
77
#define __eigenpy_angle_axis_hpp__
88

9+
#include "eigenpy/fwd.hpp"
10+
911
#include <boost/python.hpp>
1012
#include <Eigen/Core>
1113
#include <Eigen/Geometry>
1214

13-
#include "eigenpy/registration.hpp"
14-
1515
namespace eigenpy
1616
{
1717

1818
namespace bp = boost::python;
19+
20+
template<typename AngleAxis> class AngleAxisVisitor;
21+
22+
namespace internal
23+
{
24+
template<typename Scalar>
25+
struct call_expose< Eigen::AngleAxis<Scalar> >
26+
{
27+
typedef Eigen::AngleAxis<Scalar> type;
28+
static inline void run()
29+
{
30+
AngleAxisVisitor<type>::expose();
31+
}
32+
};
33+
} // namespace internal
1934

2035
template<typename AngleAxis>
2136
class AngleAxisVisitor
22-
: public boost::python::def_visitor< AngleAxisVisitor<AngleAxis> >
37+
: public bp::def_visitor< AngleAxisVisitor<AngleAxis> >
2338
{
2439

2540
typedef typename AngleAxis::Scalar Scalar;
@@ -103,8 +118,6 @@ namespace eigenpy
103118

104119
static void expose()
105120
{
106-
if(register_symbolic_link_to_registered_type<AngleAxis>()) return;
107-
108121
bp::class_<AngleAxis>("AngleAxis",
109122
"AngleAxis representation of rotations.\n\n",
110123
bp::no_init)

include/eigenpy/quaternion.hpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#ifndef __eigenpy_quaternion_hpp__
77
#define __eigenpy_quaternion_hpp__
88

9+
#include "eigenpy/fwd.hpp"
10+
911
#include <Eigen/Core>
1012
#include <Eigen/Geometry>
1113

@@ -27,9 +29,24 @@ namespace eigenpy
2729

2830
namespace bp = boost::python;
2931

32+
template<typename QuaternionDerived> class QuaternionVisitor;
33+
34+
namespace internal
35+
{
36+
template<typename Scalar, int Options>
37+
struct call_expose< Eigen::Quaternion<Scalar,Options> >
38+
{
39+
typedef Eigen::Quaternion<Scalar,Options> type;
40+
static inline void run()
41+
{
42+
QuaternionVisitor<type>::expose();
43+
}
44+
};
45+
} // namespace internal
46+
3047
template<typename Quaternion>
3148
class QuaternionVisitor
32-
: public boost::python::def_visitor< QuaternionVisitor<Quaternion> >
49+
: public bp::def_visitor< QuaternionVisitor<Quaternion> >
3350
{
3451
typedef Eigen::QuaternionBase<Quaternion> QuaternionBase;
3552

@@ -203,8 +220,6 @@ namespace eigenpy
203220

204221
static void expose()
205222
{
206-
if(register_symbolic_link_to_registered_type<Quaternion>()) return;
207-
208223
bp::class_<Quaternion>("Quaternion",
209224
"Quaternion representing rotation.\n\n"
210225
"Supported operations "

src/angle-axis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ namespace eigenpy
1313
{
1414
void exposeAngleAxis()
1515
{
16-
AngleAxisVisitor<Eigen::AngleAxisd>::expose();
16+
expose<Eigen::AngleAxisd>();
1717
}
1818
} // namespace eigenpy

src/quaternion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ namespace eigenpy
1313
{
1414
void exposeQuaternion()
1515
{
16-
QuaternionVisitor<Eigen::Quaterniond>::expose();
16+
expose<Eigen::Quaterniond>();
1717
}
1818
} // namespace eigenpy

0 commit comments

Comments
 (0)