ROOT
master
Reference Guide
Loading...
Searching...
No Matches
TPyReturn.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_TPyReturn
13
#define ROOT_TPyReturn
14
15
//////////////////////////////////////////////////////////////////////////////
16
// //
17
// TPyReturn //
18
// //
19
// Morphing return type from evaluating python expressions. //
20
// //
21
//////////////////////////////////////////////////////////////////////////////
22
23
// ROOT
24
#include "
Rtypes.h
"
25
26
// Python
27
struct
_object;
28
typedef
_object
PyObject
;
29
30
class
TPyReturn
{
31
public
:
32
TPyReturn
();
33
TPyReturn
(
PyObject
*pyobject);
34
TPyReturn
(
const
TPyReturn
&);
35
TPyReturn
&
operator=
(
const
TPyReturn
&);
36
virtual
~TPyReturn
();
37
38
// conversions to standard types, may fail if unconvertible
39
operator
char
*()
const
;
40
operator
const
char
*()
const
;
41
operator
Char_t
()
const
;
42
43
operator
Long_t
()
const
;
44
operator
Int_t
()
const
{
return
(
Int_t
)
operator
Long_t
(); }
45
operator
Short_t
()
const
{
return
(
Short_t
)
operator
Long_t
(); }
46
47
operator
ULong_t
()
const
;
48
operator
UInt_t
()
const
{
return
(
UInt_t
)
operator
ULong_t
(); }
49
operator
UShort_t
()
const
{
return
(
UShort_t
)
operator
ULong_t
(); }
50
51
operator
Double_t
()
const
;
52
operator
Float_t
()
const
{
return
(
Float_t
)
operator
Double_t
(); }
53
54
// used for both TObject and PyObject conversions
55
operator
void
*()
const
;
56
57
template
<
class
T>
58
operator
T *()
const
59
{
60
return
(T *)(
void
*)*
this
;
61
}
62
63
// used strictly for PyObject conversions
64
operator
PyObject
*()
const
;
65
66
ClassDef
(
TPyReturn
, 1)
// Python morphing return object
67
68
private:
69
PyObject
*
fPyObject
;
//! actual python object
70
};
71
72
#endif
PyObject
_object PyObject
Definition
PyMethodBase.h:43
UShort_t
unsigned short UShort_t
Definition
RtypesCore.h:40
Int_t
int Int_t
Definition
RtypesCore.h:45
Char_t
char Char_t
Definition
RtypesCore.h:37
ULong_t
unsigned long ULong_t
Definition
RtypesCore.h:55
Long_t
long Long_t
Definition
RtypesCore.h:54
UInt_t
unsigned int UInt_t
Definition
RtypesCore.h:46
Float_t
float Float_t
Definition
RtypesCore.h:57
Short_t
short Short_t
Definition
RtypesCore.h:39
Double_t
double Double_t
Definition
RtypesCore.h:59
Rtypes.h
ClassDef
#define ClassDef(name, id)
Definition
Rtypes.h:342
PyObject
_object PyObject
Definition
TPyReturn.h:28
TPyReturn
Definition
TPyReturn.h:30
TPyReturn::operator=
TPyReturn & operator=(const TPyReturn &)
Assignment operator. Applies python object reference counting.
Definition
TPyReturn.cxx:93
TPyReturn::~TPyReturn
virtual ~TPyReturn()
Destructor. Reference counting for the held python object is in effect.
Definition
TPyReturn.cxx:109
TPyReturn::TPyReturn
TPyReturn()
Definition
TPyReturn.cxx:55
TPyReturn::fPyObject
PyObject * fPyObject
Definition
TPyReturn.h:69
int
unsigned int
bindings
tpython
inc
TPyReturn.h
ROOT master - Reference Guide Generated on Tue Dec 10 2024 09:33:47 (GVA Time) using Doxygen 1.9.8