Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Converters.cxx File Reference
#include "CPyCppyy.h"
#include "DeclareConverters.h"
#include "CallContext.h"
#include "CPPExcInstance.h"
#include "CPPInstance.h"
#include "CPPOverload.h"
#include "CustomPyTypes.h"
#include "LowLevelViews.h"
#include "MemoryRegulator.h"
#include "ProxyWrappers.h"
#include "PyStrings.h"
#include "TemplateProxy.h"
#include "TupleOfInstances.h"
#include "TypeManip.h"
#include "Utility.h"
#include <complex>
#include <limits.h>
#include <stddef.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <locale>
#include <regex>
#include <utility>
#include <sstream>
#include <codecvt>
Include dependency graph for Converters.cxx:

Classes

struct  CPyCppyy_tagCDataObject
 
struct  CPyCppyy_tagPyCArgObject
 

Namespaces

namespace  CPyCppyy
 

Macros

#define CCOMPLEX_D   "_Complex double"
 
#define CCOMPLEX_F   "_Complex float"
 
#define CPPYY_IMPL_ARRAY_CONVERTER(name, ctype, type, code, suffix)
 
#define CPPYY_IMPL_BASIC_CHAR_CONVERTER(name, type, low, high)
 
#define CPPYY_IMPL_BASIC_CONST_CHAR_REFCONVERTER(name, type, ctype, low, high)
 
#define CPPYY_IMPL_BASIC_CONST_REFCONVERTER(name, type, ctype, F1)
 
#define CPPYY_IMPL_BASIC_CONVERTER_BODY(name, type, stype, ctype, F1, F2, tc)
 
#define CPPYY_IMPL_BASIC_CONVERTER_IB(name, type, stype, ctype, F1, F2, tc)
 
#define CPPYY_IMPL_BASIC_CONVERTER_METHODS(name, type, stype, ctype, F1, F2)
 
#define CPPYY_IMPL_BASIC_CONVERTER_NB(name, type, stype, ctype, F1, F2, tc)
 
#define CPPYY_IMPL_BASIC_CONVERTER_NI(name, type, stype, ctype, F1, F2, tc)
 
#define CPPYY_IMPL_REFCONVERTER(name, ctype, type, code)
 
#define CPPYY_IMPL_REFCONVERTER_FROM_MEMORY(name, ctype)
 
#define CPPYY_IMPL_STRING_AS_PRIMITIVE_CONVERTER(name, type, F1, F2)
 
#define CPPYY_PYLONG_AS_TYPE(name, type, limit_low, limit_high)
 
#define CPYCPPYY_WIDESTRING_CONVERTER(name, type, encode, decode, snull)
 
#define ct_c_bool   0
 
#define ct_c_byte   3
 
#define ct_c_char   1
 
#define ct_c_char_p   18
 
#define ct_c_complex   22
 
#define ct_c_double   16
 
#define ct_c_fcomplex   21
 
#define ct_c_float   15
 
#define ct_c_int   8
 
#define ct_c_int8   3
 
#define ct_c_long   11
 
#define ct_c_longdouble   17
 
#define ct_c_longlong   13
 
#define ct_c_pointer   23
 
#define ct_c_shar   1
 
#define ct_c_short   5
 
#define ct_c_ubyte   4
 
#define ct_c_uchar   4
 
#define ct_c_uint   9
 
#define ct_c_uint16   7
 
#define ct_c_uint32   10
 
#define ct_c_uint8   4
 
#define ct_c_ulong   12
 
#define ct_c_ulonglong   14
 
#define ct_c_ushort   6
 
#define ct_c_void_p   20
 
#define ct_c_wchar   2
 
#define ct_c_wchar_p   19
 
#define HAS_CODECVT   1
 
#define NO_KNOWN_INITIALIZER_LIST   1
 
#define NTYPES   24
 
#define STRINGVIEW   "basic_string_view<char,char_traits<char> >"
 
#define WSTRING1   "std::basic_string<wchar_t>"
 
#define WSTRING2   "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>"
 

Typedefs

typedef std::map< std::string, cf_tCPyCppyy::ConvFactories_t
 
typedef std::string RetSigKey_t
 

Functions

static bool CArraySetArg (PyObject *pyobject, CPyCppyy::Parameter &para, char tc, int size, bool check=true)
 
static CPyCppyy::CPPInstanceConvertImplicit (Cppyy::TCppType_t klass, PyObject *pyobject, CPyCppyy::Parameter &para, CPyCppyy::CallContext *ctxt, bool manage=true)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (Bool, c_bool)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (Char, c_char)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (Char16, c_uint16)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (Char32, c_uint32)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (Float, c_float)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (Int8, c_int8)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (LDouble, c_longdouble)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (LLong, c_longlong)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (SChar, c_byte)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (Short, c_short)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (UChar, c_ubyte)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (UInt, c_uint)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (UInt8, c_uint8)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (ULLong, c_ulonglong)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (ULong, c_ulong)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (UShort, c_ushort)
 
 CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (WChar, c_wchar)
 
static bool CPyCppyy_PyLong_AsBool (PyObject *pyobject)
 
static int8_t CPyCppyy_PyLong_AsInt8 (PyObject *pyobject)
 
static short CPyCppyy_PyLong_AsShort (PyObject *pyobject)
 
static int CPyCppyy_PyLong_AsStrictInt (PyObject *pyobject)
 
static long CPyCppyy_PyLong_AsStrictLong (PyObject *pyobject)
 
static PY_LONG_LONG CPyCppyy_PyLong_AsStrictLongLong (PyObject *pyobject)
 
static uint8_t CPyCppyy_PyLong_AsUInt8 (PyObject *pyobject)
 
static unsigned short CPyCppyy_PyLong_AsUShort (PyObject *pyobject)
 
template<typename T >
static bool CPyCppyy_PyUnicodeAsBytes2Buffer (PyObject *pyobject, T &buffer)
 
static int ExtractChar (PyObject *pyobject, const char *tname, int low, int high)
 
 free (fBuffer)
 
static CPyCppyy::CPPInstanceGetCppInstance (PyObject *pyobject, Cppyy::TCppType_t klass=(Cppyy::TCppType_t) 0, bool accept_rvalue=false)
 
static PyTypeObject * GetCTypesPtrType (int nidx)
 
static PyTypeObject * GetCTypesType (int nidx)
 
static bool HasLifeLine (PyObject *holder, intptr_t ref)
 
static bool ImplicitBool (PyObject *pyobject, CPyCppyy::CallContext *ctxt)
 
static bool IsCTypesArrayOrPointer (PyObject *pyobject)
 
static bool IsPyCArgObject (PyObject *pyobject)
 
static void * PyFunction_AsCPointer (PyObject *pyobject, const std::string &rettype, const std::string &signature)
 
static std::regex CPyCppyy::s_fnptr ("\\‍(:*\\*&*\\‍)")
 
static CPyCppyy::ConverterselectInstanceCnv (Cppyy::TCppScope_t klass, const std::string &cpd, CPyCppyy::cdims_t dims, bool isConst, bool control)
 
static bool SetLifeLine (PyObject *holder, PyObject *target, intptr_t ref)
 
static bool StrictBool (PyObject *pyobject, CPyCppyy::CallContext *ctxt)
 
static PyObjectWrapperCacheEraser (PyObject *, PyObject *pyref)
 

Variables

 fBuffer = nullptr
 
static ConvFactories_t CPyCppyy::gConvFactories
 
static std::array< const char *, 24 > gCTypesNames
 
static std::array< PyTypeObject *, 24 > gCTypesPtrTypes
 
static std::array< PyTypeObject *, 24 > gCTypesTypes
 
PyObjectCPyCppyy::gDefaultObject = nullptr
 
PyObjectCPyCppyy::gNullPtrObject = nullptr
 
static PyMethodDef gWrapperCacheEraserMethodDef
 
const Py_ssize_t MOVE_REFCOUNT_CUTOFF = 1
 
static unsigned int sWrapperCounter = 0
 
static std::map< RetSigKey_t, std::vector< void * > > sWrapperFree
 
static std::map< RetSigKey_t, std::map< PyObject *, void * > > sWrapperLookup
 
static std::map< void *, PyObject ** > sWrapperReference
 
static std::map< PyObject *, std::pair< void *, RetSigKey_t > > sWrapperWeakRefs
 

Macro Definition Documentation

◆ CCOMPLEX_D

#define CCOMPLEX_D   "_Complex double"

Definition at line 3369 of file Converters.cxx.

◆ CCOMPLEX_F

#define CCOMPLEX_F   "_Complex float"

Definition at line 3370 of file Converters.cxx.

◆ CPPYY_IMPL_ARRAY_CONVERTER

#define CPPYY_IMPL_ARRAY_CONVERTER (   name,
  ctype,
  type,
  code,
  suffix 
)

Definition at line 1613 of file Converters.cxx.

◆ CPPYY_IMPL_BASIC_CHAR_CONVERTER

#define CPPYY_IMPL_BASIC_CHAR_CONVERTER (   name,
  type,
  low,
  high 
)

Definition at line 655 of file Converters.cxx.

◆ CPPYY_IMPL_BASIC_CONST_CHAR_REFCONVERTER

#define CPPYY_IMPL_BASIC_CONST_CHAR_REFCONVERTER (   name,
  type,
  ctype,
  low,
  high 
)
Value:
bool CPyCppyy::Const##name##RefConverter::SetArg( \
PyObject* pyobject, Parameter& para, CallContext* /* ctxt */) \
{ \
/* convert <pyobject> to C++ <<type>>, set arg for call, allow int -> char */\
type val = (type)ExtractChar(pyobject, #type, low, high); \
if (val == (type)-1 && PyErr_Occurred()) \
return false; \
para.fValue.fLong = val; \
para.fTypeCode = 'l'; \
return true; \
} \
CPPYY_IMPL_REFCONVERTER_FROM_MEMORY(Const##name, ctype)
static int ExtractChar(PyObject *pyobject, const char *tname, int low, int high)
_object PyObject
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
char name[80]
Definition TGX11.cxx:110

Definition at line 639 of file Converters.cxx.

◆ CPPYY_IMPL_BASIC_CONST_REFCONVERTER

#define CPPYY_IMPL_BASIC_CONST_REFCONVERTER (   name,
  type,
  ctype,
  F1 
)
Value:
bool CPyCppyy::Const##name##RefConverter::SetArg( \
PyObject* pyobject, Parameter& para, CallContext* /* ctxt */) \
{ \
type val = (type)F1(pyobject); \
if (val == (type)-1 && PyErr_Occurred()) { \
if (pyobject == CPyCppyy::gDefaultObject) { \
PyErr_Clear(); \
val = (type)0; \
} else \
return false; \
} \
para.fValue.f##name = val; \
para.fRef = &para.fValue.f##name; \
para.fTypeCode = 'r'; \
return true; \
} \
CPPYY_IMPL_REFCONVERTER_FROM_MEMORY(Const##name, ctype)
#define F1(x, y, z)
Definition TMD5.cxx:267
PyObject * gDefaultObject

Definition at line 619 of file Converters.cxx.

◆ CPPYY_IMPL_BASIC_CONVERTER_BODY

#define CPPYY_IMPL_BASIC_CONVERTER_BODY (   name,
  type,
  stype,
  ctype,
  F1,
  F2,
  tc 
)
Value:
/* convert <pyobject> to C++ 'type', set arg for call */ \
type val = (type)F2(pyobject); \
if (val == (type)-1 && PyErr_Occurred()) { \
static PyTypeObject* ctypes_type = nullptr; \
if (!ctypes_type) { \
PyObject* pytype = 0, *pyvalue = 0, *pytrace = 0; \
PyErr_Fetch(&pytype, &pyvalue, &pytrace); \
ctypes_type = GetCTypesType(ct_##ctype); \
PyErr_Restore(pytype, pyvalue, pytrace); \
} \
if (Py_TYPE(pyobject) == ctypes_type) { \
PyErr_Clear(); \
val = *((type*)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr); \
} else if (pyobject == CPyCppyy::gDefaultObject) { \
PyErr_Clear(); \
val = (type)0; \
} else \
return false; \
} \
para.fValue.f##name = val; \
para.fTypeCode = tc; \
return true;
#define Py_TYPE(ob)
Definition CPyCppyy.h:196
static PyTypeObject * GetCTypesType(int nidx)
#define F2(x, y, z)
Definition TMD5.cxx:268

Definition at line 494 of file Converters.cxx.

◆ CPPYY_IMPL_BASIC_CONVERTER_IB

#define CPPYY_IMPL_BASIC_CONVERTER_IB (   name,
  type,
  stype,
  ctype,
  F1,
  F2,
  tc 
)
Value:
bool CPyCppyy::name##Converter::SetArg( \
PyObject* pyobject, Parameter& para, CallContext* ctxt) \
{ \
if (!ImplicitBool(pyobject, ctxt)) \
return false; \
CPPYY_IMPL_BASIC_CONVERTER_BODY(name, type, stype, ctype, F1, F2, tc) \
} \
CPPYY_IMPL_BASIC_CONVERTER_METHODS(name, type, stype, ctype, F1, F2)
static bool ImplicitBool(PyObject *pyobject, CPyCppyy::CallContext *ctxt)
virtual bool SetArg(PyObject *, Parameter &, CallContext *=nullptr)=0

Definition at line 549 of file Converters.cxx.

◆ CPPYY_IMPL_BASIC_CONVERTER_METHODS

#define CPPYY_IMPL_BASIC_CONVERTER_METHODS (   name,
  type,
  stype,
  ctype,
  F1,
  F2 
)
Value:
PyObject* CPyCppyy::name##Converter::FromMemory(void* address) \
{ \
return F1((stype)*((type*)address)); \
} \
\
bool CPyCppyy::name##Converter::ToMemory( \
PyObject* value, void* address, PyObject* /* ctxt */) \
{ \
type s = (type)F2(value); \
if (s == (type)-1 && PyErr_Occurred()) { \
PyErr_Clear(); \
s = (type)0; \
} else \
return false; \
} \
*((type*)address) = (type)s; \
return true; \
}
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
virtual bool ToMemory(PyObject *value, void *address, PyObject *ctxt=nullptr)
virtual PyObject * FromMemory(void *address)

Definition at line 518 of file Converters.cxx.

◆ CPPYY_IMPL_BASIC_CONVERTER_NB

#define CPPYY_IMPL_BASIC_CONVERTER_NB (   name,
  type,
  stype,
  ctype,
  F1,
  F2,
  tc 
)
Value:
bool CPyCppyy::name##Converter::SetArg( \
PyObject* pyobject, Parameter& para, CallContext* /*ctxt*/) \
{ \
if (PyBool_Check(pyobject)) \
return false; \
CPPYY_IMPL_BASIC_CONVERTER_BODY(name, type, stype, ctype, F1, F2, tc) \
} \
CPPYY_IMPL_BASIC_CONVERTER_METHODS(name, type, stype, ctype, F1, F2)

Definition at line 559 of file Converters.cxx.

◆ CPPYY_IMPL_BASIC_CONVERTER_NI

#define CPPYY_IMPL_BASIC_CONVERTER_NI (   name,
  type,
  stype,
  ctype,
  F1,
  F2,
  tc 
)
Value:
bool CPyCppyy::name##Converter::SetArg( \
PyObject* pyobject, Parameter& para, CallContext* ctxt) \
{ \
if (!StrictBool(pyobject, ctxt)) \
return false; \
CPPYY_IMPL_BASIC_CONVERTER_BODY(name, type, stype, ctype, F1, F2, tc) \
} \
CPPYY_IMPL_BASIC_CONVERTER_METHODS(name, type, stype, ctype, F1, F2)
static bool StrictBool(PyObject *pyobject, CPyCppyy::CallContext *ctxt)

Definition at line 539 of file Converters.cxx.

◆ CPPYY_IMPL_REFCONVERTER

#define CPPYY_IMPL_REFCONVERTER (   name,
  ctype,
  type,
  code 
)
Value:
bool CPyCppyy::name##RefConverter::SetArg( \
PyObject* pyobject, Parameter& para, CallContext* /* ctxt */) \
{ \
/* convert a reference to int to Python through ctypes pointer object */ \
if (Py_TYPE(pyobject) == GetCTypesType(ct_##ctype)) { \
para.fValue.fVoidp = (void*)((CPyCppyy_tagCDataObject*)pyobject)->b_ptr;\
para.fTypeCode = 'V'; \
return true; \
} \
bool res = CArraySetArg(pyobject, para, code, sizeof(type)); \
if (!res) { \
PyErr_SetString(PyExc_TypeError, "use ctypes."#ctype" for pass-by-ref of "#type);\
return false; \
} \
para.fTypeCode = 'V'; \
return res; \
} \
CPPYY_IMPL_REFCONVERTER_FROM_MEMORY(name, ctype)
static bool CArraySetArg(PyObject *pyobject, CPyCppyy::Parameter &para, char tc, int size, bool check=true)

Definition at line 794 of file Converters.cxx.

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY

#define CPPYY_IMPL_REFCONVERTER_FROM_MEMORY (   name,
  ctype 
)
Value:
PyObject* CPyCppyy::name##RefConverter::FromMemory(void* ptr) \
{ \
/* convert a reference to int to Python through ctypes pointer object */ \
PyTypeObject* ctypes_type = GetCTypesType(ct_##ctype); \
if (!ctypes_type) { \
PyErr_SetString(PyExc_RuntimeError, "no ctypes available"); \
return nullptr; \
} \
PyObject* ref = ctypes_type->tp_new(ctypes_type, nullptr, nullptr); \
((CPyCppyy_tagCDataObject*)ref)->b_ptr = (char*)ptr; \
((CPyCppyy_tagCDataObject*)ref)->b_needsfree = 0; \
return ref; \
}

Definition at line 603 of file Converters.cxx.

◆ CPPYY_IMPL_STRING_AS_PRIMITIVE_CONVERTER

#define CPPYY_IMPL_STRING_AS_PRIMITIVE_CONVERTER (   name,
  type,
  F1,
  F2 
)

Definition at line 1853 of file Converters.cxx.

◆ CPPYY_PYLONG_AS_TYPE

#define CPPYY_PYLONG_AS_TYPE (   name,
  type,
  limit_low,
  limit_high 
)
Value:
static inline type CPyCppyy_PyLong_As##name(PyObject* pyobject) \
{ \
if (!(PyLong_Check(pyobject) || PyInt_Check(pyobject))) { \
if (pyobject == CPyCppyy::gDefaultObject) \
return (type)0; \
PyErr_SetString(PyExc_TypeError, #type" conversion expects an integer object");\
return (type)-1; \
} \
long l = PyLong_AsLong(pyobject); \
if (l < limit_low || limit_high < l) { \
PyErr_Format(PyExc_ValueError, "integer %ld out of range for "#type, l);\
return (type)-1; \
} \
return (type)l; \
}
TLine l
Definition textangle.C:4

Definition at line 333 of file Converters.cxx.

◆ CPYCPPYY_WIDESTRING_CONVERTER

#define CPYCPPYY_WIDESTRING_CONVERTER (   name,
  type,
  encode,
  decode,
  snull 
)

Definition at line 1367 of file Converters.cxx.

◆ ct_c_bool

#define ct_c_bool   0

Definition at line 98 of file Converters.cxx.

◆ ct_c_byte

#define ct_c_byte   3

Definition at line 102 of file Converters.cxx.

◆ ct_c_char

#define ct_c_char   1

Definition at line 99 of file Converters.cxx.

◆ ct_c_char_p

#define ct_c_char_p   18

Definition at line 120 of file Converters.cxx.

◆ ct_c_complex

#define ct_c_complex   22

Definition at line 124 of file Converters.cxx.

◆ ct_c_double

#define ct_c_double   16

Definition at line 118 of file Converters.cxx.

◆ ct_c_fcomplex

#define ct_c_fcomplex   21

Definition at line 123 of file Converters.cxx.

◆ ct_c_float

#define ct_c_float   15

Definition at line 117 of file Converters.cxx.

◆ ct_c_int

#define ct_c_int   8

Definition at line 110 of file Converters.cxx.

◆ ct_c_int8

#define ct_c_int8   3

Definition at line 103 of file Converters.cxx.

◆ ct_c_long

#define ct_c_long   11

Definition at line 113 of file Converters.cxx.

◆ ct_c_longdouble

#define ct_c_longdouble   17

Definition at line 119 of file Converters.cxx.

◆ ct_c_longlong

#define ct_c_longlong   13

Definition at line 115 of file Converters.cxx.

◆ ct_c_pointer

#define ct_c_pointer   23

Definition at line 125 of file Converters.cxx.

◆ ct_c_shar

#define ct_c_shar   1

Definition at line 100 of file Converters.cxx.

◆ ct_c_short

#define ct_c_short   5

Definition at line 107 of file Converters.cxx.

◆ ct_c_ubyte

#define ct_c_ubyte   4

Definition at line 104 of file Converters.cxx.

◆ ct_c_uchar

#define ct_c_uchar   4

Definition at line 105 of file Converters.cxx.

◆ ct_c_uint

#define ct_c_uint   9

Definition at line 111 of file Converters.cxx.

◆ ct_c_uint16

#define ct_c_uint16   7

Definition at line 109 of file Converters.cxx.

◆ ct_c_uint32

#define ct_c_uint32   10

Definition at line 112 of file Converters.cxx.

◆ ct_c_uint8

#define ct_c_uint8   4

Definition at line 106 of file Converters.cxx.

◆ ct_c_ulong

#define ct_c_ulong   12

Definition at line 114 of file Converters.cxx.

◆ ct_c_ulonglong

#define ct_c_ulonglong   14

Definition at line 116 of file Converters.cxx.

◆ ct_c_ushort

#define ct_c_ushort   6

Definition at line 108 of file Converters.cxx.

◆ ct_c_void_p

#define ct_c_void_p   20

Definition at line 122 of file Converters.cxx.

◆ ct_c_wchar

#define ct_c_wchar   2

Definition at line 101 of file Converters.cxx.

◆ ct_c_wchar_p

#define ct_c_wchar_p   19

Definition at line 121 of file Converters.cxx.

◆ HAS_CODECVT

#define HAS_CODECVT   1

Definition at line 44 of file Converters.cxx.

◆ NO_KNOWN_INITIALIZER_LIST

#define NO_KNOWN_INITIALIZER_LIST   1

Definition at line 2936 of file Converters.cxx.

◆ NTYPES

#define NTYPES   24

Definition at line 126 of file Converters.cxx.

◆ STRINGVIEW

#define STRINGVIEW   "basic_string_view<char,char_traits<char> >"

Definition at line 3363 of file Converters.cxx.

◆ WSTRING1

#define WSTRING1   "std::basic_string<wchar_t>"

Definition at line 3364 of file Converters.cxx.

◆ WSTRING2

#define WSTRING2   "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>>"

Definition at line 3365 of file Converters.cxx.

Typedef Documentation

◆ RetSigKey_t

typedef std::string RetSigKey_t

Definition at line 2549 of file Converters.cxx.

Function Documentation

◆ CArraySetArg()

static bool CArraySetArg ( PyObject pyobject,
CPyCppyy::Parameter para,
char  tc,
int  size,
bool  check = true 
)
inlinestatic

Definition at line 388 of file Converters.cxx.

◆ ConvertImplicit()

static CPyCppyy::CPPInstance * ConvertImplicit ( Cppyy::TCppType_t  klass,
PyObject pyobject,
CPyCppyy::Parameter para,
CPyCppyy::CallContext ctxt,
bool  manage = true 
)
inlinestatic

Definition at line 413 of file Converters.cxx.

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [1/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( Bool  ,
c_bool   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [2/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( Char  ,
c_char   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [3/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( Char16  ,
c_uint16   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [4/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( Char32  ,
c_uint32   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [5/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( Float  ,
c_float   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [6/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( Int8  ,
c_int8   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [7/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( LDouble  ,
c_longdouble   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [8/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( LLong  ,
c_longlong   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [9/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( SChar  ,
c_byte   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [10/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( Short  ,
c_short   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [11/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( UChar  ,
c_ubyte   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [12/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( UInt  ,
c_uint   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [13/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( UInt8  ,
c_uint8   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [14/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( ULLong  ,
c_ulonglong   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [15/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( ULong  ,
c_ulong   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [16/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( UShort  ,
c_ushort   
)

◆ CPPYY_IMPL_REFCONVERTER_FROM_MEMORY() [17/17]

CPPYY_IMPL_REFCONVERTER_FROM_MEMORY ( WChar  ,
c_wchar   
)

◆ CPyCppyy_PyLong_AsBool()

static bool CPyCppyy_PyLong_AsBool ( PyObject pyobject)
inlinestatic

Definition at line 319 of file Converters.cxx.

◆ CPyCppyy_PyLong_AsInt8()

static int8_t CPyCppyy_PyLong_AsInt8 ( PyObject pyobject)
inlinestatic

Definition at line 351 of file Converters.cxx.

◆ CPyCppyy_PyLong_AsShort()

static short CPyCppyy_PyLong_AsShort ( PyObject pyobject)
inlinestatic

Definition at line 353 of file Converters.cxx.

◆ CPyCppyy_PyLong_AsStrictInt()

static int CPyCppyy_PyLong_AsStrictInt ( PyObject pyobject)
inlinestatic

Definition at line 354 of file Converters.cxx.

◆ CPyCppyy_PyLong_AsStrictLong()

static long CPyCppyy_PyLong_AsStrictLong ( PyObject pyobject)
inlinestatic

Definition at line 356 of file Converters.cxx.

◆ CPyCppyy_PyLong_AsStrictLongLong()

static PY_LONG_LONG CPyCppyy_PyLong_AsStrictLongLong ( PyObject pyobject)
inlinestatic

Definition at line 371 of file Converters.cxx.

◆ CPyCppyy_PyLong_AsUInt8()

static uint8_t CPyCppyy_PyLong_AsUInt8 ( PyObject pyobject)
inlinestatic

Definition at line 350 of file Converters.cxx.

◆ CPyCppyy_PyLong_AsUShort()

static unsigned short CPyCppyy_PyLong_AsUShort ( PyObject pyobject)
inlinestatic

Definition at line 352 of file Converters.cxx.

◆ CPyCppyy_PyUnicodeAsBytes2Buffer()

template<typename T >
static bool CPyCppyy_PyUnicodeAsBytes2Buffer ( PyObject pyobject,
T &  buffer 
)
inlinestatic

Definition at line 1827 of file Converters.cxx.

◆ ExtractChar()

static int ExtractChar ( PyObject pyobject,
const char *  tname,
int  low,
int  high 
)
inlinestatic

Definition at line 570 of file Converters.cxx.

◆ free()

free ( fBuffer  )

◆ GetCppInstance()

static CPyCppyy::CPPInstance * GetCppInstance ( PyObject pyobject,
Cppyy::TCppType_t  klass = (Cppyy::TCppType_t)0,
bool  accept_rvalue = false 
)
inlinestatic

Definition at line 259 of file Converters.cxx.

◆ GetCTypesPtrType()

static PyTypeObject * GetCTypesPtrType ( int  nidx)
static

Definition at line 159 of file Converters.cxx.

◆ GetCTypesType()

static PyTypeObject * GetCTypesType ( int  nidx)
static

Definition at line 140 of file Converters.cxx.

◆ HasLifeLine()

static bool HasLifeLine ( PyObject holder,
intptr_t  ref 
)
static

Definition at line 239 of file Converters.cxx.

◆ ImplicitBool()

static bool ImplicitBool ( PyObject pyobject,
CPyCppyy::CallContext ctxt 
)
inlinestatic

Definition at line 299 of file Converters.cxx.

◆ IsCTypesArrayOrPointer()

static bool IsCTypesArrayOrPointer ( PyObject pyobject)
static

Definition at line 206 of file Converters.cxx.

◆ IsPyCArgObject()

static bool IsPyCArgObject ( PyObject pyobject)
static

Definition at line 186 of file Converters.cxx.

◆ PyFunction_AsCPointer()

static void * PyFunction_AsCPointer ( PyObject pyobject,
const std::string &  rettype,
const std::string &  signature 
)
static

Definition at line 2582 of file Converters.cxx.

◆ selectInstanceCnv()

static CPyCppyy::Converter * selectInstanceCnv ( Cppyy::TCppScope_t  klass,
const std::string &  cpd,
CPyCppyy::cdims_t  dims,
bool  isConst,
bool  control 
)
inlinestatic

Definition at line 3097 of file Converters.cxx.

◆ SetLifeLine()

static bool SetLifeLine ( PyObject holder,
PyObject target,
intptr_t  ref 
)
inlinestatic

Definition at line 225 of file Converters.cxx.

◆ StrictBool()

static bool StrictBool ( PyObject pyobject,
CPyCppyy::CallContext ctxt 
)
inlinestatic

Definition at line 309 of file Converters.cxx.

◆ WrapperCacheEraser()

static PyObject * WrapperCacheEraser ( PyObject ,
PyObject pyref 
)
static

Definition at line 2555 of file Converters.cxx.

Variable Documentation

◆ fBuffer

fBuffer = nullptr

Definition at line 2972 of file Converters.cxx.

◆ gCTypesNames

std::array<const char*, 24 > gCTypesNames
static
Initial value:
= {
"c_bool", "c_char", "c_wchar", "c_byte", "c_ubyte", "c_short", "c_ushort", "c_uint16",
"c_int", "c_uint", "c_uint32", "c_long", "c_ulong", "c_longlong", "c_ulonglong",
"c_float", "c_double", "c_longdouble",
"c_char_p", "c_wchar_p", "c_void_p", "c_fcomplex", "c_complex", "_Pointer" }

Definition at line 128 of file Converters.cxx.

◆ gCTypesPtrTypes

std::array<PyTypeObject*, 24 > gCTypesPtrTypes
static

Definition at line 134 of file Converters.cxx.

◆ gCTypesTypes

std::array<PyTypeObject*, 24 > gCTypesTypes
static

Definition at line 133 of file Converters.cxx.

◆ gWrapperCacheEraserMethodDef

PyMethodDef gWrapperCacheEraserMethodDef
static
Initial value:
= {
const_cast<char*>("internal_WrapperCacheEraser"),
(PyCFunction)WrapperCacheEraser,
METH_O, nullptr
}
static PyObject * WrapperCacheEraser(PyObject *, PyObject *pyref)

Definition at line 2576 of file Converters.cxx.

◆ MOVE_REFCOUNT_CUTOFF

const Py_ssize_t MOVE_REFCOUNT_CUTOFF = 1

Definition at line 65 of file Converters.cxx.

◆ sWrapperCounter

unsigned int sWrapperCounter = 0
static

Definition at line 2547 of file Converters.cxx.

◆ sWrapperFree

std::map<RetSigKey_t, std::vector<void*> > sWrapperFree
static

Definition at line 2550 of file Converters.cxx.

◆ sWrapperLookup

std::map<RetSigKey_t, std::map<PyObject*, void*> > sWrapperLookup
static

Definition at line 2551 of file Converters.cxx.

◆ sWrapperReference

std::map<void*, PyObject**> sWrapperReference
static

Definition at line 2553 of file Converters.cxx.

◆ sWrapperWeakRefs

std::map<PyObject*, std::pair<void*, RetSigKey_t> > sWrapperWeakRefs
static

Definition at line 2552 of file Converters.cxx.