32        view.strides[view.ndim-1] = 
itemsize;
 
   34            view.strides[
idim] = view.itemsize;
 
 
   49    pyobj->fBuf = 
nullptr;
 
   50    pyobj->fConverter = 
nullptr;
 
   51    pyobj->fElemCnv   = 
nullptr;
 
 
   64           delete [] 
pyobj->fBuf;
 
   70            pyobj->fElemCnv && 
pyobj->fElemCnv->HasState())
 
   71        delete pyobj->fElemCnv;
 
   73    if (
pyobj->fConverter && 
pyobj->fConverter->HasState())
 
   74        delete pyobj->fConverter;
 
 
   81#define CPYCPPYY_LL_FLAG_GETSET(name, flag, doc)                             \ 
   82static PyObject* ll_get##name(CPyCppyy::LowLevelView* pyobj)                 \ 
   84    return PyBool_FromLong((long)((intptr_t)pyobj->fBufInfo.internal & flag));\ 
   87static int ll_set##name(CPyCppyy::LowLevelView* pyobj, PyObject* value, void*)\ 
   89    long settrue = PyLong_AsLong(value);                                     \ 
   90    if (settrue == -1 && PyErr_Occurred()) {                                 \ 
   91        PyErr_SetString(PyExc_ValueError, #doc" should be either True or False");\ 
   96       (intptr_t&)pyobj->fBufInfo.internal |=  flag;                         \ 
   98       (intptr_t&)pyobj->fBufInfo.internal &= ~flag;                         \ 
 
  120#define HAVE_PTR(suboffsets, dim) (suboffsets && suboffsets[dim] >= 0) 
  122#define ADJUST_PTR(ptr, suboffsets, dim) \ 
  123    (HAVE_PTR(suboffsets, dim) ? *((char**)ptr) + suboffsets[dim] : ptr) 
 
  127#define HAVE_SUBOFFSETS_IN_LAST_DIM(view) \ 
  128    (view->suboffsets && view->suboffsets[dest->ndim-1] >= 0) 
 
  137            src->strides[
src->ndim-1] == 
src->itemsize);
 
 
  149    for (
int i = 0; i < 
dest->ndim; i++) {
 
  150        if (
dest->shape[i] != 
src->shape[i])
 
  152        if (
dest->shape[i] == 0)
 
 
  167            "low level pointer assignment: lvalue and rvalue have different structures");
 
 
  226              (
char*)
src->buf, 
src->strides, 
src->suboffsets,
 
 
  250                "negative index not supported on dimension %d with unknown size", dim + 1);
 
  257            "multi index not supported on dimension %d with unknown stride", dim + 1);
 
  263            "index out of bounds on dimension %d", dim + 1);
 
  267    ptr += view.strides[dim] * 
index;
 
 
  290            "cannot index %d-dimension view with %zd-element tuple", view.ndim, 
nindices);
 
  294    char* ptr = (
char*)
llview->get_buf();
 
 
  316    if (!
self->get_buf())
 
  318    return self->fBufInfo.ndim == 0 ? 1 : 
self->fBufInfo.shape[0];
 
 
  326#if PY_VERSION_HEX < 0x03000000 
  335    if (!base->suboffsets || dim == 0) {
 
  337        base->buf = (
char *)base->buf + base->strides[dim] * start;
 
  341        while (
n >= 0 && base->suboffsets[
n] < 0)
 
  345        base->suboffsets[
n] = base->suboffsets[
n] + base->strides[dim] * start;
 
  348    base->strides[dim] = base->strides[dim] * step;
 
 
  395    if (!
self->get_buf()) {
 
  400    if (view.ndim == 0) {
 
  409            return self->fConverter->FromMemory(ptr);
 
  410        return self->fConverter->FromMemory((
void*)&ptr);
 
 
  426                        "sub-views are not implemented");
 
  433    return ptr ? 
self->fElemCnv->FromMemory(ptr) : 
nullptr;
 
 
  448    if (view.ndim == 0) {
 
  450            return self->fConverter->FromMemory(
self->get_buf());
 
  458                "invalid indexing of 0-dim memory");
 
  470        if (view.ndim == 1) {
 
  479            char* buf = (
char*)
self->get_buf();
 
  481            size_t isize = view.itemsize;
 
  499                "multi-dimensional slicing is not implemented");
 
  508            "multi-dimensional slicing is not implemented");
 
 
  527    if (
value == 
nullptr) {
 
  532    if (view.ndim == 0) {
 
  535            return self->fConverter->ToMemory(
value, 
self->get_buf()) ? 0 : -1;
 
  539                "invalid indexing of 0-dim memory");
 
  548                            "sub-views are not implemented");
 
  557        return self->fConverter->ToMemory(
value, ptr) ? 0 : -1;
 
  575        if (view.suboffsets) {
 
  576            dest.suboffsets = &
arrays[2]; 
dest.suboffsets[0] = view.suboffsets[0];
 
  592                            "sub-views are not implemented");
 
  598        return self->fElemCnv->ToMemory(
value, ptr) ? 0 : -1;
 
  604            "LowLevelView slice assignments are currently restricted " 
 
  613#if PY_VERSION_HEX < 0x03000000 
  623    return self->fBufInfo.len;
 
 
  640    *view = 
self->fBufInfo;
 
  653            "underlying buffer is not Fortran contiguous");
 
  660        if (view->format != 
NULL) {
 
  664                "cannot cast to unsigned bytes if the format flag is present");
 
 
  689    if (!
ii) 
return nullptr;
 
 
  724#if PY_VERSION_HEX < 0x03000000 
 
  793    size_t itemsize = view.strides[view.ndim-1];
 
  808        if (
idim == 0) view.len = 
nlen * view.itemsize;
 
 
  861    if (
strcmp(view.format, 
"b") != 0 || view.ndim != 1) {
 
  863            "as_string only supported for 1-dim char strings (format: %s, dim: %d)",
 
  864            view.format, (
int)view.ndim);
 
  868    char* buf = (
char*)
self->get_buf();
 
  869    size_t sz = 
strnlen(buf, (
size_t)view.shape[0]);
 
 
  876        (
char*)
"change the shape (not layout) of the low level view"},
 
  878        (
char*)
"interpret memory as a null-terminated char string and return Python str"},
 
  880        (
char*)
"return a numpy array from the low level view"},
 
  881    {(
char*)
nullptr, 
nullptr, 0, 
nullptr}
 
 
  887        (
char*)
"If true, python manages the life time of this buffer", 
nullptr},
 
  889        (
char*)
"If true, this array was allocated with C++\'s new[]", 
nullptr},
 
  893    {(
char*)
nullptr, 
nullptr, 
nullptr, 
nullptr, 
nullptr }
 
 
  902    (
char*)
"cppyy.LowLevelView",   
 
  922    (
char*)
"memory view on C++ pointer",     
 
  947#if PY_VERSION_HEX >= 0x02030000 
  950#if PY_VERSION_HEX >= 0x02060000 
  953#if PY_VERSION_HEX >= 0x03040000 
  956#if PY_VERSION_HEX >= 0x03080000 
  959#if PY_VERSION_HEX >= 0x030c0000 
 
  968template<
typename T> 
struct typecode_traits {};
 
  969template<> 
struct typecode_traits<
bool> {
 
  970    static constexpr const char* 
format = 
"?"; 
static constexpr const char* 
name = 
"bool"; };
 
  971template<> 
struct typecode_traits<char> {
 
  972    static constexpr const char* 
format = 
"b"; 
static constexpr const char* 
name = 
"char"; };
 
  973template<> 
struct typecode_traits<
signed char> {
 
  974    static constexpr const char* 
format = 
"b"; 
static constexpr const char* 
name = 
"signed char"; };
 
  975template<> 
struct typecode_traits<unsigned char> {
 
  976    static constexpr const char* 
format = 
"B"; 
static constexpr const char* 
name = 
"UCharAsInt"; };
 
  977#if __cplusplus > 201402L 
  978template<> 
struct typecode_traits<std::
byte> {
 
  979    static constexpr const char* 
format = 
"B"; 
static constexpr const char* 
name = 
"UCharAsInt"; };
 
  981template<> 
struct typecode_traits<char*> {
 
  982    static constexpr const char* 
format = 
"b"; 
static constexpr const char* 
name = 
"char*"; };
 
  983template<> 
struct typecode_traits<
const char*> {
 
  984    static constexpr const char* 
format = 
"b"; 
static constexpr const char* 
name = 
"const char*"; };
 
  985template<> 
struct typecode_traits<short> {
 
  986    static constexpr const char* 
format = 
"h"; 
static constexpr const char* 
name = 
"short"; };
 
  987template<> 
struct typecode_traits<unsigned short> {
 
  988    static constexpr const char* 
format = 
"H"; 
static constexpr const char* 
name = 
"unsigned short"; };
 
  989template<> 
struct typecode_traits<
int> {
 
  990    static constexpr const char* 
format = 
"i"; 
static constexpr const char* 
name = 
"int"; };
 
  991template<> 
struct typecode_traits<unsigned 
int> {
 
  992    static constexpr const char* 
format = 
"I"; 
static constexpr const char* 
name = 
"unsigned int"; };
 
  993template<> 
struct typecode_traits<long> {
 
  994    static constexpr const char* 
format = 
"l"; 
static constexpr const char* 
name = 
"long"; };
 
  995template<> 
struct typecode_traits<unsigned long> {
 
  996    static constexpr const char* 
format = 
"L"; 
static constexpr const char* 
name = 
"unsigned long"; };
 
  997template<> 
struct typecode_traits<long long> {
 
  998    static constexpr const char* 
format = 
"q"; 
static constexpr const char* 
name = 
"long long"; };
 
  999template<> 
struct typecode_traits<unsigned long long> {
 
 1000    static constexpr const char* 
format = 
"Q"; 
static constexpr const char* 
name = 
"unsigned long long"; };
 
 1001template<> 
struct typecode_traits<float> {
 
 1002    static constexpr const char* 
format = 
"f"; 
static constexpr const char* 
name = 
"float"; };
 
 1003template<> 
struct typecode_traits<
double> {
 
 1004    static constexpr const char* 
format = 
"d"; 
static constexpr const char* 
name = 
"double"; };
 
 1005template<> 
struct typecode_traits<long 
double> {
 
 1006    static constexpr const char* 
format = 
"D"; 
static constexpr const char* 
name = 
"long double"; };
 
 1007template<> 
struct typecode_traits<std::complex<float>> {
 
 1008    static constexpr const char* 
format = 
"Zf"; 
static constexpr const char* 
name = 
"std::complex<float>"; };
 
 1009template<> 
struct typecode_traits<std::complex<double>> {
 
 1010    static constexpr const char* 
format = 
"Zd"; 
static constexpr const char* 
name = 
"std::complex<double>"; };
 
 1011template<> 
struct typecode_traits<std::complex<int>> {
 
 1012    static constexpr const char* 
format = 
"Zi"; 
static constexpr const char* 
name = 
"std::complex<int>"; };
 
 1013template<> 
struct typecode_traits<std::complex<long>> {
 
 1014    static constexpr const char* 
format = 
"Zl"; 
static constexpr const char* 
name = 
"std::complex<long>"; };
 
 1023    if (bi.ndim == 1 && 
bi.shape) {
 
 1024        bi.len = 
sz * 
bi.itemsize;
 
 
 1049    view.format         = (
char*)(
format ? 
format : typecode_traits<T>::format);
 
 1054    view.suboffsets     = 
nullptr;
 
 1058        for (
int i = 0; i < shape.
ndim(); ++i)
 
 1064    if (view.ndim == 1) {
 
 1066        view.len        = 
nx * 
sizeof(T);
 
 1068        llp->fConverter = 
llp->fElemCnv;
 
 1071        view.len        = 
nx * 
sizeof(
void*);
 
 1072        view.itemsize   = 
sizeof(
void*);
 
 
 1095    llp->set_buf((
void**)address);
 
 
 1100#define CPPYY_RET_W_CREATOR(type, fname)                                    \ 
 1101    PyObject* (*c)(type, cdims_t) = &fname;                                 \ 
 1102    ll->fCreator = (LowLevelView::Creator_t)c;                              \ 
 1103    return (PyObject*)ll 
 
 1105#define CPPYY_IMPL_VIEW_CREATOR(type)                                       \ 
 1106PyObject* CPyCppyy::CreateLowLevelView(type* address, cdims_t shape) {      \ 
 1107    LowLevelView* ll = CreateLowLevelViewT<type>(address, shape);           \ 
 1108    CPPYY_RET_W_CREATOR(type*, CreateLowLevelView);                         \ 
 1110PyObject* CPyCppyy::CreateLowLevelView(type** address, cdims_t shape) {     \ 
 1111    LowLevelView* ll = CreateLowLevelViewT<type>(address, shape);           \ 
 1112    CPPYY_RET_W_CREATOR(type**, CreateLowLevelView);                        \ 
 
 1118#if __cplusplus > 201402L 
#define PyInt_FromSsize_t
 
#define CPyCppyy_PyText_FromStringAndSize
 
Py_ssize_t PyNumber_AsSsize_t(PyObject *obj, PyObject *)
 
#define CPyCppyy_PyText_AsString
 
void CPyCppyy_PyBuffer_Release(PyObject *, Py_buffer *view)
 
#define CPyCppyy_PyText_AsStringChecked
 
#define CPyCppyy_PyText_FromString
 
#define PyVarObject_HEAD_INIT(type, size)
 
#define PyIndex_Check(obj)
 
#define ADJUST_PTR(ptr, suboffsets, dim)
 
static PyObject * ll_typecode(CPyCppyy::LowLevelView *self, void *)
 
static void * ptr_from_index(CPyCppyy::LowLevelView *llview, Py_ssize_t index)
 
static PyObject * ll_array(CPyCppyy::LowLevelView *self, PyObject *args, PyObject *)
 
static int ll_ass_sub(CPyCppyy::LowLevelView *self, PyObject *key, PyObject *value)
 
static PyObject * ll_item_multi(CPyCppyy::LowLevelView *self, PyObject *tup)
 
static Py_ssize_t is_multiindex(PyObject *key)
 
static Py_ssize_t ll_oldgetbuf(CPyCppyy::LowLevelView *self, Py_ssize_t seg, void **pptr)
 
static PySequenceMethods ll_as_sequence
 
static Py_ssize_t ll_getsegcount(PyObject *, Py_ssize_t *lenp)
 
static PyObject * ll_reshape(CPyCppyy::LowLevelView *self, PyObject *shape)
 
static CPyCppyy::LowLevelView * CreateLowLevelViewT(T *address, CPyCppyy::cdims_t shape, const char *format=nullptr, const char *name=nullptr, Py_ssize_t itemsize=-1)
 
static PyObject * ll_getcpparray(CPyCppyy::LowLevelView *pyobj)
 
#define CPYCPPYY_LL_FLAG_GETSET(name, flag, doc)
 
static bool equiv_shape(const Py_buffer *dest, const Py_buffer *src)
 
#define CPPYY_RET_W_CREATOR(type, fname)
 
static int ll_getbuf(CPyCppyy::LowLevelView *self, Py_buffer *view, int flags)
 
static void * ptr_from_tuple(CPyCppyy::LowLevelView *llview, PyObject *tup)
 
static int last_dim_is_contiguous(const Py_buffer *dest, const Py_buffer *src)
 
static PyBufferProcs ll_as_buffer
 
static PyMethodDef ll_methods[]
 
static bool equiv_structure(const Py_buffer *dest, const Py_buffer *src)
 
static void copy_base(const Py_ssize_t *shape, Py_ssize_t itemsize, char *dptr, const Py_ssize_t *dstrides, const Py_ssize_t *dsuboffsets, char *sptr, const Py_ssize_t *sstrides, const Py_ssize_t *ssuboffsets, char *mem)
 
static PyObject * ll_shape(CPyCppyy::LowLevelView *self)
 
static void ll_dealloc(CPyCppyy::LowLevelView *pyobj)
 
static int ll_setcpparray(CPyCppyy::LowLevelView *pyobj, PyObject *value, void *)
 
static PyMappingMethods ll_as_mapping
 
#define CPPYY_IMPL_VIEW_CREATOR(type)
 
static int ll_setownership(CPyCppyy::LowLevelView *pyobj, PyObject *value, void *)
 
static PyGetSetDef ll_getset[]
 
static CPyCppyy::LowLevelView * ll_new(PyTypeObject *subtype, PyObject *, PyObject *)
 
static PyObject * ll_item(CPyCppyy::LowLevelView *self, Py_ssize_t index)
 
static int copy_single(Py_buffer *dest, Py_buffer *src)
 
static PyObject * ll_iter(PyObject *self)
 
static int init_slice(Py_buffer *base, PyObject *_key, int dim)
 
static Py_ssize_t ll_length(CPyCppyy::LowLevelView *self)
 
static void set_strides(Py_buffer &view, size_t itemsize, bool isfix)
 
static bool is_multislice(PyObject *key)
 
static PyObject * ll_getownership(CPyCppyy::LowLevelView *pyobj)
 
static PyObject * ll_subscript(CPyCppyy::LowLevelView *self, PyObject *key)
 
static char * lookup_dimension(Py_buffer &view, char *ptr, int dim, Py_ssize_t index)
 
static PyObject * ll_as_string(CPyCppyy::LowLevelView *self)
 
#define HAVE_SUBOFFSETS_IN_LAST_DIM(view)
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t nitems
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
 
PyObject_HEAD Py_buffer fBufInfo
 
PyObject * CreateLowLevelView(bool *, cdims_t shape)
 
PyObject * CreateLowLevelViewString(char **, cdims_t shape)
 
static const dim_t UNKNOWN_SIZE
 
CPYCPPYY_EXTERN Converter * CreateConverter(const std::string &name, cdims_t=0)
 
PyObject * CreateLowLevelView_i8(int8_t *, cdims_t shape)
 
PyTypeObject LowLevelView_Type