ROOT  6.06/09
Reference Guide
TPyArg.h
Go to the documentation of this file.
1 // @(#)root/pyroot:$Id$
2 // Author: Wim Lavrijsen Aug 2013
3 
4 #ifndef ROOT_TPyArg
5 #define ROOT_TPyArg
6 
7 //////////////////////////////////////////////////////////////////////////////
8 // //
9 // TPyArg //
10 // //
11 // Morphing argument type from evaluating python expressions. //
12 // //
13 //////////////////////////////////////////////////////////////////////////////
14 
15 
16 // ROOT
17 #ifndef ROOT_Rtypes
18 #include "Rtypes.h"
19 #endif
20 
21 // Python
22 struct _object;
23 typedef _object PyObject;
24 
25 // Standard
26 #include <vector>
27 
28 
29 class TPyArg {
30 public:
31 // converting constructors
32  TPyArg( PyObject* );
33  TPyArg( Int_t );
34  TPyArg( Long_t );
35  TPyArg( Double_t );
36  TPyArg( const char* );
37 
38  TPyArg( const TPyArg& );
39  TPyArg& operator=( const TPyArg& );
40  virtual ~TPyArg();
41 
42 // "extractor"
43  operator PyObject*() const;
44 
45 // constructor and generic dispatch
46  static void CallConstructor( PyObject*& pyself, PyObject* pyclass, const std::vector<TPyArg>& args );
47  static void CallConstructor( PyObject*& pyself, PyObject* pyclass ); // default ctor
48  static PyObject* CallMethod( PyObject* pymeth, const std::vector<TPyArg>& args );
49 
50  ClassDef(TPyArg,1) //Python morphing argument type
51 
52 private:
53  mutable PyObject* fPyObject; //! converted C++ value as python object
54 };
55 
56 #endif
TPyArg & operator=(const TPyArg &)
Assignment operator.
Definition: TPyArg.cxx:109
TPyArg(PyObject *)
Definition: TPyArg.cxx:58
int Int_t
Definition: RtypesCore.h:41
static PyObject * CallMethod(PyObject *pymeth, const std::vector< TPyArg > &args)
Definition: TPyArg.cxx:46
#define ClassDef(name, id)
Definition: Rtypes.h:254
Definition: TPyArg.h:29
virtual ~TPyArg()
Done with held PyObject.
Definition: TPyArg.cxx:121
long Long_t
Definition: RtypesCore.h:50
double Double_t
Definition: RtypesCore.h:55
static void CallConstructor(PyObject *&pyself, PyObject *pyclass, const std::vector< TPyArg > &args)
_object PyObject
Definition: TPyArg.h:22