Logo ROOT  
Reference Guide
CustomPyTypes.h
Go to the documentation of this file.
1 #ifndef CPYCPPYY_CUSTOMPYTYPES_H
2 #define CPYCPPYY_CUSTOMPYTYPES_H
3 
4 namespace 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 ------------------------
11 extern PyTypeObject RefFloat_Type;
12 
13 template<typename T>
14 inline bool RefFloat_Check(T* object)
15 {
16  return object && PyObject_TypeCheck(object, &RefFloat_Type);
17 }
18 
19 template<typename T>
20 inline bool RefFloat_CheckExact(T* object)
21 {
22  return object && Py_TYPE(object) == &RefFloat_Type;
23 }
24 
25 //- reference long object type and type verification -------------------------
26 extern PyTypeObject RefInt_Type;
27 
28 template<typename T>
29 inline bool RefInt_Check(T* object)
30 {
31  return object && PyObject_TypeCheck(object, &RefInt_Type);
32 }
33 
34 template<typename T>
35 inline 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 
46 extern PyTypeObject TypedefPointerToClass_Type;
47 
48 template<typename T>
49 inline bool TypedefPointerToClass_Check(T* object)
50 {
51  return object && PyObject_TypeCheck(object, &TypedefPointerToClass_Type);
52 }
53 
54 template<typename T>
55 inline bool TypedefPointerToClass_CheckExact(T* object)
56 {
57  return object && Py_TYPE(object) == &TypedefPointerToClass_Type;
58 }
59 
60 //- custom instance method object type and type verification -----------------
61 extern PyTypeObject CustomInstanceMethod_Type;
62 
63 template<typename T>
64 inline bool CustomInstanceMethod_Check(T* object)
65 {
66  return object && PyObject_TypeCheck(object, &CustomInstanceMethod_Type);
67 }
68 
69 template<typename T>
70 inline bool CustomInstanceMethod_CheckExact(T* object)
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 
85 extern PyTypeObject IndexIter_Type;
86 
87 class Converter;
89  void* vi_data;
93  int vi_flags;
94 };
95 
96 extern PyTypeObject VectorIter_Type;
97 
98 } // namespace CPyCppyy
99 
100 #endif // !CPYCPPYY_CUSTOMPYTYPES_H
PyTypeObject IndexIter_Type
TCppScope_t TCppType_t
Definition: cpp_cppyy.h:19
CPyCppyy::Converter * vi_converter
Definition: CustomPyTypes.h:91
Cppyy::TCppType_t vi_klass
Definition: CustomPyTypes.h:92
bool RefInt_Check(T *object)
Definition: CustomPyTypes.h:29
bool RefInt_CheckExact(T *object)
Definition: CustomPyTypes.h:35
double T(double x)
Definition: ChebyshevPol.h:34
PyTypeObject VectorIter_Type
PyObject * CustomInstanceMethod_New(PyObject *func, PyObject *self, PyObject *pyclass)
PyTypeObject TypedefPointerToClass_Type
bool TypedefPointerToClass_Check(T *object)
Definition: CustomPyTypes.h:49
#define Py_TYPE(ob)
Definition: CPyCppyy.h:209
bool RefFloat_CheckExact(T *object)
Definition: CustomPyTypes.h:20
PyTypeObject RefInt_Type
PyTypeObject CustomInstanceMethod_Type
bool CustomInstanceMethod_CheckExact(T *object)
Definition: CustomPyTypes.h:70
bool RefFloat_Check(T *object)
Definition: CustomPyTypes.h:14
_object PyObject
Definition: PyMethodBase.h:41
PyTypeObject RefFloat_Type
Custom "builtins," detectable by type, for pass by ref and improved performance.
bool TypedefPointerToClass_CheckExact(T *object)
Definition: CustomPyTypes.h:55
bool CustomInstanceMethod_Check(T *object)
Definition: CustomPyTypes.h:64
PyObject_HEAD Cppyy::TCppType_t fType
Definition: CustomPyTypes.h:43
PyObject_HEAD PyObject * ii_container
Definition: CustomPyTypes.h:80