ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TMethodHolder.h
Go to the documentation of this file.
1 // @(#)root/pyroot:$Id$
2 // Author: Wim Lavrijsen, Apr 2004
3 
4 #ifndef PYROOT_TMETHODHOLDER_H
5 #define PYROOT_TMETHODHOLDER_H
6 
7 // Bindings
8 #include "PyCallable.h"
9 
10 // Standard
11 #include <string>
12 #include <vector>
13 
14 
15 namespace PyROOT {
16 
17  class TExecutor;
18  class TConverter;
19 
20  class TMethodHolder : public PyCallable {
21  public:
23  TMethodHolder( const TMethodHolder& );
25  virtual ~TMethodHolder();
26 
27  public:
28  virtual PyObject* GetSignature();
29  virtual PyObject* GetPrototype();
30  virtual Int_t GetPriority();
31 
32  virtual Int_t GetMaxArgs();
33  virtual PyObject* GetCoVarNames();
34  virtual PyObject* GetArgDefault( Int_t iarg );
35  virtual PyObject* GetScopeProxy();
36 
37  virtual PyCallable* Clone() { return new TMethodHolder( *this ); }
38 
39  public:
40  virtual PyObject* Call(
41  ObjectProxy*& self, PyObject* args, PyObject* kwds, TCallContext* ctxt = 0 );
42 
43  virtual Bool_t Initialize( TCallContext* ctxt = 0 );
44  virtual PyObject* PreProcessArgs( ObjectProxy*& self, PyObject* args, PyObject* kwds );
45  virtual Bool_t ConvertAndSetArgs( PyObject* args, TCallContext* ctxt = 0 );
46  virtual PyObject* Execute( void* self, ptrdiff_t offset, TCallContext* ctxt = 0 );
47 
48  protected:
52  std::string GetSignatureString();
53  std::string GetReturnTypeName();
54 
55  virtual Bool_t InitExecutor_( TExecutor*&, TCallContext* ctxt = 0 );
56 
57  private:
58  void Copy_( const TMethodHolder& );
59  void Destroy_() const;
60 
61  PyObject* CallFast( void*, ptrdiff_t, TCallContext* );
62  PyObject* CallSafe( void*, ptrdiff_t, TCallContext* );
63 
65 
66  void SetPyError_( PyObject* msg );
67 
68  private:
69  // representation
73 
74  // call dispatch buffers
75  std::vector< TConverter* > fConverters;
76 
77  // cached values
79 
80  // admin
82  };
83 
84 } // namespace PyROOT
85 
86 #endif // !PYROOT_METHODHOLDER_H
Cppyy::TCppScope_t fScope
Definition: TMethodHolder.h:71
virtual Int_t GetPriority()
Method priorities exist (in lieu of true overloading) there to prevent void* or <unknown>* from usurp...
TMethodHolder & operator=(const TMethodHolder &)
assignment operator
tuple offset
Definition: tree.py:93
virtual PyObject * GetArgDefault(Int_t iarg)
get the default value (if any) of argument iarg of this method
virtual PyObject * GetPrototype()
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Bool_t Initialize(TCallContext *ctxt=0)
done if cache is already setup
virtual PyObject * Call(ObjectProxy *&self, PyObject *args, PyObject *kwds, TCallContext *ctxt=0)
preliminary check in case keywords are accidently used (they are ignored otherwise) ...
virtual PyObject * GetScopeProxy()
Get or build the scope of this method.
void Destroy_() const
destroy executor and argument converters
std::string GetReturnTypeName()
PyObject * CallSafe(void *, ptrdiff_t, TCallContext *)
Helper code to prevent some code duplication; this code embeds a ROOT "try/catch" block that saves th...
Cppyy::TCppMethod_t GetMethod()
Definition: TMethodHolder.h:49
virtual Bool_t InitExecutor_(TExecutor *&, TCallContext *ctxt=0)
install executor conform to the return type
void SetPyError_(PyObject *msg)
helper to report errors in a consistent format (derefs msg)
virtual PyObject * GetSignature()
void Copy_(const TMethodHolder &)
virtual PyObject * Execute(void *self, ptrdiff_t offset, TCallContext *ctxt=0)
call the interface method
ptrdiff_t TCppMethod_t
Definition: Cppyy.h:15
Cppyy::TCppScope_t GetScope()
Definition: TMethodHolder.h:50
virtual PyCallable * Clone()
Definition: TMethodHolder.h:37
std::string GetSignatureString()
built a signature representation (used for doc strings)
virtual PyObject * PreProcessArgs(ObjectProxy *&self, PyObject *args, PyObject *kwds)
verify existence of self, return if ok
std::vector< TConverter * > fConverters
Definition: TMethodHolder.h:75
virtual PyObject * GetCoVarNames()
Build a tuple of the argument types/names.
TMethodHolder(Cppyy::TCppScope_t scope, Cppyy::TCppMethod_t method)
PyObject * CallFast(void *, ptrdiff_t, TCallContext *)
Helper code to prevent some duplication; this is called from CallSafe() as well as directly from TMet...
virtual Int_t GetMaxArgs()
Cppyy::TCppMethod_t fMethod
Definition: TMethodHolder.h:70
virtual ~TMethodHolder()
destructor
virtual Bool_t ConvertAndSetArgs(PyObject *args, TCallContext *ctxt=0)
Bool_t InitConverters_()
build buffers for argument dispatching
ptrdiff_t TCppScope_t
Definition: Cppyy.h:12
TExecutor * GetExecutor()
Definition: TMethodHolder.h:51
_object PyObject
Definition: TPyArg.h:22