27#ifndef PYRAP_PYCARRAYNP_H
28#define PYRAP_PYCARRAYNP_H
31#include <boost/python.hpp>
32#include <boost/python/object.hpp>
33#include <casacore/casa/Containers/ValueHolder.h>
34#include <casacore/casa/Arrays/Array.h>
35#include <numpy/arrayobject.h>
37namespace casacore {
namespace python {
namespace numpy {
39#define PYC_USE_PYARRAY "numpy"
40#include <casacore/python/Converters/PycArrayComH.h>
75 {
return vh.
asInt(); }
79 {
return vh.
asInt(); }
83 {
return vh.
asInt(); }
103 boost::python::converter::registry::push_back(
106 boost::python::type_id<T>());
122 boost::python::converter::rvalue_from_python_stage1_data* data)
124 using namespace boost::python;
125 void* storage = ((converter::rvalue_from_python_storage<T>*)
126 data)->storage.bytes;
128 data->convertible = storage;
131 *
static_cast<T*
>(storage) = getScalar<T> (
makeScalar(obj_ptr, type));
Complex asComplex() const
Bool asBool() const
Get the value.
DComplex asDComplex() const
ValueHolder makeScalar(PyObject *obj, int type)
Make a scalar object.
T getScalar(const ValueHolder &)
Templated helper function to get a value from a ValueHolder.
void register_convert_arrayscalars()
Register all array scalar converters.
bool PycArrayScalarCheck(PyObject *obj, int &type)
Check if it is an array scalar object.
DataType PycArrayScalarType(PyObject *obj_ptr)
Get the data type of the array scalar object.
this file contains all the compiler specific defines
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
bool Bool
Define the standard types used by Casacore.
unsigned long long uInt64
Struct with static functions to convert a numpy array scalar to the templated type (e....
static void * convertible(PyObject *obj_ptr)
Check if it is a type we can convert.
static void construct(PyObject *obj_ptr, boost::python::converter::rvalue_from_python_stage1_data *data)
Constructs a T from a Python array scalar object.
array_scalar_from_python()