Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TPyArg.h
Go to the documentation of this file.
1// Author: Enric Tejedor CERN 08/2019
2// Original PyROOT code by Wim Lavrijsen, LBL
3//
4// /*************************************************************************
5// * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6// * All rights reserved. *
7// * *
8// * For the licensing terms see $ROOTSYS/LICENSE. *
9// * For the list of contributors see $ROOTSYS/README/CREDITS. *
10// *************************************************************************/
11
12#ifndef ROOT_TPyArg
13#define ROOT_TPyArg
14
15//////////////////////////////////////////////////////////////////////////////
16// //
17// TPyArg //
18// //
19// Morphing argument type from evaluating python expressions. //
20// //
21//////////////////////////////////////////////////////////////////////////////
22
23// ROOT
24#include "Rtypes.h"
25
26// Python
27struct _object;
28typedef _object PyObject;
29
30// Standard
31#include <vector>
32
33class TPyArg {
34public:
35 // converting constructors
40 TPyArg(const char *);
41
42 TPyArg(const TPyArg &);
43 TPyArg &operator=(const TPyArg &);
44 virtual ~TPyArg();
45
46 // "extractor"
47 operator PyObject *() const;
48
49 // constructor and generic dispatch
50 static void CallConstructor(PyObject *&pyself, PyObject *pyclass, const std::vector<TPyArg> &args);
51 static void CallConstructor(PyObject *&pyself, PyObject *pyclass); // default ctor
52 static PyObject *CallMethod(PyObject *pymeth, const std::vector<TPyArg> &args);
53 static void CallDestructor(PyObject *&pyself, PyObject *pymeth, const std::vector<TPyArg> &args);
54 static void CallDestructor(PyObject *&pyself);
55
56 ClassDef(TPyArg, 1) // Python morphing argument type
57
58private:
59 mutable PyObject *fPyObject; //! converted C++ value as python object
60};
61
62#endif
long Long_t
Definition RtypesCore.h:54
#define ClassDef(name, id)
Definition Rtypes.h:337
static PyObject * CallMethod(PyObject *pymeth, const std::vector< TPyArg > &args)
Definition TPyArg.cxx:49
static void CallDestructor(PyObject *&pyself, PyObject *pymeth, const std::vector< TPyArg > &args)
Definition TPyArg.cxx:61
PyObject * fPyObject
Definition TPyArg.h:59
static void CallConstructor(PyObject *&pyself, PyObject *pyclass)
TPyArg & operator=(const TPyArg &)
Assignment operator.
Definition TPyArg.cxx:124
virtual ~TPyArg()
Done with held PyObject.
Definition TPyArg.cxx:136
static void CallConstructor(PyObject *&pyself, PyObject *pyclass, const std::vector< TPyArg > &args)
Definition TPyArg.cxx:30
_object PyObject
Definition TPyArg.h:14