ROOT
6.16/01
Reference Guide
bindings
pyroot
inc
TPyReturn.h
Go to the documentation of this file.
1
// @(#)root/pyroot:$Id$
2
// Author: Wim Lavrijsen May 2004
3
4
#ifndef ROOT_TPyReturn
5
#define ROOT_TPyReturn
6
7
//////////////////////////////////////////////////////////////////////////////
8
// //
9
// TPyReturn //
10
// //
11
// Morphing return type from evaluating python expressions. //
12
// //
13
//////////////////////////////////////////////////////////////////////////////
14
15
16
// ROOT
17
#include "
Rtypes.h
"
18
19
// Python
20
struct
_object;
21
typedef
_object
PyObject
;
22
23
24
class
TPyReturn
{
25
public
:
26
TPyReturn
();
27
TPyReturn
(
PyObject
* pyobject );
28
TPyReturn
(
const
TPyReturn
& );
29
TPyReturn
&
operator=
(
const
TPyReturn
& );
30
virtual
~TPyReturn
();
31
32
// conversions to standard types, may fail if unconvertible
33
operator
char
*()
const
;
34
operator
const
char
*()
const
;
35
operator
Char_t
()
const
;
36
37
operator
Long_t
()
const
;
38
operator
Int_t
()
const
{
return
(
Int_t
)
operator
Long_t
(); }
39
operator
Short_t
()
const
{
return
(
Short_t
)
operator
Long_t
(); }
40
41
operator
ULong_t
()
const
;
42
operator
UInt_t
()
const
{
return
(
UInt_t
)
operator
ULong_t
(); }
43
operator
UShort_t
()
const
{
return
(
UShort_t
)
operator
ULong_t
(); }
44
45
operator
Double_t
()
const
;
46
operator
Float_t
()
const
{
return
(
Float_t
)
operator
Double_t
(); }
47
48
// used for both TObject and PyObject conversions
49
operator
void
*()
const
;
50
51
template
<
class
T>
52
operator
T
*()
const
{
return
(
T
*)(
void
*)*
this
; }
53
54
// used strictly for PyObject conversions
55
operator
PyObject
*()
const
;
56
57
ClassDef
(
TPyReturn
,1)
//Python morphing return object
58
59
private:
60
PyObject
*
fPyObject
;
//! actual python object
61
};
62
63
#endif
UShort_t
unsigned short UShort_t
Definition:
RtypesCore.h:36
Int_t
int Int_t
Definition:
RtypesCore.h:41
Char_t
char Char_t
Definition:
RtypesCore.h:29
UInt_t
unsigned int UInt_t
Definition:
RtypesCore.h:42
ULong_t
unsigned long ULong_t
Definition:
RtypesCore.h:51
Long_t
long Long_t
Definition:
RtypesCore.h:50
Short_t
short Short_t
Definition:
RtypesCore.h:35
Double_t
double Double_t
Definition:
RtypesCore.h:55
Float_t
float Float_t
Definition:
RtypesCore.h:53
Rtypes.h
ClassDef
#define ClassDef(name, id)
Definition:
Rtypes.h:324
PyObject
_object PyObject
Definition:
TPyArg.h:20
PyObject
_object PyObject
Definition:
TPyReturn.h:20
TPyReturn
Definition:
TPyReturn.h:24
TPyReturn::operator=
TPyReturn & operator=(const TPyReturn &)
Assignment operator. Applies python object reference counting.
Definition:
TPyReturn.cxx:74
TPyReturn::~TPyReturn
virtual ~TPyReturn()
Destructor. Reference counting for the held python object is in effect.
Definition:
TPyReturn.cxx:88
TPyReturn::TPyReturn
TPyReturn()
Definition:
TPyReturn.cxx:42
TPyReturn::fPyObject
PyObject * fPyObject
Definition:
TPyReturn.h:60
ROOT::Math::Chebyshev::T
double T(double x)
Definition:
ChebyshevPol.h:34