2424
2525#endif // if EIGEN_VERSION_AT_LEAST(3,2,0)
2626
27+ #define EIGENPY_MAKE_TYPEDEFS (Type, TypeSuffix, Size, SizeSuffix ) \
28+ /* * \ingroup matrixtypedefs */ \
29+ typedef Eigen::Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix; \
30+ /* * \ingroup matrixtypedefs */ \
31+ typedef Eigen::Matrix<Type, Size, 1 > Vector##SizeSuffix##TypeSuffix; \
32+ /* * \ingroup matrixtypedefs */ \
33+ typedef Eigen::Matrix<Type, 1 , Size> RowVector##SizeSuffix##TypeSuffix;
34+
35+ #define EIGENPY_MAKE_FIXED_TYPEDEFS (Type, TypeSuffix, Size ) \
36+ /* * \ingroup matrixtypedefs */ \
37+ typedef Eigen::Matrix<Type, Size, Eigen::Dynamic> Matrix##Size##X##TypeSuffix; \
38+ /* * \ingroup matrixtypedefs */ \
39+ typedef Eigen::Matrix<Type, Eigen::Dynamic, Size> Matrix##X##Size##TypeSuffix;
40+
41+ #define EIGENPY_MAKE_TYPEDEFS_ALL_SIZES (Type, TypeSuffix ) \
42+ EIGENPY_MAKE_TYPEDEFS (Type, TypeSuffix, 2 , 2 ) \
43+ EIGENPY_MAKE_TYPEDEFS(Type, TypeSuffix, 3 , 3 ) \
44+ EIGENPY_MAKE_TYPEDEFS(Type, TypeSuffix, 4 , 4 ) \
45+ EIGENPY_MAKE_TYPEDEFS(Type, TypeSuffix, Eigen::Dynamic, X) \
46+ EIGENPY_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2 ) \
47+ EIGENPY_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3 ) \
48+ EIGENPY_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4 )
49+
2750namespace eigenpy
2851{
2952
3053 /* Enable Eigen-Numpy serialization for a set of standard MatrixBase instance. */
3154 void EIGENPY_DLLEXPORT enableEigenPy ();
3255
56+ /* Enable the Eigen--Numpy serialization for the templated MatrixBase class.
57+ * The second template argument is used for inheritance of Eigen classes. If
58+ * using a native Eigen::MatrixBase, simply repeat the same arg twice. */
3359 template <typename MatType>
3460 void enableEigenPySpecific ();
3561
@@ -39,10 +65,36 @@ namespace eigenpy
3965 template <typename MatType,typename EigenEquivalentType>
4066 EIGENPY_DEPRECATED void enableEigenPySpecific ();
4167
68+ template <typename Scalar>
69+ EIGEN_DONT_INLINE void exposeType ()
70+ {
71+ EIGENPY_MAKE_TYPEDEFS_ALL_SIZES (Scalar,s);
72+
73+ ENABLE_SPECIFIC_MATRIX_TYPE (Vector2s);
74+ ENABLE_SPECIFIC_MATRIX_TYPE (RowVector2s);
75+ ENABLE_SPECIFIC_MATRIX_TYPE (Matrix2s);
76+ ENABLE_SPECIFIC_MATRIX_TYPE (Matrix2Xs);
77+ ENABLE_SPECIFIC_MATRIX_TYPE (MatrixX2s);
78+
79+ ENABLE_SPECIFIC_MATRIX_TYPE (Vector3s);
80+ ENABLE_SPECIFIC_MATRIX_TYPE (RowVector3s);
81+ ENABLE_SPECIFIC_MATRIX_TYPE (Matrix3s);
82+ ENABLE_SPECIFIC_MATRIX_TYPE (Matrix3Xs);
83+ ENABLE_SPECIFIC_MATRIX_TYPE (MatrixX3s);
84+
85+ ENABLE_SPECIFIC_MATRIX_TYPE (Vector4s);
86+ ENABLE_SPECIFIC_MATRIX_TYPE (RowVector4s);
87+ ENABLE_SPECIFIC_MATRIX_TYPE (Matrix4s);
88+ ENABLE_SPECIFIC_MATRIX_TYPE (Matrix4Xs);
89+ ENABLE_SPECIFIC_MATRIX_TYPE (MatrixX4s);
90+
91+ ENABLE_SPECIFIC_MATRIX_TYPE (VectorXs);
92+ ENABLE_SPECIFIC_MATRIX_TYPE (RowVectorXs);
93+ ENABLE_SPECIFIC_MATRIX_TYPE (MatrixXs);
94+ }
4295
4396} // namespace eigenpy
4497
4598#include " eigenpy/details.hpp"
4699
47100#endif // ifndef __eigenpy_eigenpy_hpp__
48-
0 commit comments