forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTPyArg.h
More file actions
55 lines (44 loc) · 1.73 KB
/
TPyArg.h
File metadata and controls
55 lines (44 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Author: Enric Tejedor CERN 08/2019
// Original PyROOT code by Wim Lavrijsen, LBL
//
// /*************************************************************************
// * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
// * All rights reserved. *
// * *
// * For the licensing terms see $ROOTSYS/LICENSE. *
// * For the list of contributors see $ROOTSYS/README/CREDITS. *
// *************************************************************************/
#ifndef ROOT_TPyArg
#define ROOT_TPyArg
// ROOT
#include "Rtypes.h"
// Python
struct _object;
typedef _object PyObject;
// Standard
#include <vector>
/// Morphing argument type from evaluating python expressions.
class TPyArg {
public:
// converting constructors
TPyArg(PyObject *);
TPyArg(Int_t);
TPyArg(Long_t);
TPyArg(Double_t);
TPyArg(const char *);
TPyArg(const TPyArg &);
TPyArg &operator=(const TPyArg &);
virtual ~TPyArg();
// "extractor"
operator PyObject *() const;
// constructor and generic dispatch
static void CallConstructor(PyObject *&pyself, PyObject *pyclass, const std::vector<TPyArg> &args);
static void CallConstructor(PyObject *&pyself, PyObject *pyclass); // default ctor
static PyObject *CallMethod(PyObject *pymeth, const std::vector<TPyArg> &args);
static void CallDestructor(PyObject *&pyself, PyObject *pymeth, const std::vector<TPyArg> &args);
static void CallDestructor(PyObject *&pyself);
ClassDef(TPyArg, 1) // Python morphing argument type
private:
mutable PyObject *fPyObject; ///<! converted C++ value as python object
};
#endif