Logo ROOT  
Reference Guide
CustomPyTypes.h
Go to the documentation of this file.
1#ifndef CPYCPPYY_CUSTOMPYTYPES_H
2#define CPYCPPYY_CUSTOMPYTYPES_H
3
4namespace CPyCppyy {
5
6/** Custom "builtins," detectable by type, for pass by ref and improved
7 performance.
8 */
9
10//- reference float object type and type verification ------------------------
11extern PyTypeObject RefFloat_Type;
12
13template<typename T>
14inline bool RefFloat_Check(T* object)
15{
16 return object && PyObject_TypeCheck(object, &RefFloat_Type);
17}
18
19template<typename T>
20inline bool RefFloat_CheckExact(T* object)
21{
22 return object && Py_TYPE(object) == &RefFloat_Type;
23}
24
25//- reference long object type and type verification -------------------------
26extern PyTypeObject RefInt_Type;
27
28template<typename T>
29inline bool RefInt_Check(T* object)
30{
31 return object && PyObject_TypeCheck(object, &RefInt_Type);
32}
33
34template<typename T>
35inline bool RefInt_CheckExact(T* object)
36{
37 return object && Py_TYPE(object) == &RefInt_Type;
38}
39
40//- custom type representing typedef to pointer of class ---------------------
42 PyObject_HEAD
44};
45
46extern PyTypeObject TypedefPointerToClass_Type;
47
48template<typename T>
49inline bool TypedefPointerToClass_Check(T* object)
50{
51 return object && PyObject_TypeCheck(object, &TypedefPointerToClass_Type);
52}
53
54template<typename T>
56{
57 return object && Py_TYPE(object) == &TypedefPointerToClass_Type;
58}
59
60//- custom instance method object type and type verification -----------------
61extern PyTypeObject CustomInstanceMethod_Type;
62
63template<typename T>
64inline bool CustomInstanceMethod_Check(T* object)
65{
66 return object && PyObject_TypeCheck(object, &CustomInstanceMethod_Type);
67}
68
69template<typename T>
71{
72 return object && Py_TYPE(object) == &CustomInstanceMethod_Type;
73}
74
76
77//- custom iterator for high performance std::vector iteration ---------------
79 PyObject_HEAD
83};
84
85extern PyTypeObject IndexIter_Type;
86
87class Converter;
89 void* vi_data;
94};
95
96extern PyTypeObject VectorIter_Type;
97
98} // namespace CPyCppyy
99
100#endif // !CPYCPPYY_CUSTOMPYTYPES_H
#define Py_TYPE(ob)
Definition: CPyCppyy.h:217
int Py_ssize_t
Definition: CPyCppyy.h:236
_object PyObject
Definition: PyMethodBase.h:42
Set of helper functions that are invoked from the pythonizors, on the Python side.
PyObject * CustomInstanceMethod_New(PyObject *func, PyObject *self, PyObject *pyclass)
PyTypeObject VectorIter_Type
bool RefFloat_Check(T *object)
Definition: CustomPyTypes.h:14
PyTypeObject CustomInstanceMethod_Type
bool RefFloat_CheckExact(T *object)
Definition: CustomPyTypes.h:20
PyTypeObject RefFloat_Type
Custom "builtins," detectable by type, for pass by ref and improved performance.
PyTypeObject TypedefPointerToClass_Type
bool RefInt_CheckExact(T *object)
Definition: CustomPyTypes.h:35
bool CustomInstanceMethod_CheckExact(T *object)
Definition: CustomPyTypes.h:70
bool RefInt_Check(T *object)
Definition: CustomPyTypes.h:29
bool TypedefPointerToClass_CheckExact(T *object)
Definition: CustomPyTypes.h:55
PyTypeObject IndexIter_Type
bool TypedefPointerToClass_Check(T *object)
Definition: CustomPyTypes.h:49
PyTypeObject RefInt_Type
bool CustomInstanceMethod_Check(T *object)
Definition: CustomPyTypes.h:64
TCppScope_t TCppType_t
Definition: cpp_cppyy.h:19
double T(double x)
Definition: ChebyshevPol.h:34
PyObject_HEAD PyObject * ii_container
Definition: CustomPyTypes.h:80
PyObject_HEAD Cppyy::TCppType_t fType
Definition: CustomPyTypes.h:43
Cppyy::TCppType_t vi_klass
Definition: CustomPyTypes.h:92
CPyCppyy::Converter * vi_converter
Definition: CustomPyTypes.h:91