Logo ROOT  
Reference Guide
DeclareExecutors.h
Go to the documentation of this file.
1 #ifndef CPYCPPYY_DECLAREEXECUTORS_H
2 #define CPYCPPYY_DECLAREEXECUTORS_H
3 
4 // Bindings
5 #include "Executors.h"
6 #include "CallContext.h"
7 
8 #if __cplusplus > 201402L
9 #include <cstddef>
10 #endif
11 
12 
13 namespace CPyCppyy {
14 
15 namespace {
16 
17 #define CPPYY_DECL_EXEC(name) \
18 class name##Executor : public Executor { \
19 public: \
20  virtual PyObject* Execute( \
21  Cppyy::TCppMethod_t, Cppyy::TCppObject_t, CallContext*); \
22 }
23 
24 // executors for built-ins
26 CPPYY_DECL_EXEC(BoolConstRef);
28 CPPYY_DECL_EXEC(CharConstRef);
30 CPPYY_DECL_EXEC(UCharConstRef);
31 CPPYY_DECL_EXEC(WChar);
32 CPPYY_DECL_EXEC(Char16);
33 CPPYY_DECL_EXEC(Char32);
34 CPPYY_DECL_EXEC(Int8);
35 CPPYY_DECL_EXEC(UInt8);
40 CPPYY_DECL_EXEC(LongLong);
41 CPPYY_DECL_EXEC(ULongLong);
44 CPPYY_DECL_EXEC(LongDouble);
45 CPPYY_DECL_EXEC(Void);
46 CPPYY_DECL_EXEC(CString);
47 CPPYY_DECL_EXEC(WCString);
48 CPPYY_DECL_EXEC(CString16);
49 CPPYY_DECL_EXEC(CString32);
50 
51 // pointer/array executors
52 CPPYY_DECL_EXEC(VoidArray);
53 CPPYY_DECL_EXEC(BoolArray);
54 CPPYY_DECL_EXEC(UCharArray);
55 #if __cplusplus > 201402L
56 CPPYY_DECL_EXEC(ByteArray);
57 #endif
58 CPPYY_DECL_EXEC(ShortArray);
59 CPPYY_DECL_EXEC(UShortArray);
60 CPPYY_DECL_EXEC(IntArray);
61 CPPYY_DECL_EXEC(UIntArray);
62 CPPYY_DECL_EXEC(LongArray);
63 CPPYY_DECL_EXEC(ULongArray);
64 CPPYY_DECL_EXEC(LLongArray);
65 CPPYY_DECL_EXEC(ULLongArray);
66 CPPYY_DECL_EXEC(FloatArray);
67 CPPYY_DECL_EXEC(DoubleArray);
68 CPPYY_DECL_EXEC(ComplexFArray);
69 CPPYY_DECL_EXEC(ComplexDArray);
70 CPPYY_DECL_EXEC(ComplexIArray);
71 CPPYY_DECL_EXEC(ComplexLArray);
72 
73 // special cases
74 CPPYY_DECL_EXEC(ComplexD);
75 CPPYY_DECL_EXEC(STLString);
76 CPPYY_DECL_EXEC(STLWString);
77 
78 class InstancePtrExecutor : public Executor {
79 public:
80  InstancePtrExecutor(Cppyy::TCppType_t klass) : fClass(klass) {}
81  virtual PyObject* Execute(
83  virtual bool HasState() { return true; }
84 
85 protected:
87 };
88 
89 class InstanceExecutor : public Executor {
90 public:
91  InstanceExecutor(Cppyy::TCppType_t klass);
92  virtual PyObject* Execute(
94  virtual bool HasState() { return true; }
95 
96 protected:
98  unsigned int fFlags;
99 };
100 
101 class IteratorExecutor : public InstanceExecutor {
102 public:
103  IteratorExecutor(Cppyy::TCppType_t klass);
104 };
105 
106 CPPYY_DECL_EXEC(Constructor);
108 
109 #define CPPYY_DECL_REFEXEC(name) \
110 class name##RefExecutor : public RefExecutor { \
111 public: \
112  virtual PyObject* Execute( \
113  Cppyy::TCppMethod_t, Cppyy::TCppObject_t, CallContext*); \
114 }
115 
119 CPPYY_DECL_REFEXEC(Int8);
120 CPPYY_DECL_REFEXEC(UInt8);
127 CPPYY_DECL_REFEXEC(LongLong);
128 CPPYY_DECL_REFEXEC(ULongLong);
131 CPPYY_DECL_REFEXEC(LongDouble);
132 CPPYY_DECL_REFEXEC(ComplexD);
133 CPPYY_DECL_REFEXEC(STLString);
134 
135 // special cases
136 class InstanceRefExecutor : public RefExecutor {
137 public:
138  InstanceRefExecutor(Cppyy::TCppType_t klass) : fClass(klass) {}
139  virtual PyObject* Execute(
141 
142 protected:
144 };
145 
146 class InstancePtrPtrExecutor : public InstanceRefExecutor {
147 public:
148  using InstanceRefExecutor::InstanceRefExecutor;
149  virtual PyObject* Execute(
151 };
152 
153 class InstancePtrRefExecutor : public InstanceRefExecutor {
154 public:
155  using InstanceRefExecutor::InstanceRefExecutor;
156  virtual PyObject* Execute(
158 };
159 
160 class InstanceArrayExecutor : public InstancePtrExecutor {
161 public:
162  InstanceArrayExecutor(Cppyy::TCppType_t klass, Py_ssize_t array_size)
163  : InstancePtrExecutor(klass), fArraySize(array_size) {}
164  virtual PyObject* Execute(
166 
167 protected:
169 };
170 
171 } // unnamed namespace
172 
173 } // namespace CPyCppyy
174 
175 #endif // !CPYCPPYY_DECLAREEXECUTORS_H
TCppScope_t TCppType_t
Definition: cpp_cppyy.h:19
const char * Int
Cppyy::TCppType_t fClass
const char * Long
const char * Char
const char * UShort
const char * UInt
unsigned int fFlags
#define CPPYY_DECL_EXEC(name)
const char * UChar
const char * Float
_object PyObject
Definition: PyMethodBase.h:41
intptr_t TCppMethod_t
Definition: cpp_cppyy.h:22
const char * ULong
const char * Double
int Py_ssize_t
Definition: CPyCppyy.h:228
#define CPPYY_DECL_REFEXEC(name)
const char * Bool
void * TCppObject_t
Definition: cpp_cppyy.h:21
Py_ssize_t fArraySize
const char * Short