10#include <boost/python/detail/prefix.hpp>
14namespace PythonInterface {
24template <
typename ElementType>
36 template <
typename ElementType>
struct apply {
43 static PyObject *
create1D(
const std::vector<ElementType> &cdata) {
44 Py_intptr_t dims[1] = {
static_cast<int>(cdata.size())};
57 static PyObject *
createFromArray(
const ElementType *cdata,
const int ndims, Py_intptr_t *dims) {
70 template <
typename ElementType>
struct apply {
77 static PyObject *
create1D(
const std::vector<ElementType> &cdata) {
78 Py_intptr_t dims[1] = {
static_cast<int>(cdata.size())};
91 static PyObject *
createFromArray(
const ElementType *cdata,
const int ndims, Py_intptr_t *dims) {
PyObject * wrapWithNDArray(const ElementType *, const int ndims, Py_intptr_t *dims, const NumpyWrapMode mode, const OwnershipMode oMode=OwnershipMode::Cpp)
Defines the wrapWithNDArray specialization for C array types.
NumpyWrapMode
Enum defining wrapping type for conversion to numpy.
OwnershipMode
Enum defining transfer of ownership when converting to numpy array.
Helper class which provides the Collimation Length for SANS instruments.
static PyObject * create1D(const std::vector< ElementType > &cdata)
Returns a read-only 1D Numpy array wrapped around an existing container that knows its size.
static PyObject * createFromArray(const ElementType *cdata, const int ndims, Py_intptr_t *dims)
Returns a read-only Numpy array wrapped around an existing array.
WrapReadOnly is a policy for VectorToNDArray to wrap the vector in a read-only numpy array that looks...
static PyObject * create1D(const std::vector< ElementType > &cdata)
Returns a read-write Numpy array wrapped around an existing vector.
static PyObject * createFromArray(const ElementType *cdata, const int ndims, Py_intptr_t *dims)
Returns a read-only Numpy array wrapped around an existing array.
WrapReadWrite is a policy for VectorToNDArray to wrap the vector in a read-write numpy array that loo...