File tree Expand file tree Collapse file tree 7 files changed +76
-10
lines changed Expand file tree Collapse file tree 7 files changed +76
-10
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ SET(${PROJECT_NAME}_HEADERS
8282 ${${PROJECT_NAME} _SOLVERS_HEADERS}
8383 include /eigenpy/eigenpy.hpp
8484 include /eigenpy/exception.hpp
85+ include /eigenpy/expose.hpp
8586 include /eigenpy/details.hpp
8687 include /eigenpy/fwd.hpp
8788 include /eigenpy/map.hpp
Original file line number Diff line number Diff line change 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-
1515namespace 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)
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2019, INRIA
3+ */
4+
5+ #ifndef __eigenpy_expose_hpp__
6+ #define __eigenpy_expose_hpp__
7+
8+ #include " eigenpy/registration.hpp"
9+
10+ namespace eigenpy
11+ {
12+ namespace internal
13+ {
14+ // /
15+ // / \brief Allows a template specialization.
16+ // /
17+ template <typename T>
18+ struct call_expose
19+ {
20+ static inline void run () { T::expose (); }
21+ };
22+ } // namespace internal
23+
24+ // /
25+ // / \brief Call the expose function of a given type T.
26+ // /
27+ template <typename T>
28+ inline void expose ()
29+ {
30+ if (not register_symbolic_link_to_registered_type<T>())
31+ internal::call_expose<T>::run ();
32+ }
33+ }
34+
35+ #endif // ifndef __eigenpy_expose_hpp__
Original file line number Diff line number Diff line change 2626 #define EIGENPY_DEFAULT_ALIGNMENT_VALUE Eigen::Unaligned
2727#endif
2828
29+ #include " eigenpy/expose.hpp"
30+
2931#endif // ifndef __eigenpy_fwd_hpp__
3032
Original file line number Diff line number Diff line change 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 "
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments