Logo ROOT   6.08/07
Reference Guide
Macros | Functions
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 * getDoubleFormat ()
 
const char * getFloatFormat ()
 
const char * getIntFormat ()
 
const char * getLongFormat ()
 
const char * getShortFormat ()
 
const char * getUIntFormat ()
 
const char * getULongFormat ()
 
const char * getUShortFormat ()
 

Macro Definition Documentation

◆ PYBUFFER_SETFORMAT

#define PYBUFFER_SETFORMAT (   buf,
  name 
)

Definition at line 309 of file TPyBufferFactory.cxx.

◆ PYBUFFER_SETITEMSIZE

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

Definition at line 308 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; \
}
PyObject * PyBuffer_FromMemory(Bool_t *buf, Py_ssize_t size=-1)
int type
Definition: TGX11.cxx:120
int Py_ssize_t
Definition: PyROOT.h:156
char name[80]
Definition: TGX11.cxx:109
_object PyObject
Definition: TPyArg.h:22

Definition at line 316 of file TPyBufferFactory.cxx.

◆ PYROOT_IMPLEMENT_PYBUFFER_METHODS

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

Definition at line 123 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 ssizeobjargproc
Definition: PyROOT.h:164
#define lenfunc
Definition: PyROOT.h:165
#define ssizeargfunc
Definition: PyROOT.h:166
char name[80]
Definition: TGX11.cxx:109

Definition at line 258 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;
char name[80]
Definition: TGX11.cxx:109

Definition at line 47 of file TPyBufferFactory.cxx.

Function Documentation

◆ getBoolFormat()

const char* getBoolFormat ( )

Definition at line 297 of file TPyBufferFactory.cxx.

◆ getDoubleFormat()

const char* getDoubleFormat ( )

Definition at line 305 of file TPyBufferFactory.cxx.

◆ getFloatFormat()

const char* getFloatFormat ( )

Definition at line 304 of file TPyBufferFactory.cxx.

◆ getIntFormat()

const char* getIntFormat ( )

Definition at line 300 of file TPyBufferFactory.cxx.

◆ getLongFormat()

const char* getLongFormat ( )

Definition at line 302 of file TPyBufferFactory.cxx.

◆ getShortFormat()

const char* getShortFormat ( )

Definition at line 298 of file TPyBufferFactory.cxx.

◆ getUIntFormat()

const char* getUIntFormat ( )

Definition at line 301 of file TPyBufferFactory.cxx.

◆ getULongFormat()

const char* getULongFormat ( )

Definition at line 303 of file TPyBufferFactory.cxx.

◆ getUShortFormat()

const char* getUShortFormat ( )

Definition at line 299 of file TPyBufferFactory.cxx.