29#if __cplusplus > 201402L
36#if PY_VERSION_HEX < 0x03000000
37#if defined(__GNUC__) && !defined(__APPLE__)
38# if __GNUC__ > 4 && __has_include("codecvt")
61 static std::regex
s_fnptr(
"\\(:*\\*&*\\)");
64#if PY_VERSION_HEX < 0x03000000
66#elif PY_VERSION_HEX < 0x03080000
112#define ct_c_uint32 10
115#define ct_c_longlong 13
116#define ct_c_ulonglong 14
118#define ct_c_double 16
119#define ct_c_longdouble 17
120#define ct_c_char_p 18
121#define ct_c_wchar_p 19
122#define ct_c_void_p 20
123#define ct_c_fcomplex 21
124#define ct_c_complex 22
125#define ct_c_pointer 23
129 "c_bool",
"c_char",
"c_wchar",
"c_byte",
"c_ubyte",
"c_short",
"c_ushort",
"c_uint16",
130 "c_int",
"c_uint",
"c_uint32",
"c_long",
"c_ulong",
"c_longlong",
"c_ulonglong",
131 "c_float",
"c_double",
"c_longdouble",
132 "c_char_p",
"c_wchar_p",
"c_void_p",
"c_fcomplex",
"c_complex",
"_Pointer" };
142 static PyObject* ctmod = PyImport_ImportModule(
"ctypes");
149 ct_t = (PyTypeObject*)PyObject_GetAttrString(ctmod,
gCTypesNames[nidx]);
150 if (!ct_t) PyErr_Clear();
161 static PyObject* ctmod = PyImport_ImportModule(
"ctypes");
169 cpt_t = (PyTypeObject*)PyObject_GetAttrString(ctmod,
"c_char_p");
173 PyObject* ptrcreat = PyObject_GetAttrString(ctmod,
"POINTER");
174 cpt_t = (PyTypeObject*)PyObject_CallFunctionObjArgs(ptrcreat, ct_t, NULL);
188 static PyTypeObject* pycarg_type =
nullptr;
190 PyObject* ctmod = PyImport_ImportModule(
"ctypes");
191 if (!ctmod) PyErr_Clear();
193 PyTypeObject* ct_t = (PyTypeObject*)PyObject_GetAttrString(ctmod,
"c_int");
194 PyObject* cobj = ct_t->tp_new(ct_t,
nullptr,
nullptr);
195 PyObject* byref = PyObject_GetAttrString(ctmod,
"byref");
196 PyObject* pyptr = PyObject_CallFunctionObjArgs(byref, cobj, NULL);
197 Py_DECREF(byref); Py_DECREF(cobj); Py_DECREF(ct_t);
203 return Py_TYPE(pyobject) == pycarg_type;
208 static PyTypeObject* cstgdict_type =
nullptr;
209 if (!cstgdict_type) {
212 if (ct_int && ct_int->tp_dict) {
213 cstgdict_type =
Py_TYPE(ct_int->tp_dict);
217 PyTypeObject* pytype =
Py_TYPE(pyobject);
218 if (pytype->tp_dict &&
Py_TYPE(pytype->tp_dict) == cstgdict_type)
228 if (!holder)
return false;
233 std::ostringstream attr_name;
234 attr_name <<
"__" << ref;
235 auto res = PyObject_SetAttrString(holder, (
char*)attr_name.str().c_str(),
target);
242 if (!holder)
return false;
244 std::ostringstream attr_name;
245 attr_name <<
"__" << ref;
246 PyObject* res = PyObject_GetAttrString(holder, (
char*)attr_name.str().c_str());
273 else if (klass && PyTuple_CheckExact(castobj)) {
322 long l = PyLong_AsLong(pyobject);
324 if (!(
l == 0||
l == 1) || PyFloat_Check(pyobject)) {
325 PyErr_SetString(PyExc_ValueError,
"boolean value should be bool, or integer 1 or 0");
333#define CPPYY_PYLONG_AS_TYPE(name, type, limit_low, limit_high) \
334static inline type CPyCppyy_PyLong_As##name(PyObject* pyobject) \
336 if (!(PyLong_Check(pyobject) || PyInt_Check(pyobject))) { \
337 if (pyobject == CPyCppyy::gDefaultObject) \
339 PyErr_SetString(PyExc_TypeError, #type" conversion expects an integer object");\
342 long l = PyLong_AsLong(pyobject); \
343 if (l < limit_low || limit_high < l) { \
344 PyErr_Format(PyExc_ValueError, "integer %ld out of range for "#type, l);\
361 if (!(PyLong_Check(pyobject) || PyInt_Check(pyobject))) {
364 PyErr_SetString(PyExc_TypeError,
"int/long conversion expects an integer object");
368 return (
long)PyLong_AsLong(pyobject);
376 if (!(PyLong_Check(pyobject) || PyInt_Check(pyobject))) {
379 PyErr_SetString(PyExc_TypeError,
"int/long conversion expects an integer object");
383 return PyLong_AsLongLong(pyobject);
401 PyErr_Format(PyExc_TypeError,
402 "could not convert argument to buffer or nullptr");
426 PyTypeObject* pytype = (PyTypeObject*)
Py_TYPE(pyobject);
427 if (!(pytype == &PyList_Type || pytype == &PyTuple_Type)) {
443 Py_INCREF(pyobject); PyTuple_SET_ITEM(args, 0, pyobject);
447 if (!pytmp && PyTuple_CheckExact(pyobject)) {
450 pytmp = (
CPPInstance*)PyObject_Call(pyscope, pyobject, NULL);
480 PyErr_SetString(PyExc_TypeError,
"C++ type cannot be converted from memory");
488 PyErr_SetString(PyExc_TypeError,
"C++ type cannot be converted to memory");
494#define CPPYY_IMPL_BASIC_CONVERTER_BODY(name, type, stype, ctype, F1, F2, tc)\
496 type val = (type)F2(pyobject); \
497 if (val == (type)-1 && PyErr_Occurred()) { \
498 static PyTypeObject* ctypes_type = nullptr; \
499 if (!ctypes_type) { \
500 PyObject* pytype = 0, *pyvalue = 0, *pytrace = 0; \
501 PyErr_Fetch(&pytype, &pyvalue, &pytrace); \
502 ctypes_type = GetCTypesType(ct_##ctype); \
503 PyErr_Restore(pytype, pyvalue, pytrace); \
505 if (Py_TYPE(pyobject) == ctypes_type) { \
507 val = *((type*)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr); \
508 } else if (pyobject == CPyCppyy::gDefaultObject) { \
514 para.fValue.f##name = val; \
515 para.fTypeCode = tc; \
518#define CPPYY_IMPL_BASIC_CONVERTER_METHODS(name, type, stype, ctype, F1, F2) \
519PyObject* CPyCppyy::name##Converter::FromMemory(void* address) \
521 return F1((stype)*((type*)address)); \
524bool CPyCppyy::name##Converter::ToMemory( \
525 PyObject* value, void* address, PyObject* ) \
527 type s = (type)F2(value); \
528 if (s == (type)-1 && PyErr_Occurred()) { \
529 if (value == CPyCppyy::gDefaultObject) { \
535 *((type*)address) = (type)s; \
539#define CPPYY_IMPL_BASIC_CONVERTER_NI(name, type, stype, ctype, F1, F2, tc) \
540bool CPyCppyy::name##Converter::SetArg( \
541 PyObject* pyobject, Parameter& para, CallContext* ctxt) \
543 if (!StrictBool(pyobject, ctxt)) \
545 CPPYY_IMPL_BASIC_CONVERTER_BODY(name, type, stype, ctype, F1, F2, tc) \
547CPPYY_IMPL_BASIC_CONVERTER_METHODS(name, type, stype, ctype, F1, F2)
549#define CPPYY_IMPL_BASIC_CONVERTER_IB(name, type, stype, ctype, F1, F2, tc) \
550bool CPyCppyy::name##Converter::SetArg( \
551 PyObject* pyobject, Parameter& para, CallContext* ctxt) \
553 if (!ImplicitBool(pyobject, ctxt)) \
555 CPPYY_IMPL_BASIC_CONVERTER_BODY(name, type, stype, ctype, F1, F2, tc) \
557CPPYY_IMPL_BASIC_CONVERTER_METHODS(name, type, stype, ctype, F1, F2)
559#define CPPYY_IMPL_BASIC_CONVERTER_NB(name, type, stype, ctype, F1, F2, tc) \
560bool CPyCppyy::name##Converter::SetArg( \
561 PyObject* pyobject, Parameter& para, CallContext* ) \
563 if (PyBool_Check(pyobject)) \
565 CPPYY_IMPL_BASIC_CONVERTER_BODY(name, type, stype, ctype, F1, F2, tc) \
567CPPYY_IMPL_BASIC_CONVERTER_METHODS(name, type, stype, ctype, F1, F2)
577 PyErr_Format(PyExc_ValueError,
"%s expected, got bytes of size " PY_SSIZE_T_FORMAT,
583 PyErr_Format(PyExc_ValueError,
"%s expected, got str of size " PY_SSIZE_T_FORMAT,
587 }
else if (!PyFloat_Check(pyobject)) {
588 lchar = (
int)PyLong_AsLong(pyobject);
589 if (lchar == -1 && PyErr_Occurred())
591 else if (!(low <= lchar && lchar <= high)) {
592 PyErr_Format(PyExc_ValueError,
593 "integer to character: value %d not in range [%d,%d]", lchar, low, high);
597 PyErr_SetString(PyExc_TypeError,
"char or small int type expected");
603#define CPPYY_IMPL_REFCONVERTER_FROM_MEMORY(name, ctype) \
604PyObject* CPyCppyy::name##RefConverter::FromMemory(void* ptr) \
607 PyTypeObject* ctypes_type = GetCTypesType(ct_##ctype); \
608 if (!ctypes_type) { \
609 PyErr_SetString(PyExc_RuntimeError, "no ctypes available"); \
612 PyObject* ref = ctypes_type->tp_new(ctypes_type, nullptr, nullptr); \
613 ((CPyCppyy_tagCDataObject*)ref)->b_ptr = (char*)ptr; \
614 ((CPyCppyy_tagCDataObject*)ref)->b_needsfree = 0; \
619#define CPPYY_IMPL_BASIC_CONST_REFCONVERTER(name, type, ctype, F1) \
620bool CPyCppyy::Const##name##RefConverter::SetArg( \
621 PyObject* pyobject, Parameter& para, CallContext* ) \
623 type val = (type)F1(pyobject); \
624 if (val == (type)-1 && PyErr_Occurred()) { \
625 if (pyobject == CPyCppyy::gDefaultObject) { \
631 para.fValue.f##name = val; \
632 para.fRef = ¶.fValue.f##name; \
633 para.fTypeCode = 'r'; \
636CPPYY_IMPL_REFCONVERTER_FROM_MEMORY(Const##name, ctype)
639#define CPPYY_IMPL_BASIC_CONST_CHAR_REFCONVERTER(name, type, ctype, low, high)\
640bool CPyCppyy::Const##name##RefConverter::SetArg( \
641 PyObject* pyobject, Parameter& para, CallContext* ) \
644 type val = (type)ExtractChar(pyobject, #type, low, high); \
645 if (val == (type)-1 && PyErr_Occurred()) \
647 para.fValue.fLong = val; \
648 para.fTypeCode = 'l'; \
651CPPYY_IMPL_REFCONVERTER_FROM_MEMORY(Const##name, ctype)
655#define CPPYY_IMPL_BASIC_CHAR_CONVERTER(name, type, low, high) \
656bool CPyCppyy::name##Converter::SetArg( \
657 PyObject* pyobject, Parameter& para, CallContext* ) \
660 long val = ExtractChar(pyobject, #type, low, high); \
661 if (val == -1 && PyErr_Occurred()) \
663 para.fValue.fLong = val; \
664 para.fTypeCode = 'l'; \
668PyObject* CPyCppyy::name##Converter::FromMemory(void* address) \
671 return CPyCppyy_PyText_FromFormat("%c", *((type*)address)); \
674bool CPyCppyy::name##Converter::ToMemory( \
675 PyObject* value, void* address, PyObject*
) \
678 const char* cstr = nullptr; \
679 if (PyBytes_Check(value)) \
680 PyBytes_AsStringAndSize(value, (char**)&cstr, &len); \
682 cstr = CPyCppyy_PyText_AsStringAndSize(value, &len); \
685 PyErr_Format(PyExc_TypeError, #type" expected, got string of size %zd", len);\
688 *((type*)address) = (type)cstr[0]; \
691 long l = PyLong_AsLong(value); \
692 if (l == -1 && PyErr_Occurred()) { \
693 if (value == CPyCppyy::gDefaultObject) { \
699 if (!(low <= l && l <= high)) { \
700 PyErr_Format(PyExc_ValueError, \
701 "integer to character: value %ld not in range [%d,%d]", l, low, high);\
704 *((type*)address) = (type)l; \
718#if PY_VERSION_HEX < 0x03000000
720 para.fValue.fVoidp = (
void*)&((PyIntObject*)pyobject)->ob_ival;
721 para.fTypeCode =
'V';
728 para.fTypeCode =
'V';
733 para.fTypeCode =
'V';
737 PyErr_SetString(PyExc_TypeError,
"use ctypes.c_long for pass-by-ref of longs");
758bool CPyCppyy::IntRefConverter::SetArg(
762#if PY_VERSION_HEX < 0x03000000
764 para.
fValue.
fVoidp = (
void*)&((PyIntObject*)pyobject)->ob_ival;
770#if PY_VERSION_HEX >= 0x02050000
785#if PY_VERSION_HEX < 0x02050000
786 PyErr_SetString(PyExc_TypeError,
"use cppyy.Long for pass-by-ref of ints");
788 PyErr_SetString(PyExc_TypeError,
"use ctypes.c_int for pass-by-ref of ints");
794#define CPPYY_IMPL_REFCONVERTER(name, ctype, type, code) \
795bool CPyCppyy::name##RefConverter::SetArg( \
796 PyObject* pyobject, Parameter& para, CallContext* ) \
799 if (Py_TYPE(pyobject) == GetCTypesType(ct_##ctype)) { \
800 para.fValue.fVoidp = (void*)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr;\
801 para.fTypeCode = 'V'; \
804 bool res = CArraySetArg(pyobject, para, code, sizeof(type)); \
806 PyErr_SetString(PyExc_TypeError, "use ctypes."#ctype" for pass-by-ref of "#type);\
809 para.fTypeCode = 'V'; \
812CPPYY_IMPL_REFCONVERTER_FROM_MEMORY(name, ctype)
849 return PyInt_FromLong((
long)*((
unsigned char*)address));
853bool CPyCppyy::WCharConverter::SetArg(
858 PyErr_SetString(PyExc_ValueError,
"single wchar_t character expected");
870PyObject* CPyCppyy::WCharConverter::FromMemory(
void* address)
872 return PyUnicode_FromWideChar((
const wchar_t*)address, 1);
878 PyErr_SetString(PyExc_ValueError,
"single wchar_t character expected");
885 *((
wchar_t*)address) = val;
890bool CPyCppyy::Char16Converter::SetArg(
895 PyErr_SetString(PyExc_ValueError,
"single char16_t character expected");
899 PyObject* bstr = PyUnicode_AsUTF16String(pyobject);
900 if (!bstr)
return false;
909PyObject* CPyCppyy::Char16Converter::FromMemory(
void* address)
911 return PyUnicode_DecodeUTF16((
const char*)address,
sizeof(
char16_t),
nullptr,
nullptr);
917 PyErr_SetString(PyExc_ValueError,
"single char16_t character expected");
922 if (!bstr)
return false;
924 *((
char16_t*)address) = *(
char16_t*)(
PyBytes_AS_STRING(bstr) +
sizeof(char16_t) );
930bool CPyCppyy::Char32Converter::SetArg(
935 PyErr_SetString(PyExc_ValueError,
"single char32_t character expected");
939 PyObject* bstr = PyUnicode_AsUTF32String(pyobject);
940 if (!bstr)
return false;
949PyObject* CPyCppyy::Char32Converter::FromMemory(
void* address)
951 return PyUnicode_DecodeUTF32((
const char*)address,
sizeof(
char32_t),
nullptr,
nullptr);
957 PyErr_SetString(PyExc_ValueError,
"single char32_t character expected");
962 if (!bstr)
return false;
964 *((
char32_t*)address) = *(
char32_t*)(
PyBytes_AS_STRING(bstr) +
sizeof(char32_t) );
982bool CPyCppyy::ULongConverter::SetArg(
990 if (para.fValue.fULong == (
unsigned long)-1 && PyErr_Occurred())
992 para.fTypeCode =
'L';
996PyObject* CPyCppyy::ULongConverter::FromMemory(
void* address)
999 return PyLong_FromUnsignedLong(*((
unsigned long*)address));
1006 if (u == (
unsigned long)-1 && PyErr_Occurred()) {
1009 u = (
unsigned long)0;
1013 *((
unsigned long*)address) = u;
1018PyObject* CPyCppyy::UIntConverter::FromMemory(
void* address)
1021 return PyLong_FromUnsignedLong(*((
unsigned int*)address));
1028 if (u == (
unsigned long)-1 && PyErr_Occurred())
1031 if (u > (
unsigned long)UINT_MAX) {
1032 PyErr_SetString(PyExc_OverflowError,
"value too large for unsigned int");
1036 *((
unsigned int*)address) = (
unsigned int)u;
1042 Float,
float,
double, c_float, PyFloat_FromDouble, PyFloat_AsDouble,
'f')
1044 Double,
double,
double, c_double, PyFloat_FromDouble, PyFloat_AsDouble, '
d')
1049CPyCppyy::ComplexDConverter::ComplexDConverter(
bool keepControl) :
1050 InstanceConverter(
Cppyy::GetScope("std::complex<
double>"), keepControl) {}
1053bool CPyCppyy::ComplexDConverter::SetArg(
1056 const Py_complex& pc = PyComplex_AsCComplex(pyobject);
1057 if (pc.real != -1.0 || !PyErr_Occurred()) {
1065 return this->InstanceConverter::SetArg(pyobject, para, ctxt);
1068PyObject* CPyCppyy::ComplexDConverter::FromMemory(
void* address)
1070 std::complex<double>* dc = (std::complex<double>*)address;
1071 return PyComplex_FromDoubles(dc->real(), dc->imag());
1076 const Py_complex& pc = PyComplex_AsCComplex(
value);
1077 if (pc.real != -1.0 || !PyErr_Occurred()) {
1078 std::complex<double>* dc = (std::complex<double>*)address;
1083 return this->InstanceConverter::ToMemory(
value, address, ctxt);
1087bool CPyCppyy::DoubleRefConverter::SetArg(
1091#if PY_VERSION_HEX < 0x03000000
1093 para.
fValue.
fVoidp = (
void*)&((PyFloatObject*)pyobject)->ob_fval;
1099#if PY_VERSION_HEX >= 0x02050000
1114#if PY_VERSION_HEX < 0x02050000
1115 PyErr_SetString(PyExc_TypeError,
"use cppyy.Double for pass-by-ref of doubles");
1117 PyErr_SetString(PyExc_TypeError,
"use ctypes.c_double for pass-by-ref of doubles");
1131 PyErr_SetString(PyExc_SystemError,
"void/unknown arguments can\'t be set");
1136bool CPyCppyy::LLongConverter::SetArg(
1144 if (PyErr_Occurred())
1150PyObject* CPyCppyy::LLongConverter::FromMemory(
void* address)
1160 if (ll == -1 && PyErr_Occurred()) {
1172bool CPyCppyy::ULLongConverter::SetArg(
1180 if (PyErr_Occurred())
1186PyObject* CPyCppyy::ULLongConverter::FromMemory(
void* address)
1189 return PyLong_FromUnsignedLongLong(*(
PY_ULONG_LONG*)address);
1196 if (PyErr_Occurred()) {
1208bool CPyCppyy::CStringConverter::SetArg(
1216 PyObject* pytype = 0, *pyvalue = 0, *pytrace = 0;
1217 PyErr_Fetch(&pytype, &pyvalue, &pytrace);
1222 Py_XDECREF(pytype); Py_XDECREF(pyvalue); Py_XDECREF(pytrace);
1225 PyErr_Restore(pytype, pyvalue, pytrace);
1231 PyErr_Warn(PyExc_RuntimeWarning, (
char*)
"string too long for char array (truncated)");
1248PyObject* CPyCppyy::CStringConverter::FromMemory(
void* address)
1251 if (address && *(
void**)address) {
1255 if (*(
void**)address == (
void*)
fBuffer.data())
1272 if (!cstr)
return false;
1276 PyErr_Warn(PyExc_RuntimeWarning, (
char*)
"string too long for char array (truncated)");
1281 void* ptrval = *(
void**)address;
1282 if (ptrval == (
void*)
fBuffer.data()) {
1284 *(
void**)address = (
void*)
fBuffer.data();
1286 }
else if (ptrval &&
HasLifeLine(ctxt, (intptr_t)ptrval)) {
1294 *(
void**)address = (
void*)cstr;
1300 strncpy(*(
char**)address, cstr,
fMaxSize);
1303 strcpy(*(
char**)address, cstr);
1309bool CPyCppyy::WCStringConverter::SetArg(
1329PyObject* CPyCppyy::WCStringConverter::FromMemory(
void* address)
1332 if (address && *(
wchar_t**)address) {
1333 if (
fMaxSize != std::wstring::npos)
1336 return PyUnicode_FromWideChar(*(
wchar_t**)address, wcslen(*(
wchar_t**)address));
1341 return PyUnicode_FromWideChar(&
w, 0);
1353 PyErr_Warn(PyExc_RuntimeWarning, (
char*)
"string too long for wchar_t array (truncated)");
1356 if (
fMaxSize != std::wstring::npos)
1362 if (res == -1)
return false;
1367#define CPYCPPYY_WIDESTRING_CONVERTER(name, type, encode, decode, snull) \
1368bool CPyCppyy::name##Converter::SetArg( \
1369 PyObject* pyobject, Parameter& para, CallContext* ) \
1372 PyObject* bstr = encode(pyobject); \
1373 if (!bstr) return false; \
1375 Py_ssize_t len = PyBytes_GET_SIZE(bstr) - sizeof(type) ; \
1376 fBuffer = (type*)realloc(fBuffer, len + sizeof(type)); \
1377 memcpy(fBuffer, PyBytes_AS_STRING(bstr) + sizeof(type) , len); \
1380 fBuffer[len/sizeof(type)] = snull; \
1381 para.fValue.fVoidp = (void*)fBuffer; \
1382 para.fTypeCode = 'p'; \
1386PyObject* CPyCppyy::name##Converter::FromMemory(void* address) \
1389 if (address && *(type**)address) { \
1390 if (fMaxSize != std::wstring::npos) \
1391 return decode(*(const char**)address, (Py_ssize_t)fMaxSize*sizeof(type), nullptr, nullptr);\
1392 return decode(*(const char**)address, \
1393 std::char_traits<type>::length(*(type**)address)*sizeof(type), nullptr, nullptr);\
1398 return decode((const char*)&w, 0, nullptr, nullptr); \
1401bool CPyCppyy::name##Converter::ToMemory(PyObject* value, void* address, PyObject* )\
1404 PyObject* bstr = encode(value); \
1405 if (!bstr) return false; \
1407 Py_ssize_t len = PyBytes_GET_SIZE(bstr) - sizeof(type) ; \
1408 Py_ssize_t maxbytes = (Py_ssize_t)fMaxSize*sizeof(type); \
1411 if (fMaxSize != std::wstring::npos && maxbytes < len) { \
1412 PyErr_Warn(PyExc_RuntimeWarning, (char*)"string too long for "#type" array (truncated)");\
1416 memcpy(*((void**)address), PyBytes_AS_STRING(bstr) + sizeof(type)
, len);\
1419 if (len/sizeof(type) < fMaxSize) (*(type**)address)[len/sizeof(type)] = snull;\
1427bool CPyCppyy::NonConstCStringConverter::SetArg(
1431 if (this->CStringConverter::SetArg(pyobject, para, ctxt))
1436 return CArraySetArg(pyobject, para,
'c',
sizeof(
char));
1440PyObject* CPyCppyy::NonConstCStringConverter::FromMemory(
void* address)
1445 return this->CStringConverter::FromMemory(address);
1458 if (PyInt_CheckExact(pyobject) || PyLong_CheckExact(pyobject)) {
1459 intptr_t val = (intptr_t)PyLong_AsLongLong(pyobject);
1461 address = (
void*)val;
1495 if (GetAddressSpecialCase(pyobject, para.
fValue.
fVoidp)) {
1504 para.
fValue.
fVoidp = (
void*)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr;
1511 void** payload = (
void**)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr;
1536 if (!address || *(uintptr_t*)address == 0) {
1559 void* ptr =
nullptr;
1560 if (GetAddressSpecialCase(
value, ptr)) {
1561 *(
void**)address = ptr;
1566 void* buf =
nullptr;
1568 if (!buf || buflen == 0)
1571 *(
void**)address = buf;
1592 oldsz *= shape[idim];
1595 PyErr_SetString(PyExc_ValueError,
"buffer too large for value");
1600 memcpy(*(
type**)address, buf, (0 < buflen ? buflen : 1)*sizeof(
type));
1613#define CPPYY_IMPL_ARRAY_CONVERTER(name, ctype, type, code, suffix) \
1614CPyCppyy::name##ArrayConverter::name##ArrayConverter(cdims_t dims) : \
1616 fIsFixed = dims ? fShape[0] != UNKNOWN_SIZE : false; \
1619bool CPyCppyy::name##ArrayConverter::SetArg( \
1620 PyObject* pyobject, Parameter& para, CallContext* ctxt) \
1623 bool convOk = false; \
1626 if (fShape.ndim() == 2) { \
1627 if (Py_TYPE(pyobject) == GetCTypesPtrType(ct_##ctype)) { \
1628 para.fValue.fVoidp = (void*)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr;\
1629 para.fTypeCode = 'p'; \
1631 } else if (Py_TYPE(pyobject) == GetCTypesType(ct_c_void_p)) { \
1633 para.fValue.fVoidp = (void*)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr;\
1634 para.fTypeCode = 'p'; \
1636 } else if (LowLevelView_Check(pyobject) && \
1637 ((LowLevelView*)pyobject)->fBufInfo.ndim == 2 && \
1638 strchr(((LowLevelView*)pyobject)->fBufInfo.format, code)) { \
1639 para.fValue.fVoidp = ((LowLevelView*)pyobject)->get_buf(); \
1640 para.fTypeCode = 'p'; \
1647 PyTypeObject* ctypes_type = GetCTypesType(ct_##ctype); \
1648 if (Py_TYPE(pyobject) == ctypes_type) { \
1649 para.fValue.fVoidp = (void*)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr;\
1650 para.fTypeCode = 'p'; \
1652 } else if (Py_TYPE(pyobject) == GetCTypesPtrType(ct_##ctype)) { \
1653 para.fValue.fVoidp = (void*)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr;\
1654 para.fTypeCode = 'V'; \
1656 } else if (IsPyCArgObject(pyobject)) { \
1657 CPyCppyy_tagPyCArgObject* carg = (CPyCppyy_tagPyCArgObject*)pyobject;\
1658 if (carg->obj && Py_TYPE(carg->obj) == ctypes_type) { \
1659 para.fValue.fVoidp = (void*)((CPyCppyy_tagCDataObject*)carg->obj)->b_ptr;\
1660 para.fTypeCode = 'p'; \
1668 bool ismulti = fShape.ndim() > 1; \
1669 convOk = CArraySetArg(pyobject, para, code, ismulti ? sizeof(void*) : sizeof(type), true);\
1673 if (convOk) SetLifeLine(ctxt->fPyContext, pyobject, (intptr_t)this); \
1678PyObject* CPyCppyy::name##ArrayConverter::FromMemory(void* address) \
1681 return CreateLowLevelView##suffix((type**)address, fShape); \
1682 return CreateLowLevelView##suffix(*(type**)address, fShape); \
1685bool CPyCppyy::name##ArrayConverter::ToMemory( \
1686 PyObject* value, void* address, PyObject* ctxt) \
1688 if (fShape.ndim() <= 1 || fIsFixed) { \
1689 void* buf = nullptr; \
1690 Py_ssize_t buflen = Utility::GetBuffer(value, code, sizeof(type), buf);\
1691 return ToArrayFromBuffer<type>(value, address, ctxt, buf, buflen, fShape, fIsFixed);\
1693 void* buf = nullptr; \
1694 Py_ssize_t buflen = Utility::GetBuffer(value, code, sizeof(void*), buf);\
1695 if (buflen == 0) return false; \
1696 *(type**)address = (type*)buf; \
1697 SetLifeLine(ctxt, value, (intptr_t)address); \
1707#if __cplusplus > 201402L
1728bool CPyCppyy::CStringArrayConverter::SetArg(
1736 para.fTypeCode =
'V';
1740#if PY_VERSION_HEX >= 0x03000000
1747 size_t len = (size_t)PySequence_Size(pyobject);
1748 if (
len == (
size_t)-1) {
1749 PyErr_SetString(PyExc_ValueError,
"can not convert sequence object of unknown length");
1754 for (
size_t i = 0; i <
len; ++i) {
1755 PyObject* item = PySequence_GetItem(pyobject, i);
1763 PyErr_Format(PyExc_TypeError,
"could not convert item %d to string", (
int)i);
1771 para.fValue.fVoidp = (
void*)
fBuffer.data();
1772 para.fTypeCode =
'p';
1776 return SCharArrayConverter::SetArg(pyobject, para, ctxt);
1781PyObject* CPyCppyy::CStringArrayConverter::FromMemory(
void* address)
1799 return SCharArrayConverter::ToMemory(
value, address, ctxt);
1803PyObject* CPyCppyy::NonConstCStringArrayConverter::FromMemory(
void* address)
1830 Py_INCREF(pyobject);
1832 }
else if (PyUnicode_Check(pyobject)) {
1833#if PY_VERSION_HEX < 0x03030000
1834 pybytes = PyUnicode_EncodeUTF8(
1837 pybytes = PyUnicode_AsUTF8String(pyobject);
1843 const char* cstr =
nullptr;
1845 if (cstr) buffer = T{cstr, (
typename T::size_type)
len};
1853#define CPPYY_IMPL_STRING_AS_PRIMITIVE_CONVERTER(name, type, F1, F2) \
1854CPyCppyy::name##Converter::name##Converter(bool keepControl) : \
1855 InstanceConverter(Cppyy::GetScope(#type), keepControl) {} \
1857bool CPyCppyy::name##Converter::SetArg( \
1858 PyObject* pyobject, Parameter& para, CallContext* ctxt) \
1860 if (CPyCppyy_PyUnicodeAsBytes2Buffer(pyobject, fBuffer)) { \
1861 para.fValue.fVoidp = &fBuffer; \
1862 para.fTypeCode = 'V'; \
1867 if (!(PyInt_Check(pyobject) || PyLong_Check(pyobject))) { \
1868 bool result = InstanceConverter::SetArg(pyobject, para, ctxt); \
1869 para.fTypeCode = 'V'; \
1876PyObject* CPyCppyy::name##Converter::FromMemory(void* address) \
1879 return InstanceConverter::FromMemory(address); \
1880 auto* empty = new type(); \
1881 return BindCppObjectNoCast(empty, fClass, CPPInstance::kIsOwner); \
1884bool CPyCppyy::name##Converter::ToMemory( \
1885 PyObject* value, void* address, PyObject* ctxt) \
1887 if (CPyCppyy_PyUnicodeAsBytes2Buffer(value, *((type*)address))) \
1889 return InstanceConverter::ToMemory(value, address, ctxt); \
1896CPyCppyy::STLWStringConverter::STLWStringConverter(
bool keepControl) :
1897 InstanceConverter(
Cppyy::GetScope(
"std::wstring"), keepControl) {}
1899bool CPyCppyy::STLWStringConverter::SetArg(
1902 if (PyUnicode_Check(pyobject)) {
1910#if PY_VERSION_HEX < 0x03000000
1911 else if (PyString_Check(pyobject)) {
1913 std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cnv;
1914 fBuffer = cnv.from_bytes(PyString_AS_STRING(pyobject));
1916 PyObject* pyu = PyUnicode_FromString(PyString_AS_STRING(pyobject));
1917 if (!pyu)
return false;
1928 if (!(PyInt_Check(pyobject) || PyLong_Check(pyobject))) {
1937PyObject* CPyCppyy::STLWStringConverter::FromMemory(
void* address)
1940 return PyUnicode_FromWideChar(((std::wstring*)address)->c_str(), ((std::wstring*)address)->
size());
1942 return PyUnicode_FromWideChar(&
w, 0);
1947 if (PyUnicode_Check(
value)) {
1949 wchar_t* buf =
new wchar_t[
len+1];
1951 *((std::wstring*)address) = std::wstring(buf,
len);
1955 return InstanceConverter::ToMemory(
value, address, ctxt);
1959#if __cplusplus > 201402L
1960CPyCppyy::STLStringViewConverter::STLStringViewConverter(
bool keepControl) :
1961 InstanceConverter(
Cppyy::
GetScope(
"std::string_view"), keepControl) {}
1963bool CPyCppyy::STLStringViewConverter::SetArg(
1967 if (!PyInt_Check(pyobject) && !PyLong_Check(pyobject)) {
1969 if (InstanceConverter::SetArg(pyobject, para, ctxt)) {
1981 fBuffer = std::string_view(cstr, (std::string_view::size_type)
len);
2002 fBuffer = *((std::string*)ptr);
2012PyObject* CPyCppyy::STLStringViewConverter::FromMemory(
void* address)
2015 return InstanceConverter::FromMemory(address);
2016 auto* empty =
new std::string_view();
2020bool CPyCppyy::STLStringViewConverter::ToMemory(
2024 if (InstanceConverter::ToMemory(
value, address, ctxt))
2032 *
reinterpret_cast<std::string_view*
>(address) = \
2033 std::string_view(cstr, (std::string_view::size_type)
len);
2042bool CPyCppyy::STLStringMoveConverter::SetArg(
2046 int moveit_reason = 3;
2058 if (moveit_reason) {
2059 bool result = this->STLStringConverter::SetArg(pyobject, para, ctxt);
2060 if (!
result && moveit_reason == 2)
2065 PyErr_SetString(PyExc_ValueError,
"object is not an rvalue");
2071template <
bool ISCONST>
2078 if (GetAddressSpecialCase(pyobject, para.
fValue.
fVoidp)) {
2114template <
bool ISCONST>
2124template <
bool ISCONST>
2130 void* ptr =
nullptr;
2131 if (GetAddressSpecialCase(
value, ptr)) {
2132 *(
void**)address = ptr;
2155bool CPyCppyy::InstanceConverter::SetArg(
2182PyObject* CPyCppyy::InstanceConverter::FromMemory(
void* address)
2208bool CPyCppyy::InstanceRefConverter::SetArg(
2221 bool argset =
false;
2242 PyErr_SetString(PyExc_ReferenceError,
"attempt to access a null-pointer");
2264PyObject* CPyCppyy::InstanceRefConverter::FromMemory(
void* address)
2270bool CPyCppyy::InstanceMoveConverter::SetArg(
2281 int moveit_reason = 0;
2289 if (moveit_reason) {
2290 bool result = this->InstanceRefConverter::SetArg(pyobject, para, ctxt);
2291 if (!
result && moveit_reason == 2)
2296 PyErr_SetString(PyExc_ValueError,
"object is not an rvalue");
2301template <
bool ISREFERENCE>
2302bool CPyCppyy::InstancePtrPtrConverter<ISREFERENCE>::SetArg(
2327 para.
fTypeCode = ISREFERENCE ?
'V' :
'p';
2335template <
bool ISREFERENCE>
2336PyObject* CPyCppyy::InstancePtrPtrConverter<ISREFERENCE>::FromMemory(
void* address)
2343template <
bool ISREFERENCE>
2344bool CPyCppyy::InstancePtrPtrConverter<ISREFERENCE>::ToMemory(
2352 *(
void**)address =
nullptr;
2379 template class CPyCppyy::InstancePtrPtrConverter<true>;
2380 template class CPyCppyy::InstancePtrPtrConverter<false>;
2384bool CPyCppyy::InstanceArrayConverter::SetArg(
2393 if (PyTuple_Size(pyobject) < 1)
2396 PyObject* first = PyTuple_GetItem(pyobject, 0);
2411PyObject* CPyCppyy::InstanceArrayConverter::FromMemory(
void* address)
2418bool CPyCppyy::InstanceArrayConverter::ToMemory(
2424 PyErr_SetString(PyExc_NotImplementedError,
2425 "access to C-arrays of objects not yet implemented!");
2432bool CPyCppyy::STLIteratorConverter::SetArg(
2447bool CPyCppyy::VoidPtrRefConverter::SetArg(
2462CPyCppyy::VoidPtrPtrConverter::VoidPtrPtrConverter(
cdims_t dims) :
2468bool CPyCppyy::VoidPtrPtrConverter::SetArg(
2501PyObject* CPyCppyy::VoidPtrPtrConverter::FromMemory(
void* address)
2504 if (!address || *(ptrdiff_t*)address == 0) {
2514bool CPyCppyy::PyObjectConverter::SetArg(
2523PyObject* CPyCppyy::PyObjectConverter::FromMemory(
void* address)
2532 Py_INCREF(pyobject);
2540 Py_XDECREF(*((
PyObject**)address));
2559 auto key = ipos->second.second;
2562 void* wpraddress = ipos->second.first;
2565 if (lookup !=
sWrapperLookup.end()) lookup->second.erase(*oldref);
2567 sWrapperFree[ipos->second.second].push_back(wpraddress);
2570 Py_DECREF(ipos->first);
2577 const_cast<char*
>(
"internal_WrapperCacheEraser"),
2583 const std::string& rettype,
const std::string& signature)
2602 void* fptr = (
void*)
m->GetFunctionAddress();
2603 if (fptr)
return fptr;
2612 std::string fullname = pytmpl->
fTI->fCppName;
2619 if (fptr)
return fptr;
2624 if (PyCallable_Check(pyobject)) {
2626 void* wpraddress =
nullptr;
2629 auto key = rettype+signature;
2632 const auto& existing = lookup->second.find(pyobject);
2633 if (existing != lookup->second.end() && *
sWrapperReference[existing->second] == pyobject)
2634 wpraddress = existing->second;
2640 if (freewrap !=
sWrapperFree.end() && !freewrap->second.empty()) {
2641 wpraddress = freewrap->second.back();
2642 freewrap->second.pop_back();
2645 PyObject* wref = PyWeakref_NewRef(pyobject, sWrapperCacheEraser);
2658 int nArgs = (
int)argtypes.size();
2661 std::ostringstream wname;
2665 std::ostringstream code;
2666 code <<
"namespace __cppyy_internal {\n "
2667 << rettype <<
" " << wname.str() <<
"(";
2668 for (
int i = 0; i < nArgs; ++i) {
2669 code << argtypes[i] <<
" arg" << i;
2670 if (i != nArgs-1) code <<
", ";
2681 code <<
" PyObject** ref = (PyObject**)" << (intptr_t)ref <<
";\n"
2682 " PyObject* pyresult = nullptr;\n"
2683 " if (*ref) pyresult = PyObject_CallFunctionObjArgs(*ref";
2684 for (
int i = 0; i < nArgs; ++i)
2685 code <<
", pyargs[" << i <<
"]";
2686 code <<
", NULL);\n"
2687 " else PyErr_SetString(PyExc_TypeError, \"callable was deleted\");\n";
2707 PyObject* wref = PyWeakref_NewRef(pyobject, sWrapperCacheEraser);
2719bool CPyCppyy::FunctionPointerConverter::SetArg(
2741PyObject* CPyCppyy::FunctionPointerConverter::FromMemory(
void* address)
2748 PyErr_SetString(PyExc_TypeError,
"can not convert null function pointer");
2752bool CPyCppyy::FunctionPointerConverter::ToMemory(
2757 *((
void**)address) =
nullptr;
2765 *((
void**)address) = fptr;
2774bool CPyCppyy::StdFunctionConverter::SetArg(
2785 if (this->FunctionPointerConverter::SetArg(pyobject, para, ctxt)) {
2793 else Py_DECREF(func);
2801PyObject* CPyCppyy::StdFunctionConverter::FromMemory(
void* address)
2816bool CPyCppyy::SmartPtrConverter::SetArg(
2819 char typeCode =
fIsRef ?
'p' :
'V';
2882 Py_XDECREF(pysmart);
2907PyObject* CPyCppyy::SmartPtrConverter::FromMemory(
void* address)
2920#if defined (_LIBCPP_INITIALIZER_LIST) || defined(__GNUC__)
2923 typedef size_t size_type;
2924 typedef void* iterator;
2928#elif defined (_MSC_VER)
2931 typedef char* iterator;
2936#define NO_KNOWN_INITIALIZER_LIST 1
2941CPyCppyy::InitializerListConverter::InitializerListConverter(
Cppyy::TCppType_t klass, std::string
const &value_type)
2943 : InstanceConverter{klass},
2950CPyCppyy::InitializerListConverter::~InitializerListConverter()
2953 if (converter && converter->HasState())
delete converter;
2958void CPyCppyy::InitializerListConverter::Clear() {
2960 faux_initlist* fake = (faux_initlist*)
fBuffer;
2961#if defined (_LIBCPP_INITIALIZER_LIST) || defined(__GNUC__)
2962 for (faux_initlist::size_type i = 0; i < fake->_M_len; ++i) {
2963#elif defined (_MSC_VER)
2964 for (
size_t i = 0; (fake->_M_array+i*
fValueSize) != fake->_Last; ++i) {
2966 void* memloc = (
char*)fake->_M_array + i*
fValueSize;
2975bool CPyCppyy::InitializerListConverter::SetArg(
2978#ifdef NO_KNOWN_INITIALIZER_LIST
2987#
if PY_VERSION_HEX >= 0x03000000
2990 || PyUnicode_Check(pyobject)
2996 return this->InstanceConverter::SetArg(pyobject, para, ctxt);
2998 void* buf =
nullptr;
3000 faux_initlist* fake =
nullptr;
3002 if (buf && buflen) {
3004 fake = (faux_initlist*)
malloc(
sizeof(faux_initlist));
3006 fake->_M_array = (faux_initlist::iterator)buf;
3007#if defined (_LIBCPP_INITIALIZER_LIST) || defined(__GNUC__)
3008 fake->_M_len = (faux_initlist::size_type)buflen;
3009#elif defined (_MSC_VER)
3010 fake->_Last = fake->_M_array+buflen*
fValueSize;
3020 size_t len = (size_t)PySequence_Size(pyobject);
3023 fake->_M_array = (faux_initlist::iterator)((
char*)fake+
sizeof(faux_initlist));
3024#if defined (_LIBCPP_INITIALIZER_LIST) || defined(__GNUC__)
3025 fake->_M_len = (faux_initlist::size_type)
len;
3026 for (faux_initlist::size_type i = 0; i < fake->_M_len; ++i) {
3027#elif defined (_MSC_VER)
3029 for (
size_t i = 0; (fake->_M_array+i*
fValueSize) != fake->_Last; ++i) {
3031 PyObject* item = PySequence_GetItem(pyobject, i);
3032 bool convert_ok =
false;
3043 void* memloc = (
char*)fake->_M_array + i*
fValueSize;
3049 if (memloc) entries += 1;
3051 PyErr_SetString(PyExc_TypeError,
3052 "default ctor needed for initializer list of objects");
3056 convert_ok = converter->
ToMemory(item, memloc);
3064 PyErr_Format(PyExc_TypeError,
"failed to get item %d from sequence", (
int)i);
3067#if defined (_LIBCPP_INITIALIZER_LIST) || defined(__GNUC__)
3068 fake->_M_len = (faux_initlist::size_type)entries;
3069#elif defined (_MSC_VER)
3070 fake->_Last = fake->_M_array+entries*
fValueSize;
3091 PyErr_SetString(PyExc_NotImplementedError,
"this method cannot (yet) be called");
3103 if (cpd ==
"**" || cpd ==
"*[]" || cpd ==
"&*")
3104 result =
new InstancePtrPtrConverter<false>(klass, control);
3105 else if (cpd ==
"*&")
3106 result =
new InstancePtrPtrConverter<true>(klass, control);
3111 else if (cpd ==
"&")
3112 result =
new InstanceRefConverter(klass, isConst);
3113 else if (cpd ==
"&&")
3114 result =
new InstanceMoveConverter(klass);
3115 else if (cpd ==
"[]" || dims)
3116 result =
new InstanceArrayConverter(klass, dims,
false);
3118 result =
new InstanceConverter(klass,
true);
3139 return (
h->second)(dims);
3146 if (resolvedType != fullType) {
3149 return (
h->second)(dims);
3153 bool isConst = strncmp(resolvedType.c_str(),
"const", 5) == 0;
3160 return (
h->second)(dims);
3167 return (
h->second)(dims);
3171 if (cpd.compare(0, 3,
"*[]") == 0) {
3177 if (realType !=
"void" && realType !=
"char") {
3185 for (
int i = 2; i < (newdim-1); ++i)
3186 newdims[i] = dims[i-1];
3189 return (
h->second)(newdims);
3191 return (
h->second)(dims);
3194 }
else if (!cpd.empty() && (std::string::size_type)std::count(cpd.begin(), cpd.end(),
'*') == cpd.size()) {
3198 return (
h->second)((!dims && 1 < cpd.size()) ?
dims_t(cpd.size()) : dims);
3200 }
else if (2 <= cpd.size() && (std::string::size_type)std::count(cpd.begin(), cpd.end(),
'[') == cpd.size() / 2) {
3204 return (
h->second)(dims);
3208 if (realType.compare(0, 16,
"initializer_list") == 0) {
3210 auto pos = realType.find(
'<');
3211 std::string value_type = realType.substr(pos+1, realType.size()-pos-2);
3212 return new InitializerListConverter(
Cppyy::GetScope(realType), value_type);
3216 bool control = cpd ==
"&" || isConst;
3219 auto pos = resolvedType.find(
"function<");
3220 if (pos == 0 || pos == 5 ||
3221 pos == 6 || pos == 11 ) {
3229 auto pos1 = resolvedType.find(
"(", pos+9);
3230 auto pos2 = resolvedType.rfind(
")");
3231 if (pos1 != std::string::npos && pos2 != std::string::npos) {
3232 auto sz1 = pos1-pos-9;
3233 if (resolvedType[pos+9+sz1-1] ==
' ') sz1 -= 1;
3235 return new StdFunctionConverter(cnv,
3236 resolvedType.substr(pos+9, sz1), resolvedType.substr(pos1, pos2-pos1+1));
3248 result =
new SmartPtrConverter(klass, raw, control);
3249 }
else if (cpd ==
"&") {
3250 result =
new SmartPtrConverter(klass, raw);
3252 result =
new SmartPtrConverter(klass, raw, control,
true);
3259 static STLIteratorConverter
c;
3267 if (std::regex_search(resolvedType, sm,
s_fnptr)) {
3269 auto pos1 = sm.position(0);
3270 auto pos2 = resolvedType.rfind(
')');
3271 result =
new FunctionPointerConverter(
3272 resolvedType.substr(0, pos1), resolvedType.substr(pos1+sm.length(), pos2-1));
3276 if (!
result && cpd ==
"&&") {
3280 return (
h->second)(dims);
3282 result =
new NotImplementedConverter();
3290 if (cpd.size() == 2 && cpd !=
"&&")
3291 result =
new VoidPtrPtrConverter(dims.
ndim());
3292 else if (!cpd.empty())
3295 result =
new NotImplementedConverter();
3305 if (
p &&
p->HasState())
3359std::string::size_type dims2stringsz(
cdims_t d) {
3363#define STRINGVIEW "basic_string_view<char,char_traits<char> >"
3364#define WSTRING1 "std::basic_string<wchar_t>"
3365#define WSTRING2 "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>"
3369#define CCOMPLEX_D "_Complex double"
3370#define CCOMPLEX_F "_Complex float"
3372#define CCOMPLEX_D "_C_double_complex"
3373#define CCOMPLEX_F "_C_float_complex"
3376static struct InitConvFactories_t {
3378 InitConvFactories_t() {
3383 gf[
"bool"] = (
cf_t)+[](
cdims_t) {
static BoolConverter
c{};
return &
c; };
3384 gf[
"const bool&"] = (
cf_t)+[](
cdims_t) {
static ConstBoolRefConverter
c{};
return &
c; };
3385 gf[
"bool&"] = (
cf_t)+[](
cdims_t) {
static BoolRefConverter
c{};
return &
c; };
3386 gf[
"char"] = (
cf_t)+[](
cdims_t) {
static CharConverter
c{};
return &
c; };
3387 gf[
"const char&"] = (
cf_t)+[](
cdims_t) {
static ConstCharRefConverter
c{};
return &
c; };
3388 gf[
"char&"] = (
cf_t)+[](
cdims_t) {
static CharRefConverter
c{};
return &
c; };
3389 gf[
"signed char&"] = (
cf_t)+[](
cdims_t) {
static SCharRefConverter
c{};
return &
c; };
3390 gf[
"unsigned char"] = (
cf_t)+[](
cdims_t) {
static UCharConverter
c{};
return &
c; };
3391 gf[
"const unsigned char&"] = (
cf_t)+[](
cdims_t) {
static ConstUCharRefConverter
c{};
return &
c; };
3392 gf[
"unsigned char&"] = (
cf_t)+[](
cdims_t) {
static UCharRefConverter
c{};
return &
c; };
3393 gf[
"UCharAsInt"] = (
cf_t)+[](
cdims_t) {
static UCharAsIntConverter
c{};
return &
c; };
3394 gf[
"wchar_t"] = (
cf_t)+[](
cdims_t) {
static WCharConverter
c{};
return &
c; };
3395 gf[
"char16_t"] = (
cf_t)+[](
cdims_t) {
static Char16Converter
c{};
return &
c; };
3396 gf[
"char32_t"] = (
cf_t)+[](
cdims_t) {
static Char32Converter
c{};
return &
c; };
3397 gf[
"wchar_t&"] = (
cf_t)+[](
cdims_t) {
static WCharRefConverter
c{};
return &
c; };
3398 gf[
"char16_t&"] = (
cf_t)+[](
cdims_t) {
static Char16RefConverter
c{};
return &
c; };
3399 gf[
"char32_t&"] = (
cf_t)+[](
cdims_t) {
static Char32RefConverter
c{};
return &
c; };
3400 gf[
"int8_t"] = (
cf_t)+[](
cdims_t) {
static Int8Converter
c{};
return &
c; };
3401 gf[
"const int8_t&"] = (
cf_t)+[](
cdims_t) {
static ConstInt8RefConverter
c{};
return &
c; };
3402 gf[
"int8_t&"] = (
cf_t)+[](
cdims_t) {
static Int8RefConverter
c{};
return &
c; };
3403 gf[
"uint8_t"] = (
cf_t)+[](
cdims_t) {
static UInt8Converter
c{};
return &
c; };
3404 gf[
"const uint8_t&"] = (
cf_t)+[](
cdims_t) {
static ConstUInt8RefConverter
c{};
return &
c; };
3405 gf[
"uint8_t&"] = (
cf_t)+[](
cdims_t) {
static UInt8RefConverter
c{};
return &
c; };
3406 gf[
"short"] = (
cf_t)+[](
cdims_t) {
static ShortConverter
c{};
return &
c; };
3407 gf[
"const short&"] = (
cf_t)+[](
cdims_t) {
static ConstShortRefConverter
c{};
return &
c; };
3408 gf[
"short&"] = (
cf_t)+[](
cdims_t) {
static ShortRefConverter
c{};
return &
c; };
3409 gf[
"unsigned short"] = (
cf_t)+[](
cdims_t) {
static UShortConverter
c{};
return &
c; };
3410 gf[
"const unsigned short&"] = (
cf_t)+[](
cdims_t) {
static ConstUShortRefConverter
c{};
return &
c; };
3411 gf[
"unsigned short&"] = (
cf_t)+[](
cdims_t) {
static UShortRefConverter
c{};
return &
c; };
3412 gf[
"int"] = (
cf_t)+[](
cdims_t) {
static IntConverter
c{};
return &
c; };
3413 gf[
"int&"] = (
cf_t)+[](
cdims_t) {
static IntRefConverter
c{};
return &
c; };
3414 gf[
"const int&"] = (
cf_t)+[](
cdims_t) {
static ConstIntRefConverter
c{};
return &
c; };
3415 gf[
"unsigned int"] = (
cf_t)+[](
cdims_t) {
static UIntConverter
c{};
return &
c; };
3416 gf[
"const unsigned int&"] = (
cf_t)+[](
cdims_t) {
static ConstUIntRefConverter
c{};
return &
c; };
3417 gf[
"unsigned int&"] = (
cf_t)+[](
cdims_t) {
static UIntRefConverter
c{};
return &
c; };
3418 gf[
"long"] = (
cf_t)+[](
cdims_t) {
static LongConverter
c{};
return &
c; };
3419 gf[
"long&"] = (
cf_t)+[](
cdims_t) {
static LongRefConverter
c{};
return &
c; };
3420 gf[
"const long&"] = (
cf_t)+[](
cdims_t) {
static ConstLongRefConverter
c{};
return &
c; };
3421 gf[
"unsigned long"] = (
cf_t)+[](
cdims_t) {
static ULongConverter
c{};
return &
c; };
3422 gf[
"const unsigned long&"] = (
cf_t)+[](
cdims_t) {
static ConstULongRefConverter
c{};
return &
c; };
3423 gf[
"unsigned long&"] = (
cf_t)+[](
cdims_t) {
static ULongRefConverter
c{};
return &
c; };
3424 gf[
"long long"] = (
cf_t)+[](
cdims_t) {
static LLongConverter
c{};
return &
c; };
3425 gf[
"const long long&"] = (
cf_t)+[](
cdims_t) {
static ConstLLongRefConverter
c{};
return &
c; };
3426 gf[
"long long&"] = (
cf_t)+[](
cdims_t) {
static LLongRefConverter
c{};
return &
c; };
3427 gf[
"unsigned long long"] = (
cf_t)+[](
cdims_t) {
static ULLongConverter
c{};
return &
c; };
3428 gf[
"const unsigned long long&"] = (
cf_t)+[](
cdims_t) {
static ConstULLongRefConverter
c{};
return &
c; };
3429 gf[
"unsigned long long&"] = (
cf_t)+[](
cdims_t) {
static ULLongRefConverter
c{};
return &
c; };
3431 gf[
"float"] = (
cf_t)+[](
cdims_t) {
static FloatConverter
c{};
return &
c; };
3432 gf[
"const float&"] = (
cf_t)+[](
cdims_t) {
static ConstFloatRefConverter
c{};
return &
c; };
3433 gf[
"float&"] = (
cf_t)+[](
cdims_t) {
static FloatRefConverter
c{};
return &
c; };
3434 gf[
"double"] = (
cf_t)+[](
cdims_t) {
static DoubleConverter
c{};
return &
c; };
3435 gf[
"double&"] = (
cf_t)+[](
cdims_t) {
static DoubleRefConverter
c{};
return &
c; };
3436 gf[
"const double&"] = (
cf_t)+[](
cdims_t) {
static ConstDoubleRefConverter
c{};
return &
c; };
3437 gf[
"long double"] = (
cf_t)+[](
cdims_t) {
static LDoubleConverter
c{};
return &
c; };
3438 gf[
"const long double&"] = (
cf_t)+[](
cdims_t) {
static ConstLDoubleRefConverter
c{};
return &
c; };
3439 gf[
"long double&"] = (
cf_t)+[](
cdims_t) {
static LDoubleRefConverter
c{};
return &
c; };
3440 gf[
"std::complex<double>"] = (
cf_t)+[](
cdims_t) {
return new ComplexDConverter{}; };
3441 gf[
"const std::complex<double>&"] = (
cf_t)+[](
cdims_t) {
return new ComplexDConverter{}; };
3442 gf[
"void"] = (
cf_t)+[](
cdims_t) {
static VoidConverter
c{};
return &
c; };
3445 gf[
"bool ptr"] = (
cf_t)+[](
cdims_t d) {
return new BoolArrayConverter{
d}; };
3446 gf[
"const signed char[]"] = (
cf_t)+[](
cdims_t d) {
return new SCharArrayConverter{
d}; };
3447 gf[
"signed char[]"] = gf[
"const signed char[]"];
3449 gf[
"const unsigned char*"] = (
cf_t)+[](
cdims_t d) {
return new UCharArrayConverter{
d}; };
3450 gf[
"unsigned char ptr"] = (
cf_t)+[](
cdims_t d) {
return new UCharArrayConverter{
d}; };
3451 gf[
"UCharAsInt*"] = gf[
"unsigned char ptr"];
3452 gf[
"UCharAsInt[]"] = gf[
"unsigned char ptr"];
3453#if __cplusplus > 201402L
3454 gf[
"std::byte ptr"] = (
cf_t)+[](
cdims_t d) {
return new ByteArrayConverter{
d}; };
3456 gf[
"int8_t ptr"] = (
cf_t)+[](
cdims_t d) {
return new Int8ArrayConverter{
d}; };
3457 gf[
"uint8_t ptr"] = (
cf_t)+[](
cdims_t d) {
return new UInt8ArrayConverter{
d}; };
3458 gf[
"short ptr"] = (
cf_t)+[](
cdims_t d) {
return new ShortArrayConverter{
d}; };
3459 gf[
"unsigned short ptr"] = (
cf_t)+[](
cdims_t d) {
return new UShortArrayConverter{
d}; };
3460 gf[
"int ptr"] = (
cf_t)+[](
cdims_t d) {
return new IntArrayConverter{
d}; };
3461 gf[
"unsigned int ptr"] = (
cf_t)+[](
cdims_t d) {
return new UIntArrayConverter{
d}; };
3462 gf[
"long ptr"] = (
cf_t)+[](
cdims_t d) {
return new LongArrayConverter{
d}; };
3463 gf[
"unsigned long ptr"] = (
cf_t)+[](
cdims_t d) {
return new ULongArrayConverter{
d}; };
3464 gf[
"long long ptr"] = (
cf_t)+[](
cdims_t d) {
return new LLongArrayConverter{
d}; };
3465 gf[
"unsigned long long ptr"] = (
cf_t)+[](
cdims_t d) {
return new ULLongArrayConverter{
d}; };
3466 gf[
"float ptr"] = (
cf_t)+[](
cdims_t d) {
return new FloatArrayConverter{
d}; };
3467 gf[
"double ptr"] = (
cf_t)+[](
cdims_t d) {
return new DoubleArrayConverter{
d}; };
3468 gf[
"long double ptr"] = (
cf_t)+[](
cdims_t d) {
return new LDoubleArrayConverter{
d}; };
3469 gf[
"std::complex<float> ptr"] = (
cf_t)+[](
cdims_t d) {
return new ComplexFArrayConverter{
d}; };
3470 gf[
"std::complex<double> ptr"] = (
cf_t)+[](
cdims_t d) {
return new ComplexDArrayConverter{
d}; };
3474 gf[
"signed char"] = gf[
"char"];
3475 gf[
"const signed char&"] = gf[
"const char&"];
3476#if __cplusplus > 201402L
3477 gf[
"std::byte"] = gf[
"uint8_t"];
3478 gf[
"const std::byte&"] = gf[
"const uint8_t&"];
3479 gf[
"std::byte&"] = gf[
"uint8_t&"];
3481 gf[
"std::int8_t"] = gf[
"int8_t"];
3482 gf[
"const std::int8_t&"] = gf[
"const int8_t&"];
3483 gf[
"std::int8_t&"] = gf[
"int8_t&"];
3484 gf[
"std::uint8_t"] = gf[
"uint8_t"];
3485 gf[
"const std::uint8_t&"] = gf[
"const uint8_t&"];
3486 gf[
"std::uint8_t&"] = gf[
"uint8_t&"];
3487 gf[
"internal_enum_type_t"] = gf[
"int"];
3488 gf[
"internal_enum_type_t&"] = gf[
"int&"];
3489 gf[
"const internal_enum_type_t&"] = gf[
"const int&"];
3490 gf[
"internal_enum_type_t ptr"] = gf[
"int ptr"];
3492 gf[
"__int64"] = gf[
"long long"];
3493 gf[
"const __int64&"] = gf[
"const long long&"];
3494 gf[
"__int64&"] = gf[
"long long&"];
3495 gf[
"__int64 ptr"] = gf[
"long long ptr"];
3496 gf[
"unsigned __int64"] = gf[
"unsigned long long"];
3497 gf[
"const unsigned __int64&"] = gf[
"const unsigned long long&"];
3498 gf[
"unsigned __int64&"] = gf[
"unsigned long long&"];
3499 gf[
"unsigned __int64 ptr"] = gf[
"unsigned long long ptr"];
3502 gf[
"const " CCOMPLEX_D "&"] = gf[
"const std::complex<double>&"];
3503 gf[
CCOMPLEX_F " ptr"] = gf[
"std::complex<float> ptr"];
3504 gf[
CCOMPLEX_D " ptr"] = gf[
"std::complex<double> ptr"];
3507 gf[
"TString"] = (
cf_t)+[](
cdims_t) {
return new TStringConverter{}; };
3508 gf[
"TString&"] = gf[
"TString"];
3509 gf[
"const TString&"] = gf[
"TString"];
3510 gf[
"nullptr_t"] = (
cf_t)+[](
cdims_t) {
static NullptrConverter
c{};
return &
c;};
3511 gf[
"const char*"] = (
cf_t)+[](
cdims_t) {
return new CStringConverter{}; };
3512 gf[
"const signed char*"] = gf[
"const char*"];
3513 gf[
"const char*&&"] = gf[
"const char*"];
3514 gf[
"const char[]"] = (
cf_t)+[](
cdims_t) {
return new CStringConverter{}; };
3515 gf[
"char*"] = (
cf_t)+[](
cdims_t d) {
return new NonConstCStringConverter{dims2stringsz(
d)}; };
3516 gf[
"char[]"] = (
cf_t)+[](
cdims_t d) {
return new NonConstCStringArrayConverter{
d,
true}; };
3517 gf[
"signed char*"] = gf[
"char*"];
3518 gf[
"wchar_t*"] = (
cf_t)+[](
cdims_t) {
return new WCStringConverter{}; };
3519 gf[
"char16_t*"] = (
cf_t)+[](
cdims_t) {
return new CString16Converter{}; };
3520 gf[
"char16_t[]"] = (
cf_t)+[](
cdims_t d) {
return new CString16Converter{dims2stringsz(
d)}; };
3521 gf[
"char32_t*"] = (
cf_t)+[](
cdims_t) {
return new CString32Converter{}; };
3522 gf[
"char32_t[]"] = (
cf_t)+[](
cdims_t d) {
return new CString32Converter{dims2stringsz(
d)}; };
3524 gf[
"char16_t**"] = gf[
"char16_t*"];
3525 gf[
"char32_t**"] = gf[
"char32_t*"];
3527 gf[
"char**"] = gf[
"const char**"];
3528 gf[
"const char*[]"] = (
cf_t)+[](
cdims_t d) {
return new CStringArrayConverter{
d,
false}; };
3529 gf[
"char*[]"] = (
cf_t)+[](
cdims_t d) {
return new NonConstCStringArrayConverter{
d,
false}; };
3530 gf[
"char ptr"] = gf[
"char*[]"];
3531 gf[
"std::string"] = (
cf_t)+[](
cdims_t) {
return new STLStringConverter{}; };
3532 gf[
"const std::string&"] = gf[
"std::string"];
3533 gf[
"string"] = gf[
"std::string"];
3534 gf[
"const string&"] = gf[
"std::string"];
3535 gf[
"std::string&&"] = (
cf_t)+[](
cdims_t) {
return new STLStringMoveConverter{}; };
3536 gf[
"string&&"] = gf[
"std::string&&"];
3537#if __cplusplus > 201402L
3538 gf[
"std::string_view"] = (
cf_t)+[](
cdims_t) {
return new STLStringViewConverter{}; };
3540 gf[
"std::string_view&"] = gf[
"std::string_view"];
3541 gf[
"const std::string_view&"] = gf[
"std::string_view"];
3542 gf[
"const " STRINGVIEW "&"] = gf[
"std::string_view"];
3544 gf[
"std::wstring"] = (
cf_t)+[](
cdims_t) {
return new STLWStringConverter{}; };
3547 gf[
"const std::wstring&"] = gf[
"std::wstring"];
3548 gf[
"const " WSTRING1 "&"] = gf[
"std::wstring"];
3549 gf[
"const " WSTRING2 "&"] = gf[
"std::wstring"];
3550 gf[
"void*&"] = (
cf_t)+[](
cdims_t) {
static VoidPtrRefConverter
c{};
return &
c; };
3551 gf[
"void**"] = (
cf_t)+[](
cdims_t d) {
return new VoidPtrPtrConverter{
d}; };
3552 gf[
"void ptr"] = gf[
"void**"];
3553 gf[
"PyObject*"] = (
cf_t)+[](
cdims_t) {
static PyObjectConverter
c{};
return &
c; };
3554 gf[
"_object*"] = gf[
"PyObject*"];
3557} initConvFactories_;
static Py_ssize_t CPyCppyy_PyUnicode_AsWideChar(PyObject *pyobj, wchar_t *w, Py_ssize_t size)
#define PyBytes_AS_STRING
#define PyBytes_AsStringAndSize
#define CPyCppyy_PyText_FromStringAndSize
#define CPyCppyy_PyUnicode_GET_SIZE
#define PY_SSIZE_T_FORMAT
static void * CPyCppyy_PyCapsule_GetPointer(PyObject *capsule, const char *)
#define CPyCppyy_PyText_AsString
#define CPyCppyy_PyText_GET_SIZE
#define CPyCppyy_PyCapsule_CheckExact
static const char * CPyCppyy_PyText_AsStringAndSize(PyObject *pystr, Py_ssize_t *size)
static PyObject * PyObject_CallMethodNoArgs(PyObject *obj, PyObject *name)
#define CPyCppyy_PyText_FromString
#define CPyCppyy_PyText_Check
static bool StrictBool(PyObject *pyobject, CPyCppyy::CallContext *ctxt)
static unsigned short CPyCppyy_PyLong_AsUShort(PyObject *pyobject)
static std::map< void *, PyObject ** > sWrapperReference
static bool CPyCppyy_PyLong_AsBool(PyObject *pyobject)
static bool IsPyCArgObject(PyObject *pyobject)
static std::array< PyTypeObject *, 24 > gCTypesTypes
static PyObject * WrapperCacheEraser(PyObject *, PyObject *pyref)
static bool CPyCppyy_PyUnicodeAsBytes2Buffer(PyObject *pyobject, T &buffer)
#define CPPYY_IMPL_STRING_AS_PRIMITIVE_CONVERTER(name, type, F1, F2)
#define CPPYY_IMPL_BASIC_CHAR_CONVERTER(name, type, low, high)
#define CPPYY_IMPL_BASIC_CONST_CHAR_REFCONVERTER(name, type, ctype, low, high)
static bool SetLifeLine(PyObject *holder, PyObject *target, intptr_t ref)
static std::array< PyTypeObject *, 24 > gCTypesPtrTypes
static PY_LONG_LONG CPyCppyy_PyLong_AsStrictLongLong(PyObject *pyobject)
static std::array< const char *, 24 > gCTypesNames
static std::map< RetSigKey_t, std::map< PyObject *, void * > > sWrapperLookup
static bool ImplicitBool(PyObject *pyobject, CPyCppyy::CallContext *ctxt)
static bool CArraySetArg(PyObject *pyobject, CPyCppyy::Parameter ¶, char tc, int size, bool check=true)
static int ExtractChar(PyObject *pyobject, const char *tname, int low, int high)
static bool HasLifeLine(PyObject *holder, intptr_t ref)
const Py_ssize_t MOVE_REFCOUNT_CUTOFF
static PyTypeObject * GetCTypesPtrType(int nidx)
static std::map< PyObject *, std::pair< void *, RetSigKey_t > > sWrapperWeakRefs
#define CPYCPPYY_WIDESTRING_CONVERTER(name, type, encode, decode, snull)
static int8_t CPyCppyy_PyLong_AsInt8(PyObject *pyobject)
#define CPPYY_IMPL_BASIC_CONVERTER_IB(name, type, stype, ctype, F1, F2, tc)
static CPyCppyy::Converter * selectInstanceCnv(Cppyy::TCppScope_t klass, const std::string &cpd, CPyCppyy::cdims_t dims, bool isConst, bool control)
static CPyCppyy::CPPInstance * GetCppInstance(PyObject *pyobject, Cppyy::TCppType_t klass=(Cppyy::TCppType_t) 0, bool accept_rvalue=false)
static PyMethodDef gWrapperCacheEraserMethodDef
#define CPPYY_IMPL_BASIC_CONST_REFCONVERTER(name, type, ctype, F1)
static uint8_t CPyCppyy_PyLong_AsUInt8(PyObject *pyobject)
static short CPyCppyy_PyLong_AsShort(PyObject *pyobject)
static long CPyCppyy_PyLong_AsStrictLong(PyObject *pyobject)
#define CPPYY_IMPL_ARRAY_CONVERTER(name, ctype, type, code, suffix)
#define CPPYY_IMPL_BASIC_CONVERTER_NB(name, type, stype, ctype, F1, F2, tc)
#define CPPYY_IMPL_REFCONVERTER(name, ctype, type, code)
#define CPPYY_IMPL_BASIC_CONVERTER_NI(name, type, stype, ctype, F1, F2, tc)
static PyTypeObject * GetCTypesType(int nidx)
static CPyCppyy::CPPInstance * ConvertImplicit(Cppyy::TCppType_t klass, PyObject *pyobject, CPyCppyy::Parameter ¶, CPyCppyy::CallContext *ctxt, bool manage=true)
static int CPyCppyy_PyLong_AsStrictInt(PyObject *pyobject)
static std::map< RetSigKey_t, std::vector< void * > > sWrapperFree
static bool IsCTypesArrayOrPointer(PyObject *pyobject)
static unsigned int sWrapperCounter
#define CPPYY_PYLONG_AS_TYPE(name, type, limit_low, limit_high)
static void * PyFunction_AsCPointer(PyObject *pyobject, const std::string &rettype, const std::string &signature)
#define CPPYY_IMPL_REFCONVERTER_FROM_MEMORY(name, ctype)
long double PY_LONG_DOUBLE
unsigned long long PY_ULONG_LONG
std::string fValueTypeName
Cppyy::TCppType_t fValueType
Cppyy::TCppType_t fSmartPtrType
Cppyy::TCppType_t fUnderlyingType
std::string::size_type fMaxSize
std::vector< Converter * > fConverters
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
winID h TVirtualViewer3D TVirtualGLPainter p
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 target
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 UChar_t len
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 type
Cppyy::TCppType_t GetSmartIsA() const
void SetSmart(PyObject *smart_type)
Cppyy::TCppType_t ObjectIsA(bool check_smart=true) const
MethodInfo_t * fMethodInfo
virtual bool SetArg(PyObject *, Parameter &, CallContext *=nullptr)=0
virtual bool ToMemory(PyObject *value, void *address, PyObject *ctxt=nullptr)
virtual PyObject * FromMemory(void *address)
virtual PyObject * FromMemory(void *address)
virtual bool SetArg(PyObject *, Parameter &, CallContext *=nullptr)
virtual bool ToMemory(PyObject *value, void *address, PyObject *ctxt=nullptr)
static bool RegisterPyObject(CPPInstance *pyobj, void *cppobj)
virtual bool GetAddressSpecialCase(PyObject *pyobject, void *&address)
virtual bool ToMemory(PyObject *value, void *address, PyObject *ctxt=nullptr)
virtual PyObject * FromMemory(void *address)
virtual bool SetArg(PyObject *, Parameter &, CallContext *=nullptr)
std::string clean_type(const std::string &cppname, bool template_strip=true, bool const_strip=true)
std::string compound(const std::string &name)
std::vector< std::string > extract_arg_types(const std::string &sig)
void ConstructCallbackPreamble(const std::string &retType, const std::vector< std::string > &argtypes, std::ostringstream &code)
void ConstructCallbackReturn(const std::string &retType, int nArgs, std::ostringstream &code)
Py_ssize_t GetBuffer(PyObject *pyobject, char tc, int size, void *&buf, bool check=true)
PyObject * FuncPtr2StdFunction(const std::string &retType, const std::string &signature, void *address)
bool IsSTLIterator(const std::string &classname)
unsigned long PyLongOrInt_AsULong(PyObject *pyobject)
Converter *(* cf_t)(cdims_t d)
PyObject * gDefaultObject
PyObject * GetScopeProxy(Cppyy::TCppScope_t)
bool TupleOfInstances_CheckExact(T *object)
PyObject * CreateScopeProxy(Cppyy::TCppScope_t, const unsigned flags=0)
bool RefFloat_CheckExact(T *object)
bool CPPExcInstance_Check(T *object)
bool NoImplicit(CallContext *ctxt)
static ConvFactories_t gConvFactories
PyObject * CreateLowLevelView(bool *, cdims_t shape)
PyObject * BindCppObjectNoCast(Cppyy::TCppObject_t object, Cppyy::TCppType_t klass, const unsigned flags=0)
bool CPPOverload_Check(T *object)
bool RefInt_CheckExact(T *object)
PyObject * CreateLowLevelViewString(char **, cdims_t shape)
bool CPPScope_Check(T *object)
CPYCPPYY_EXTERN bool RegisterConverter(const std::string &name, ConverterFactory_t)
static const dim_t UNKNOWN_SIZE
bool AllowImplicit(CallContext *ctxt)
bool UseStrictOwnership(CallContext *ctxt)
PY_ULONG_LONG PyLongOrInt_AsULong64(PyObject *pyobject)
bool CPPInstance_Check(T *object)
PyObject * BindCppObjectArray(Cppyy::TCppObject_t address, Cppyy::TCppType_t klass, cdims_t dims)
PyObject * CreatePointerView(void *ptr, cdims_t shape=0)
PyObject * gNullPtrObject
bool IsConstructor(uint64_t flags)
CPYCPPYY_EXTERN bool RegisterConverterAlias(const std::string &name, const std::string &target)
CPYCPPYY_EXTERN Converter * CreateConverter(const std::string &name, cdims_t=0)
PyObject * BindCppObject(Cppyy::TCppObject_t object, Cppyy::TCppType_t klass, const unsigned flags=0)
static std::regex s_fnptr("\\(:*\\*&*\\)")
CPYCPPYY_EXTERN void DestroyConverter(Converter *p)
bool TemplateProxy_Check(T *object)
std::map< std::string, cf_t > ConvFactories_t
CPYCPPYY_EXTERN bool UnregisterConverter(const std::string &name)
RPY_EXPORTED ptrdiff_t GetBaseOffset(TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror=false)
RPY_EXPORTED size_t SizeOf(TCppType_t klass)
RPY_EXPORTED std::vector< TCppIndex_t > GetMethodIndicesFromName(TCppScope_t scope, const std::string &name)
RPY_EXPORTED bool Compile(const std::string &code, bool silent=false)
RPY_EXPORTED void CallDestructor(TCppType_t type, TCppObject_t self)
RPY_EXPORTED bool IsSubtype(TCppType_t derived, TCppType_t base)
RPY_EXPORTED TCppMethod_t GetMethodTemplate(TCppScope_t scope, const std::string &name, const std::string &proto)
RPY_EXPORTED TCppObject_t Construct(TCppType_t type, void *arena=nullptr)
RPY_EXPORTED bool GetSmartPtrInfo(const std::string &, TCppType_t *raw, TCppMethod_t *deref)
RPY_EXPORTED std::string ResolveName(const std::string &cppitem_name)
RPY_EXPORTED TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
RPY_EXPORTED bool IsSmartPtr(TCppType_t type)
RPY_EXPORTED TCppScope_t GetScope(const std::string &scope_name)
RPY_EXPORTED TCppFuncAddr_t GetFunctionAddress(TCppMethod_t method, bool check_enabled=true)
RooArgList L(Args_t &&... args)
CPPOverload::Methods_t fMethods
static ECallFlags sMemoryPolicy
Cppyy::TCppScope_t fCurScope
void AddTemporary(PyObject *pyobj)
union CPyCppyy::Parameter::Value fValue
PyObject_HEAD char * b_ptr
union CPyCppyy_tagPyCArgObject::@205 value
PyObject_HEAD void * pffi_type
unsigned long long fULLong