Verified Commit 53563e52 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

core: full templatization of Eigen::Map

parent 9872bfb9
......@@ -204,10 +204,10 @@ namespace eigenpy
};
#if EIGEN_VERSION_AT_LEAST(3,2,0)
template<typename MatType>
struct EigenAllocator< Eigen::Ref<MatType> >
template<typename MatType, int Options, typename Stride>
struct EigenAllocator<Eigen::Ref<MatType,Options,Stride> >
{
typedef Eigen::Ref<MatType> RefType;
typedef Eigen::Ref<MatType,Options,Stride> RefType;
typedef typename MatType::Scalar Scalar;
typedef typename ::boost::python::detail::referent_storage<RefType&>::StorageType StorageType;
......@@ -215,7 +215,7 @@ namespace eigenpy
static void allocate(PyArrayObject * pyArray,
bp::converter::rvalue_from_python_storage<RefType> * storage)
{
typedef typename StrideType<MatType,Eigen::internal::traits<RefType>::StrideType::InnerStrideAtCompileTime, Eigen::internal::traits<RefType>::StrideType::OuterStrideAtCompileTime >::type Stride;
typedef typename StrideType<MatType,Eigen::internal::traits<RefType>::StrideType::InnerStrideAtCompileTime, Eigen::internal::traits<RefType>::StrideType::OuterStrideAtCompileTime >::type NumpyMapStride;
bool need_to_allocate = false;
const int pyArray_Type = EIGENPY_GET_PY_ARRAY_TYPE(pyArray);
......@@ -278,7 +278,7 @@ namespace eigenpy
else
{
assert(pyArray_Type == NumpyEquivalentType<Scalar>::type_code);
typename MapNumpy<MatType,Scalar,Stride>::EigenMap numpyMap = MapNumpy<MatType,Scalar,Stride>::map(pyArray);
typename MapNumpy<MatType,Scalar,NumpyMapStride>::EigenMap numpyMap = MapNumpy<MatType,Scalar,NumpyMapStride>::map(pyArray);
RefType mat_ref(numpyMap);
new (raw_ptr) StorageType(mat_ref,pyArray);
}
......
......@@ -35,12 +35,12 @@ namespace eigenpy
};
#if EIGEN_VERSION_AT_LEAST(3,2,0)
template<typename MatType> struct referent_storage_eigen_ref;
template<typename MatType, int Options, typename Stride> struct referent_storage_eigen_ref;
template<typename MatType>
template<typename MatType, int Options, typename Stride>
struct referent_storage_eigen_ref
{
typedef Eigen::Ref<MatType> RefType;
typedef Eigen::Ref<MatType,Options,Stride> RefType;
typedef ::boost::python::detail::aligned_storage<
::boost::python::detail::referent_size<RefType&>::value
......@@ -89,10 +89,10 @@ namespace eigenpy
namespace boost { namespace python { namespace detail {
#if EIGEN_VERSION_AT_LEAST(3,2,0)
template<typename MatType>
struct referent_storage<Eigen::Ref<MatType> &>
template<typename MatType, int Options, typename Stride>
struct referent_storage<Eigen::Ref<MatType,Options,Stride> &>
{
typedef ::eigenpy::details::referent_storage_eigen_ref<MatType> StorageType;
typedef ::eigenpy::details::referent_storage_eigen_ref<MatType,Options,Stride> StorageType;
typedef aligned_storage<
::boost::python::detail::referent_size<StorageType&>::value
> type;
......@@ -166,10 +166,10 @@ namespace boost { namespace python { namespace converter {
#undef RVALUE_FROM_PYTHON_DATA_INIT
template<typename MatType>
struct rvalue_from_python_data<Eigen::Ref<MatType> &> : rvalue_from_python_storage<Eigen::Ref<MatType> &>
template<typename MatType, int Options, typename Stride>
struct rvalue_from_python_data<Eigen::Ref<MatType,Options,Stride> &> : rvalue_from_python_storage<Eigen::Ref<MatType,Options,Stride> &>
{
typedef Eigen::Ref<MatType> T;
typedef Eigen::Ref<MatType,Options,Stride> T;
# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \
&& (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \
......@@ -196,7 +196,7 @@ namespace boost { namespace python { namespace converter {
// Destroys any object constructed in the storage.
~rvalue_from_python_data()
{
typedef ::eigenpy::details::referent_storage_eigen_ref<MatType> StorageType;
typedef ::eigenpy::details::referent_storage_eigen_ref<MatType, Options,Stride> StorageType;
if (this->stage1.convertible == this->storage.bytes)
static_cast<StorageType *>((void *)this->storage.bytes)->~StorageType();
}
......@@ -418,10 +418,10 @@ namespace eigenpy
#if EIGEN_VERSION_AT_LEAST(3,2,0)
template<typename MatType, int Options, typename StrideType>
struct EigenFromPy<Eigen::Ref<MatType,Options,StrideType> >
template<typename MatType, int Options, typename Stride>
struct EigenFromPy<Eigen::Ref<MatType,Options,Stride> >
{
typedef Eigen::Ref<MatType,Options,StrideType> RefType;
typedef Eigen::Ref<MatType,Options,Stride> RefType;
typedef typename MatType::Scalar Scalar;
/// \brief Determine if pyObj can be converted into a MatType object
......
......@@ -52,8 +52,8 @@ namespace eigenpy
#if EIGEN_VERSION_AT_LEAST(3,2,0)
template<typename MatType>
struct NumpyAllocator<Eigen::Ref<MatType> > : NumpyAllocator<MatType &>
template<typename MatType, int Options, typename Stride>
struct NumpyAllocator<Eigen::Ref<MatType,Options,Stride> > : NumpyAllocator<MatType &>
{
};
......@@ -81,8 +81,8 @@ namespace eigenpy
#if EIGEN_VERSION_AT_LEAST(3,2,0)
template<typename MatType>
struct NumpyAllocator<const Eigen::Ref<const MatType> > : NumpyAllocator<const MatType &>
template<typename MatType, int Options, typename Stride>
struct NumpyAllocator<const Eigen::Ref<const MatType,Options,Stride> > : NumpyAllocator<const MatType &>
{
};
......
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