37 const std::type_info * type_info_ptr,
39 PyArray_GetItemFunc * getitem,
40 PyArray_SetItemFunc * setitem,
41 PyArray_NonzeroFunc * nonzero,
42 PyArray_CopySwapFunc * copyswap,
43 PyArray_CopySwapNFunc * copyswapn,
44 PyArray_DotFunc * dotfunc)
47 PyArray_Descr & descr = *descr_ptr;
48 descr.typeobj = py_type_ptr;
50 descr.byteorder =
'=';
51 descr.elsize = type_size;
52 descr.flags = NPY_LIST_PICKLE | NPY_USE_GETITEM | NPY_USE_SETITEM | NPY_NEEDS_INIT | NPY_NEEDS_PYAPI;
56 PyArray_ArrFuncs * funcs_ptr =
new PyArray_ArrFuncs;
57 PyArray_ArrFuncs & funcs = *funcs_ptr;
60 funcs.getitem = getitem;
61 funcs.setitem = setitem;
62 funcs.nonzero = nonzero;
63 funcs.copyswap = copyswap;
64 funcs.copyswapn = copyswapn;
65 funcs.dotfunc = dotfunc;
69 assert(code >= 0 &&
"The return code should be positive");
#define call_PyArray_RegisterDataType(dtype)
#define call_PyArray_DescrFromType(typenum)
MapCode py_array_code_bindings
static PyArray_Descr * getPyArrayDescr(PyTypeObject *py_type_ptr)
Structure collecting all the types registers in Numpy via EigenPy.
MapDescr py_array_descr_bindings
static int registerNewType(PyTypeObject *py_type_ptr, const std::type_info *type_info_ptr, const int type_size, PyArray_GetItemFunc *getitem, PyArray_SetItemFunc *setitem, PyArray_NonzeroFunc *nonzero, PyArray_CopySwapFunc *copyswap, PyArray_CopySwapNFunc *copyswapn, PyArray_DotFunc *dotfunc)
#define call_PyArray_InitArrFuncs(funcs)
static Register & instance()
static bool isRegistered()
MapInfo type_to_py_type_bindings
int EIGENPY_DLLAPI PyArray_TypeNum(PyTypeObject *type)