28 void* address = pyprop->GetAddress( pyobj );
29 if ( ! address || (ptrdiff_t)address == -1 )
38 if ( ! ptr || (ptrdiff_t)ptr == -1 ) {
43 if ( pyprop->fConverter != 0 ) {
44 PyObject* result = pyprop->fConverter->FromMemory( ptr );
59 PyErr_Format( PyExc_NotImplementedError,
60 "no converter available for \"%s\"", pyprop->GetName().c_str() );
67 int pp_set( PropertyProxy* pyprop, ObjectProxy* pyobj,
PyObject* value )
69 const int errret = -1;
73 PyErr_SetString( PyExc_TypeError,
"assignment to const data not allowed" );
77 ptrdiff_t address = (ptrdiff_t)pyprop->GetAddress( pyobj );
78 if ( ! address || address == -1 )
82 void* ptr = (
void*)address;
87 if ( pyprop->fConverter && pyprop->fConverter->ToMemory( value, ptr ) )
91 if ( ! PyErr_Occurred() )
92 PyErr_SetString( PyExc_RuntimeError,
"property type mismatch or assignment not allowed" );
102 PropertyProxy* pyprop = (PropertyProxy*)pytype->tp_alloc( pytype, 0 );
105 pyprop->fProperty = 0;
106 pyprop->fConverter = 0;
107 pyprop->fEnclosingScope = 0;
108 new ( &pyprop->fName ) std::string();
116 void pp_dealloc( PropertyProxy* pyprop )
119 delete pyprop->fConverter;
120 pyprop->fName.~string();
128#if !defined(_MSC_VER)
129#pragma GCC diagnostic push
130#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
136 (
char*)
"ROOT.PropertyProxy",
139 (destructor)pp_dealloc,
156 (
char*)
"PyROOT property proxy (internal)",
168 (descrgetfunc)pp_get,
169 (descrsetfunc)pp_set,
181#
if PY_VERSION_HEX >= 0x02030000
184#
if PY_VERSION_HEX >= 0x02060000
187#
if PY_VERSION_HEX >= 0x03040000
190#
if PY_VERSION_HEX >= 0x03080000
192#
if PY_VERSION_HEX < 0x03090000
198#if !defined(_MSC_VER)
199#pragma GCC diagnostic pop
236 fEnclosingScope = scope;
238 fOffset = (ptrdiff_t)address;
248 return (
void*)fOffset;
256 PyErr_Format( PyExc_TypeError,
257 "object instance required for access to property \"%s\"",
GetName().c_str() );
263 PyErr_SetString( PyExc_ReferenceError,
"attempt to access a null-pointer" );
268 ptrdiff_t offset = 0;
269 if ( pyobj->
ObjectIsA() != fEnclosingScope)
272 return (
void*)((ptrdiff_t)obj + offset + fOffset);
#define PyVarObject_HEAD_INIT(type, size)
Cppyy::TCppType_t ObjectIsA() const
PyObject_HEAD ptrdiff_t fOffset
void Set(Cppyy::TCppScope_t scope, Cppyy::TCppIndex_t idata)
Cppyy::TCppScope_t fEnclosingScope
void * GetAddress(ObjectProxy *pyobj)
class attributes, global properties
The TEnum class implements the enum type.
ptrdiff_t GetBaseOffset(TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror=false)
std::string GetName(const std::string &scope_name)
Int_t GetDimensionSize(TCppScope_t scope, TCppIndex_t idata, int dimension)
Bool_t IsEnumData(TCppScope_t scope, TCppIndex_t idata)
Bool_t IsStaticData(TCppScope_t scope, TCppIndex_t idata)
std::string GetDatamemberType(TCppScope_t scope, TCppIndex_t idata)
ptrdiff_t GetDatamemberOffset(TCppScope_t scope, TCppIndex_t idata)
std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata)
std::string ResolveEnum(const TEnum *en)
Bool_t IsConstData(TCppScope_t scope, TCppIndex_t idata)
R__EXTERN PyObject * gLifeLine
Bool_t ObjectProxy_Check(T *object)
TConverter * CreateConverter(const std::string &fullType, Long_t size=-1)
PyTypeObject PropertyProxy_Type