|
17 | 17 | #include "eigenpy/scalar-conversion.hpp" |
18 | 18 |
|
19 | 19 | namespace eigenpy { |
20 | | -template <typename MatType, typename EigenEquivalentType> |
21 | | -EIGENPY_DEPRECATED void enableEigenPySpecific() { |
22 | | - enableEigenPySpecific<MatType>(); |
23 | | -} |
| 20 | + |
| 21 | +template <typename EigenType, |
| 22 | + typename BaseType = typename get_eigen_base_type<EigenType>::type> |
| 23 | +struct expose_eigen_type_impl; |
24 | 24 |
|
25 | 25 | template <typename MatType> |
26 | | -void enableEigenPySpecific() { |
27 | | - if (check_registration<MatType>()) return; |
| 26 | +struct expose_eigen_type_impl<MatType, Eigen::MatrixBase<MatType> > { |
| 27 | + static void run() { |
| 28 | + if (check_registration<MatType>()) return; |
28 | 29 |
|
29 | | - // to-python |
30 | | - EigenToPyConverter<MatType>::registration(); |
| 30 | + // to-python |
| 31 | + EigenToPyConverter<MatType>::registration(); |
31 | 32 | #if EIGEN_VERSION_AT_LEAST(3, 2, 0) |
32 | | - EigenToPyConverter<Eigen::Ref<MatType> >::registration(); |
33 | | - EigenToPyConverter<const Eigen::Ref<const MatType> >::registration(); |
| 33 | + EigenToPyConverter<Eigen::Ref<MatType> >::registration(); |
| 34 | + EigenToPyConverter<const Eigen::Ref<const MatType> >::registration(); |
| 35 | +#endif |
| 36 | + |
| 37 | + // from-python |
| 38 | + EigenFromPyConverter<MatType>::registration(); |
| 39 | + } |
| 40 | +}; |
| 41 | + |
| 42 | +#ifdef EIGENPY_WITH_TENSOR_SUPPORT |
| 43 | +template <typename TensorType> |
| 44 | +struct expose_eigen_type_impl<TensorType, Eigen::TensorBase<TensorType> > { |
| 45 | + static void run() { |
| 46 | + if (check_registration<TensorType>()) return; |
| 47 | + |
| 48 | + // to-python |
| 49 | + EigenToPyConverter<TensorType>::registration(); |
| 50 | + EigenToPyConverter<Eigen::TensorRef<TensorType> >::registration(); |
| 51 | + EigenToPyConverter< |
| 52 | + const Eigen::TensorRef<const TensorType> >::registration(); |
| 53 | + |
| 54 | + // from-python |
| 55 | + EigenFromPyConverter<TensorType>::registration(); |
| 56 | + } |
| 57 | +}; |
34 | 58 | #endif |
35 | 59 |
|
36 | | - // from-python |
37 | | - EigenFromPyConverter<MatType>::registration(); |
| 60 | +template <typename MatType> |
| 61 | +void enableEigenPySpecific() { |
| 62 | + expose_eigen_type_impl<MatType>::run(); |
38 | 63 | } |
39 | 64 |
|
40 | 65 | } // namespace eigenpy |
|
0 commit comments