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();
132 (
char*)
"ROOT.PropertyProxy",
135 (destructor)pp_dealloc,
151 (
char*)
"PyROOT property proxy (internal)",
163 (descrgetfunc)pp_get,
164 (descrsetfunc)pp_set,
176#
if PY_VERSION_HEX >= 0x02030000
179#
if PY_VERSION_HEX >= 0x02060000
182#
if PY_VERSION_HEX >= 0x03040000
221 fEnclosingScope = scope;
223 fOffset = (ptrdiff_t)address;
233 return (
void*)fOffset;
241 PyErr_Format( PyExc_TypeError,
242 "object instance required for access to property \"%s\"",
GetName().c_str() );
248 PyErr_SetString( PyExc_ReferenceError,
"attempt to access a null-pointer" );
253 ptrdiff_t offset = 0;
254 if ( pyobj->
ObjectIsA() != fEnclosingScope)
257 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