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 ) {
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();
130 PyTypeObject PropertyProxy_Type = {
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
193 fEnclosingScope = scope;
218 fEnclosingScope = scope;
220 fOffset = (ptrdiff_t)address;
230 return (
void*)fOffset;
238 PyErr_Format( PyExc_TypeError,
239 "object instance required for access to property \"%s\"", GetName().c_str() );
245 PyErr_SetString( PyExc_ReferenceError,
"attempt to access a null-pointer" );
250 ptrdiff_t offset = 0;
251 if ( pyobj->
ObjectIsA() != fEnclosingScope)
254 return (
void*)((ptrdiff_t)obj + offset + fOffset);
ptrdiff_t GetBaseOffset(TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror=false)
ptrdiff_t GetDatamemberOffset(TCppScope_t scope, TCppIndex_t idata)
Bool_t IsEnumData(TCppScope_t scope, TCppIndex_t idata)
std::string GetDatamemberType(TCppScope_t scope, TCppIndex_t idata)
Int_t GetDimensionSize(TCppScope_t scope, TCppIndex_t idata, int dimension)
#define PyVarObject_HEAD_INIT(type, size)
void * GetAddress(ObjectProxy *pyobj)
class attributes, global properties
Bool_t IsConstData(TCppScope_t scope, TCppIndex_t idata)
Cppyy::TCppType_t ObjectIsA() const
TConverter * CreateConverter(const std::string &fullType, Long_t size=-1)
Bool_t ObjectProxy_Check(T *object)
void Set(Cppyy::TCppScope_t scope, Cppyy::TCppIndex_t idata)
R__EXTERN PyObject * gLifeLine
std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata)
Bool_t IsStaticData(TCppScope_t scope, TCppIndex_t idata)