ROOT  6.06/09
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 );
55  PYROOT_DECLARE_BASIC_EXECUTOR( UIntArray );
56  PYROOT_DECLARE_BASIC_EXECUTOR( LongArray );
57  PYROOT_DECLARE_BASIC_EXECUTOR( ULongArray );
58  PYROOT_DECLARE_BASIC_EXECUTOR( FloatArray );
59  PYROOT_DECLARE_BASIC_EXECUTOR( DoubleArray );
60 
61 // special cases
62  PYROOT_DECLARE_BASIC_EXECUTOR( STLString );
64 
65  class TCppObjectExecutor : public TExecutor {
66  public:
68  virtual PyObject* Execute(
70 
71  protected:
73  };
74 
76  public:
78  virtual PyObject* Execute(
80  };
81 
82  class TRefExecutor : public TExecutor {
83  public:
85 
86  public:
87  virtual Bool_t SetAssignable( PyObject* );
88 
89  protected:
91  };
92 
93  PYROOT_DECLARE_BASIC_EXECUTOR( Constructor );
95 
96 #define PYROOT_DECLARE_BASIC_REFEXECUTOR( name ) \
97  class T##name##RefExecutor : public TRefExecutor { \
98  public: \
99  virtual PyObject* Execute( \
100  Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext* ); \
101  }
102 
116  PYROOT_DECLARE_BASIC_REFEXECUTOR( LongDouble );
118 
119 // special cases
121  public:
123  virtual PyObject* Execute(
125 
126  protected:
128  };
129 
131  public:
133  virtual PyObject* Execute(
135  };
136 
138  public:
140  virtual PyObject* Execute(
142  };
143 
145  public:
147  : TCppObjectExecutor ( klass ), fArraySize( array_size ) {}
148  virtual PyObject* Execute(
150 
151  protected:
153  };
154 
155 // smart pointer executors
157  public:
159  Cppyy::TCppMethod_t deref ) : fClass( klass ), fRawPtrType( rawPtrType ), fDereferencer( deref ) {}
160 
161  virtual PyObject* Execute(
163 
164  protected:
168  };
169 
171  public:
173 
174  virtual PyObject* Execute(
176  };
177 
179  public:
181  Cppyy::TCppMethod_t deref ) : fClass( klass ), fRawPtrType( rawPtrType ), fDereferencer( deref ) {}
182 
183  virtual PyObject* Execute(
185 
186  protected:
190  };
191 
192 // create executor from fully qualified type
193  TExecutor* CreateExecutor( const std::string& fullType,
194  Bool_t manage_smart_ptr = kTRUE );
195 
196 } // namespace PyROOT
197 
198 #endif // !PYROOT_EXECUTORS_H
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)
Definition: Executors.cxx:545
PyObject * fAssignable
Definition: Executors.h:90
virtual ~TExecutor()
Definition: Executors.h:18
PYROOT_DECLARE_BASIC_REFEXECUTOR(Bool)
TCppScope_t TCppType_t
Definition: Cppyy.h:13
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)
execute with argument , construct python ROOT object (ignoring ref) return ptr v...
Definition: Executors.cxx:495
const char * Int
TCppObjectArrayExecutor(Cppyy::TCppType_t klass, Py_ssize_t array_size)
Definition: Executors.h:146
PYROOT_DECLARE_BASIC_EXECUTOR(Bool)
TExecutor * CreateExecutor(const std::string &fullType, Bool_t manage_smart_ptr=kTRUE)
Definition: Executors.cxx:635
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:72
const char * UInt
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)
execute with argument , construct python ROOT object return ptr value ...
Definition: Executors.cxx:486
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)
execute with argument , construct TTupleOfInstances from return value ...
Definition: Executors.cxx:608
TCppObjectBySmartPtrRefExecutor(Cppyy::TCppType_t klass, Cppyy::TCppType_t rawPtrType, Cppyy::TCppMethod_t deref)
Definition: Executors.h:180
const char * UChar
const char * Float
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)
smart pointer excutor
Definition: Executors.cxx:505
ptrdiff_t TCppMethod_t
Definition: Cppyy.h:15
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)
execute with argument , construct python proxy object return value ...
Definition: Executors.cxx:409
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)
execution will bring a temporary in existence
Definition: Executors.cxx:418
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)
smart pointer excutor
Definition: Executors.cxx:528
const char * ULong
const char * Double
virtual Bool_t SetAssignable(PyObject *)
prepare "buffer" for by-ref returns, used with setitem
Definition: Executors.cxx:247
Cppyy::TCppType_t fClass
Definition: Executors.h:127
Global variables class (global variables are obtained from CINT).
Definition: TGlobal.h:29
void * TCppObject_t
Definition: Cppyy.h:14
const char * Bool
TCppObjectRefExecutor(Cppyy::TCppType_t klass)
Definition: Executors.h:122
TCppObjectBySmartPtrExecutor(Cppyy::TCppType_t klass, Cppyy::TCppType_t rawPtrType, Cppyy::TCppMethod_t deref)
Definition: Executors.h:158
int Py_ssize_t
Definition: PyROOT.h:154
virtual PyObject * Execute(Cppyy::TCppMethod_t, Cppyy::TCppObject_t, TCallContext *)
executor binds the result to the left-hand side, overwriting if an old object
Definition: Executors.cxx:443
Cppyy::TCppMethod_t fDereferencer
Definition: Executors.h:167
TCppObjectExecutor(Cppyy::TCppType_t klass)
Definition: Executors.h:67
const Bool_t kTRUE
Definition: Rtypes.h:91
_object PyObject
Definition: TPyArg.h:22
const char * Short