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#include "Dimensions.h"
8
9// Standard
10#if __cplusplus > 201402L
11#include <cstddef>
12#endif
13
14
15namespace CPyCppyy {
16
17namespace {
18
19#define CPPYY_DECL_EXEC(name) \
20class name##Executor : public Executor { \
21public: \
22 virtual PyObject* Execute( \
23 Cppyy::TCppMethod_t, Cppyy::TCppObject_t, CallContext*); \
24}
25
26// executors for built-ins
27CPPYY_DECL_EXEC(Bool);
28CPPYY_DECL_EXEC(BoolConstRef);
29CPPYY_DECL_EXEC(Char);
30CPPYY_DECL_EXEC(CharConstRef);
31CPPYY_DECL_EXEC(UChar);
32CPPYY_DECL_EXEC(UCharConstRef);
33CPPYY_DECL_EXEC(WChar);
34CPPYY_DECL_EXEC(Char16);
35CPPYY_DECL_EXEC(Char32);
36CPPYY_DECL_EXEC(Int8);
37CPPYY_DECL_EXEC(UInt8);
38CPPYY_DECL_EXEC(Short);
40CPPYY_DECL_EXEC(Long);
41CPPYY_DECL_EXEC(ULong);
42CPPYY_DECL_EXEC(LongLong);
43CPPYY_DECL_EXEC(ULongLong);
44CPPYY_DECL_EXEC(Float);
45CPPYY_DECL_EXEC(Double);
46CPPYY_DECL_EXEC(LongDouble);
47CPPYY_DECL_EXEC(Void);
48CPPYY_DECL_EXEC(CString);
49CPPYY_DECL_EXEC(CStringRef);
50CPPYY_DECL_EXEC(WCString);
51CPPYY_DECL_EXEC(CString16);
52CPPYY_DECL_EXEC(CString32);
53
54// pointer/array executors
55#define CPPYY_ARRAY_DECL_EXEC(name) \
56class name##ArrayExecutor : public Executor { \
57 dims_t fShape; \
58public: \
59 name##ArrayExecutor(dims_t dims) : fShape(dims) {} \
60 virtual PyObject* Execute( \
61 Cppyy::TCppMethod_t, Cppyy::TCppObject_t, CallContext*); \
62 virtual bool HasState() { return true; } \
63}
67#if __cplusplus > 201402L
69#endif
82CPPYY_ARRAY_DECL_EXEC(ComplexF);
83CPPYY_ARRAY_DECL_EXEC(ComplexD);
84CPPYY_ARRAY_DECL_EXEC(ComplexI);
85CPPYY_ARRAY_DECL_EXEC(ComplexL);
86
87// special cases
88CPPYY_DECL_EXEC(ComplexD);
89CPPYY_DECL_EXEC(STLString);
90CPPYY_DECL_EXEC(STLWString);
91
92class InstancePtrExecutor : public Executor {
93public:
94 InstancePtrExecutor(Cppyy::TCppType_t klass) : fClass(klass) {}
95 virtual PyObject* Execute(
97 virtual bool HasState() { return true; }
98
99protected:
101};
102
103class InstanceExecutor : public Executor {
104public:
105 InstanceExecutor(Cppyy::TCppType_t klass);
106 virtual PyObject* Execute(
108 virtual bool HasState() { return true; }
109
110protected:
112 uint32_t fFlags;
113};
114
115class IteratorExecutor : public InstanceExecutor {
116public:
117 IteratorExecutor(Cppyy::TCppType_t klass);
118 virtual PyObject* Execute(
120};
121
122CPPYY_DECL_EXEC(Constructor);
124
125#define CPPYY_DECL_REFEXEC(name) \
126class name##RefExecutor : public RefExecutor { \
127public: \
128 virtual PyObject* Execute( \
129 Cppyy::TCppMethod_t, Cppyy::TCppObject_t, CallContext*); \
130}
131
134CPPYY_DECL_REFEXEC(UChar);
136CPPYY_DECL_REFEXEC(UInt8);
137CPPYY_DECL_REFEXEC(Short);
138CPPYY_DECL_REFEXEC(UShort);
142CPPYY_DECL_REFEXEC(ULong);
143CPPYY_DECL_REFEXEC(LongLong);
144CPPYY_DECL_REFEXEC(ULongLong);
145CPPYY_DECL_REFEXEC(Float);
146CPPYY_DECL_REFEXEC(Double);
147CPPYY_DECL_REFEXEC(LongDouble);
148CPPYY_DECL_REFEXEC(ComplexD);
149CPPYY_DECL_REFEXEC(STLString);
150
151// special cases
152class InstanceRefExecutor : public RefExecutor {
153public:
154 InstanceRefExecutor(Cppyy::TCppType_t klass) : fClass(klass) {}
155 virtual PyObject* Execute(
157
158protected:
160};
161
162class InstancePtrPtrExecutor : public InstanceRefExecutor {
163public:
164 using InstanceRefExecutor::InstanceRefExecutor;
165 virtual PyObject* Execute(
167};
168
169class InstancePtrRefExecutor : public InstanceRefExecutor {
170public:
171 using InstanceRefExecutor::InstanceRefExecutor;
172 virtual PyObject* Execute(
174};
175
176class InstanceArrayExecutor : public InstancePtrExecutor {
177public:
178 InstanceArrayExecutor(Cppyy::TCppType_t klass, dim_t array_size)
179 : InstancePtrExecutor(klass), fSize(array_size) {}
180 virtual PyObject* Execute(
182
183protected:
185};
186
187class FunctionPointerExecutor : public Executor {
188public:
189 FunctionPointerExecutor(const std::string& ret, const std::string& sig) :
190 fRetType(ret), fSignature(sig) {}
191 virtual PyObject* Execute(
193
194protected:
195 std::string fRetType;
196 std::string fSignature;
197};
198
199} // unnamed namespace
200
201} // namespace CPyCppyy
202
203#endif // !CPYCPPYY_DECLAREEXECUTORS_H
std::string fRetType
Cppyy::TCppType_t fClass
std::string fSignature
#define CPPYY_ARRAY_DECL_EXEC(name)
dim_t fSize
#define CPPYY_DECL_EXEC(name)
#define CPPYY_DECL_REFEXEC(name)
_object PyObject
std::ios_base::fmtflags fFlags
Py_ssize_t array_size(const std::string &name)
Py_ssize_t dim_t
Definition API.h:90
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