29#ifndef PYRAP_PYCARRAYNP_H
30#define PYRAP_PYCARRAYNP_H
33#include <boost/python.hpp>
34#include <boost/python/object.hpp>
35#include <casacore/casa/Containers/ValueHolder.h>
36#include <casacore/casa/Arrays/Array.h>
37#include <numpy/arrayobject.h>
39namespace casacore {
namespace python {
namespace numpy {
41#define PYC_USE_PYARRAY "numpy"
42#include <casacore/python/Converters/PycArrayComH.h>
77 {
return vh.
asInt(); }
81 {
return vh.
asInt(); }
85 {
return vh.
asInt(); }
100 template <
typename T>
105 boost::python::converter::registry::push_back(
108 boost::python::type_id<T>());
124 boost::python::converter::rvalue_from_python_stage1_data* data)
126 using namespace boost::python;
127 void* storage = ((converter::rvalue_from_python_storage<T>*)
128 data)->storage.bytes;
130 data->convertible = storage;
133 *
static_cast<T*
>(storage) = getScalar<T> (
makeScalar(obj_ptr, type));
Complex asComplex() const
Bool asBool() const
Get the value.
DComplex asDComplex() const
std::complex< Float > Complex
std::complex< Double > DComplex
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()