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