33 for (
auto it = cache.begin(); it != cache.end(); ++it) {
34 if (it->first == pyprop->
fOffset) {
36 Py_INCREF(it->second);
47 if (!address || (intptr_t)address == -1 )
56 if (!ptr || (intptr_t)ptr == -1 ) {
87 PyErr_Format(PyExc_NotImplementedError,
88 "no converter available for \"%s\"", pyprop->
GetName().c_str());
96 const int errret = -1;
100 PyErr_SetString(PyExc_TypeError,
"assignment to const data not allowed");
107 for (
auto it = cache.begin(); it != cache.end(); ++it) {
108 if (it->first == pyprop->
fOffset) {
109 Py_XDECREF(it->second);
116 intptr_t address = (intptr_t)pyprop->
GetAddress(pyobj);
117 if (!address || address == -1 )
121 void* ptr = (
void*)address;
130 if (!PyErr_Occurred())
131 PyErr_SetString(PyExc_RuntimeError,
"property type mismatch or assignment not allowed");
147 pyprop->
fName =
nullptr;
160 Py_XDECREF(pyprop->
fName);
173 if (!PyArg_ParseTuple(args,
const_cast<char*
>(
"i|i:__cpp_reflex__"), &request, &
format))
181 return PyLong_FromLong(dm->
fOffset);
184 PyErr_Format(PyExc_ValueError,
"unsupported reflex request %d or format %d", request,
format);
190 {(
char*)
"__cpp_reflex__", (PyCFunction)
dm_reflex, METH_VARARGS,
191 (
char*)
"C++ datamember reflection information" },
192 {(
char*)
nullptr,
nullptr, 0,
nullptr }
198 (
char*)
"cppyy.CPPDataMember",
217 (
char*)
"cppyy data member (internal)",
242#
if PY_VERSION_HEX >= 0x02030000
245#
if PY_VERSION_HEX >= 0x02060000
248#
if PY_VERSION_HEX >= 0x03040000
264 std::vector<dim_t> dims;
270 if (ndim == 1) { dims.reserve(4); dims.push_back(0); }
271 dims.push_back(
size);
292 fEnclosingScope = scope;
294 fOffset = (intptr_t)address;
297 fFullType =
"unsigned int";
306 return (
void*)fOffset;
310 PyErr_SetString(PyExc_AttributeError,
"attribute access requires an instance");
316 PyErr_Format(PyExc_TypeError,
317 "object instance required for access to property \"%s\"", GetName().c_str());
323 PyErr_SetString(PyExc_ReferenceError,
"attempt to access a null-pointer");
329 if (pyobj->
ObjectIsA() != fEnclosingScope)
332 return (
void*)((intptr_t)obj +
offset + fOffset);
#define CPyCppyy_PyText_FromString
#define PyVarObject_HEAD_INIT(type, size)
std::ios_base::fmtflags fFlags
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t format
PyObject_HEAD intptr_t fOffset
Cppyy::TCppScope_t fEnclosingScope
void * GetAddress(CPPInstance *pyobj)
void Set(Cppyy::TCppScope_t scope, Cppyy::TCppIndex_t idata)
CI_DatamemberCache_t & GetDatamemberCache()
Cppyy::TCppType_t ObjectIsA(bool check_smart=true) const
virtual bool ToMemory(PyObject *value, void *address, PyObject *ctxt=nullptr)
virtual PyObject * FromMemory(void *address)
Set of helper functions that are invoked from the pythonizors, on the Python side.
static PyObject * pp_get(CPPDataMember *pyprop, CPPInstance *pyobj, PyObject *)
static int pp_set(CPPDataMember *pyprop, CPPInstance *pyobj, PyObject *value)
static void pp_dealloc(CPPDataMember *pyprop)
std::vector< std::pair< ptrdiff_t, PyObject * > > CI_DatamemberCache_t
bool LowLevelView_CheckExact(T *object)
bool CPPInstance_Check(T *object)
static PyMethodDef dm_methods[]
static CPPDataMember * pp_new(PyTypeObject *pytype, PyObject *, PyObject *)
static PyObject * dm_reflex(CPPDataMember *dm, PyObject *args)
PyTypeObject CPPDataMember_Type
CPYCPPYY_EXTERN Converter * CreateConverter(const std::string &name, Py_ssize_t *dims=nullptr)
const FormatId_t AS_STRING
RPY_EXPORTED ptrdiff_t GetBaseOffset(TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror=false)
RPY_EXPORTED bool IsEnumData(TCppScope_t scope, TCppIndex_t idata)
RPY_EXPORTED bool IsConstData(TCppScope_t scope, TCppIndex_t idata)
RPY_EXPORTED int GetDimensionSize(TCppScope_t scope, TCppIndex_t idata, int dimension)
RPY_EXPORTED std::string ResolveEnum(const std::string &enum_type)
RPY_EXPORTED bool IsStaticData(TCppScope_t scope, TCppIndex_t idata)
RPY_EXPORTED std::string GetDatamemberType(TCppScope_t scope, TCppIndex_t idata)
RPY_EXPORTED std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata)
RPY_EXPORTED intptr_t GetDatamemberOffset(TCppScope_t scope, TCppIndex_t idata)