Logo ROOT  
Reference Guide
TPyBufferFactory.cxx File Reference
#include "PyROOT.h"
#include "TPyBufferFactory.h"
#include <map>
Include dependency graph for TPyBufferFactory.cxx:

Macros

#define PYBUFFER_SETFORMAT(buf, name)
 
#define PYBUFFER_SETITEMSIZE(buf, type)   ((PyBufferTop_t*)buf)->fItemSize = Py_ssize_t(sizeof(type))
 
#define PYROOT_IMPLEMENT_PYBUFFER_FROM_MEMORY(name, type)
 
#define PYROOT_IMPLEMENT_PYBUFFER_METHODS(name, type, stype, F1, F2)
 
#define PYROOT_INSTALL_PYBUFFER_METHODS(name, type)
 
#define PYROOT_PREPARE_PYBUFFER_TYPE(name)
 

Functions

const char * getBoolFormat ()
 
const char * getCharFormat ()
 
const char * getDoubleFormat ()
 
const char * getFloatFormat ()
 
const char * getIntFormat ()
 
const char * getLongFormat ()
 
const char * getShortFormat ()
 
const char * getUCharFormat ()
 
const char * getUIntFormat ()
 
const char * getULongFormat ()
 
const char * getUShortFormat ()
 

Macro Definition Documentation

◆ PYBUFFER_SETFORMAT

#define PYBUFFER_SETFORMAT (   buf,
  name 
)

Definition at line 355 of file TPyBufferFactory.cxx.

◆ PYBUFFER_SETITEMSIZE

#define PYBUFFER_SETITEMSIZE (   buf,
  type 
)    ((PyBufferTop_t*)buf)->fItemSize = Py_ssize_t(sizeof(type))

Definition at line 354 of file TPyBufferFactory.cxx.

◆ PYROOT_IMPLEMENT_PYBUFFER_FROM_MEMORY

#define PYROOT_IMPLEMENT_PYBUFFER_FROM_MEMORY (   name,
  type 
)
Value:
{ \
size = size < 0 ? INT_MAX : size; \
PyObject* buf = PyBuffer_FromReadWriteMemory( (void*)address, size ); \
if ( buf ) { \
Py_INCREF( (PyObject*)(void*)&Py##name##Buffer_Type ); \
buf->ob_type = &Py##name##Buffer_Type; \
PYBUFFER_SETITEMSIZE(buf,type); \
PYBUFFER_SETFORMAT(buf, name); \
} \
return buf; \
} \
\
{ \
PyObject* buf = PyBuffer_FromMemory( address, Py_ssize_t(0) ); \
if ( buf != 0 && PyCallable_Check( scb ) ) { \
Py_INCREF( scb ); \
gSizeCallbacks[ buf ] = scb; \
} \
return buf; \
}
int Py_ssize_t
Definition: PyROOT.h:171
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
_object PyObject
Definition: TPyArg.h:20
PyObject * PyBuffer_FromMemory(Bool_t *buf, Py_ssize_t size=-1)

Definition at line 362 of file TPyBufferFactory.cxx.

◆ PYROOT_IMPLEMENT_PYBUFFER_METHODS

#define PYROOT_IMPLEMENT_PYBUFFER_METHODS (   name,
  type,
  stype,
  F1,
  F2 
)

Definition at line 127 of file TPyBufferFactory.cxx.

◆ PYROOT_INSTALL_PYBUFFER_METHODS

#define PYROOT_INSTALL_PYBUFFER_METHODS (   name,
  type 
)
Value:
Py##name##Buffer_Type.tp_name = (char*)"ROOT.Py"#name"Buffer"; \
Py##name##Buffer_Type.tp_base = &PyBuffer_Type; \
Py##name##Buffer_Type.tp_as_buffer = PyBuffer_Type.tp_as_buffer; \
Py##name##Buffer_SeqMethods.sq_item = (ssizeargfunc)name##_buffer_item; \
Py##name##Buffer_SeqMethods.sq_ass_item = (ssizeobjargproc)name##_buffer_ass_item;\
Py##name##Buffer_SeqMethods.sq_length = (lenfunc)buffer_length; \
Py##name##Buffer_Type.tp_as_sequence = &Py##name##Buffer_SeqMethods; \
if ( PyBuffer_Type.tp_as_mapping ) { /* p2.6 and later */ \
Py##name##Buffer_MapMethods.mp_length = (lenfunc)buffer_length; \
Py##name##Buffer_MapMethods.mp_subscript = (binaryfunc)name##_buffer_subscript;\
Py##name##Buffer_MapMethods.mp_ass_subscript = (objobjargproc)pyroot_buffer_ass_subscript;\
Py##name##Buffer_Type.tp_as_mapping = &Py##name##Buffer_MapMethods; \
} \
Py##name##Buffer_Type.tp_str = (reprfunc)name##_buffer_str; \
Py##name##Buffer_Type.tp_methods = buffer_methods; \
Py##name##Buffer_Type.tp_getset = buffer_getset; \
PyType_Ready( &Py##name##Buffer_Type );
#define lenfunc
Definition: PyROOT.h:180
#define ssizeobjargproc
Definition: PyROOT.h:179
#define ssizeargfunc
Definition: PyROOT.h:181

Definition at line 300 of file TPyBufferFactory.cxx.

◆ PYROOT_PREPARE_PYBUFFER_TYPE

#define PYROOT_PREPARE_PYBUFFER_TYPE (   name)
Value:
PyTypeObject Py##name##Buffer_Type; \
PySequenceMethods Py##name##Buffer_SeqMethods = *(PyBuffer_Type.tp_as_sequence);\
PyMappingMethods Py##name##Buffer_MapMethods;

Definition at line 47 of file TPyBufferFactory.cxx.

Function Documentation

◆ getBoolFormat()

const char * getBoolFormat ( )

Definition at line 341 of file TPyBufferFactory.cxx.

◆ getCharFormat()

const char * getCharFormat ( )

Definition at line 342 of file TPyBufferFactory.cxx.

◆ getDoubleFormat()

const char * getDoubleFormat ( )

Definition at line 351 of file TPyBufferFactory.cxx.

◆ getFloatFormat()

const char * getFloatFormat ( )

Definition at line 350 of file TPyBufferFactory.cxx.

◆ getIntFormat()

const char * getIntFormat ( )

Definition at line 346 of file TPyBufferFactory.cxx.

◆ getLongFormat()

const char * getLongFormat ( )

Definition at line 348 of file TPyBufferFactory.cxx.

◆ getShortFormat()

const char * getShortFormat ( )

Definition at line 344 of file TPyBufferFactory.cxx.

◆ getUCharFormat()

const char * getUCharFormat ( )

Definition at line 343 of file TPyBufferFactory.cxx.

◆ getUIntFormat()

const char * getUIntFormat ( )

Definition at line 347 of file TPyBufferFactory.cxx.

◆ getULongFormat()

const char * getULongFormat ( )

Definition at line 349 of file TPyBufferFactory.cxx.

◆ getUShortFormat()

const char * getUShortFormat ( )

Definition at line 345 of file TPyBufferFactory.cxx.