Verified Commit 6f5fb192 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

core: add new caller for Numpy functions

parent a7341f28
......@@ -30,6 +30,7 @@
namespace eigenpy
{
void EIGENPY_DLLEXPORT import_numpy();
int EIGENPY_DLLEXPORT PyArray_TypeNum(PyTypeObject * type);
}
#if defined _WIN32 || defined __CYGWIN__
......@@ -41,13 +42,16 @@ namespace eigenpy
EIGENPY_DLLEXPORT int call_PyArray_ObjectType(PyObject *, int);
EIGENPY_DLLEXPORT PyTypeObject getPyArrayType();
EIGENPY_DLLEXPORT PyTypeObject * getPyArrayType();
EIGENPY_DLLEXPORT int call_PyArray_TypeNumFromName(const std::string & name);
}
#else
#define call_PyArray_SimpleNew PyArray_SimpleNew
#define call_PyArray_New(py_type_ptr,nd,shape,np_type,data_ptr,options) \
PyArray_New(py_type_ptr,nd,shape,np_type,NULL,data_ptr,0,options,NULL)
#define getPyArrayType() PyArray_Type
#define getPyArrayType() &PyArray_Type
#define call_PyArray_TypeNumFromName(name) PyArray_TypeNumFromName(name.c_str())
#endif
#endif // ifndef __eigenpy_numpy_hpp__
......@@ -15,6 +15,11 @@ namespace eigenpy
}
}
int PyArray_TypeNum(PyTypeObject * type)
{
return PyArray_TypeNumFromName(const_cast<char*>(type->tp_name));
}
#if defined _WIN32 || defined __CYGWIN__
PyObject* call_PyArray_SimpleNew(int nd, npy_intp * shape, int np_type)
......@@ -32,7 +37,12 @@ namespace eigenpy
return PyArray_ObjectType(obj,val);
}
PyTypeObject getPyArrayType() { return PyArray_Type; }
PyTypeObject * getPyArrayType() { return &PyArray_Type; }
int call_PyArray_TypeNumFromName(const std::string & name)
{
return getPyArrayType(name.c_str());
}
#endif
}
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