Logo ROOT   6.14/05
Reference Guide
Executors.h
Go to the documentation of this file.
1 // @(#)root/pyroot:$Id$
2 // Author: Wim Lavrijsen, Jan 2005
3 #ifndef PYROOT_EXECUTORS_H
4 #define PYROOT_EXECUTORS_H
5 
6 // Bindings
7 #include "TCallContext.h"
8 
9 // Standard
10 #include <string>
11 #include <map>
12 
13 
14 namespace PyROOT {
15 
16  class TExecutor {
17  public:
18  virtual ~TExecutor() {}
19  virtual PyObject* Execute(
21  };
22 
23 #define PYROOT_DECLARE_BASIC_EXECUTOR( name ) \
24  class T##name##Executor : public TExecutor { \
25  public: \
26  virtual PyObject* Execute( \
27  Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext* ); \
28  }
29 
30 // executors for built-ins
32  PYROOT_DECLARE_BASIC_EXECUTOR( BoolConstRef );
34  PYROOT_DECLARE_BASIC_EXECUTOR( CharConstRef );
36  PYROOT_DECLARE_BASIC_EXECUTOR( UCharConstRef );
42  PYROOT_DECLARE_BASIC_EXECUTOR( ULongLong );
45  PYROOT_DECLARE_BASIC_EXECUTOR( LongDouble );
48 
49 // pointer/array executors
50  PYROOT_DECLARE_BASIC_EXECUTOR( VoidArray );
51  PYROOT_DECLARE_BASIC_EXECUTOR( BoolArray );
52  PYROOT_DECLARE_BASIC_EXECUTOR( ShortArray );
53  PYROOT_DECLARE_BASIC_EXECUTOR( UShortArray );
54  PYROOT_DECLARE_BASIC_EXECUTOR( CharArray );
55  PYROOT_DECLARE_BASIC_EXECUTOR( UCharArray );
57  PYROOT_DECLARE_BASIC_EXECUTOR( UIntArray );
58  PYROOT_DECLARE_BASIC_EXECUTOR( LongArray );
59  PYROOT_DECLARE_BASIC_EXECUTOR( ULongArray );
60  PYROOT_DECLARE_BASIC_EXECUTOR( FloatArray );
61  PYROOT_DECLARE_BASIC_EXECUTOR( DoubleArray );
62 
63 // special cases
64  PYROOT_DECLARE_BASIC_EXECUTOR( STLString );
66 
67  class TCppObjectExecutor : public TExecutor {
68  public:
69  TCppObjectExecutor( Cppyy::TCppType_t klass ) : fClass( klass ) {}
70  virtual PyObject* Execute(
72 
73  protected:
75  };
76 
78  public:
80  virtual PyObject* Execute(
82  };
83 
84  class TRefExecutor : public TExecutor {
85  public:
86  TRefExecutor() : fAssignable( 0 ) {}
87 
88  public:
89  virtual Bool_t SetAssignable( PyObject* );
90 
91  protected:
93  };
94 
95  PYROOT_DECLARE_BASIC_EXECUTOR( Constructor );
97 
98 #define PYROOT_DECLARE_BASIC_REFEXECUTOR( name ) \
99  class T##name##RefExecutor : public TRefExecutor { \
100  public: \
101  virtual PyObject* Execute( \
102  Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext* ); \
103  }
104 
118  PYROOT_DECLARE_BASIC_REFEXECUTOR( LongDouble );
120 
121 // special cases
123  public:
124  TCppObjectRefExecutor( Cppyy::TCppType_t klass ) : fClass( klass ) {}
125  virtual PyObject* Execute(
127 
128  protected:
130  };
131 
133  public:
135  virtual PyObject* Execute(
137  };
138 
140  public:
142  virtual PyObject* Execute(
144  };
145 
147  public:
149  : TCppObjectExecutor ( klass ), fArraySize( array_size ) {}
150  virtual PyObject* Execute(
152 
153  protected:
155  };
156 
157 // smart pointer executors
159  public:
161  Cppyy::TCppMethod_t deref ) : fClass( klass ), fRawPtrType( rawPtrType ), fDereferencer( deref ) {}
162 
163  virtual PyObject* Execute(
165 
166  protected:
170  };
171 
173  public:
175 
176  virtual PyObject* Execute(
178  };
179 
181  public:
183  Cppyy::TCppMethod_t deref ) : fClass( klass ), fRawPtrType( rawPtrType ), fDereferencer( deref ) {}
184 
185  virtual PyObject* Execute(
187 
188  protected:
192  };
193 
194 // create executor from fully qualified type
195  TExecutor* CreateExecutor( const std::string& fullType,
196  Bool_t manage_smart_ptr = kTRUE );
197 
198 } // namespace PyROOT
199 
200 #endif // !PYROOT_EXECUTORS_H
PyObject * fAssignable
Definition: Executors.h:92
virtual ~TExecutor()
Definition: Executors.h:18
PYROOT_DECLARE_BASIC_REFEXECUTOR(Bool)
TCppScope_t TCppType_t
Definition: Cppyy.h:13
const char * Int
TCppObjectArrayExecutor(Cppyy::TCppType_t klass, Py_ssize_t array_size)
Definition: Executors.h:148
PYROOT_DECLARE_BASIC_EXECUTOR(Bool)
TExecutor * CreateExecutor(const std::string &fullType, Bool_t manage_smart_ptr=kTRUE)
Definition: Executors.cxx:637
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)=0
const char * Long
bool Bool_t
Definition: RtypesCore.h:59
const char * Char
const char * UShort
Cppyy::TCppType_t fClass
Definition: Executors.h:74
const char * UInt
TCppObjectBySmartPtrRefExecutor(Cppyy::TCppType_t klass, Cppyy::TCppType_t rawPtrType, Cppyy::TCppMethod_t deref)
Definition: Executors.h:182
const char * UChar
const char * Float
ptrdiff_t TCppMethod_t
Definition: Cppyy.h:15
const char * ULong
const char * Double
Cppyy::TCppType_t fClass
Definition: Executors.h:129
Global variables class (global variables are obtained from CINT).
Definition: TGlobal.h:27
void * TCppObject_t
Definition: Cppyy.h:14
const char * Bool
TCppObjectRefExecutor(Cppyy::TCppType_t klass)
Definition: Executors.h:124
TCppObjectBySmartPtrExecutor(Cppyy::TCppType_t klass, Cppyy::TCppType_t rawPtrType, Cppyy::TCppMethod_t deref)
Definition: Executors.h:160
int Py_ssize_t
Definition: PyROOT.h:156
Cppyy::TCppMethod_t fDereferencer
Definition: Executors.h:169
TCppObjectExecutor(Cppyy::TCppType_t klass)
Definition: Executors.h:69
const Bool_t kTRUE
Definition: RtypesCore.h:87
_object PyObject
Definition: TPyArg.h:20
const char * Short