ROOT
6.06/09
Reference Guide
ROOT Home Page
Main Page
Related Pages
User's Classes
Namespaces
All Classes
Files
Release Notes
File List
File Members
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
#ifndef ROOT_Rtypes
18
#include "
Rtypes.h
"
19
#endif
20
21
// Python
22
struct
_object;
23
typedef
_object
PyObject
;
24
25
26
class
TPyReturn
{
27
public
:
28
TPyReturn
();
29
TPyReturn
( PyObject* pyobject );
30
TPyReturn
(
const
TPyReturn
& );
31
TPyReturn
&
operator=
(
const
TPyReturn
& );
32
virtual
~TPyReturn
();
33
34
// conversions to standard types, may fail if unconvertible
35
operator
char
*()
const
;
36
operator
const
char
*()
const
;
37
operator
Char_t
()
const
;
38
39
operator
Long_t
()
const
;
40
operator
Int_t
()
const
{
return
(
Int_t
)
operator
Long_t
(); }
41
operator
Short_t
()
const
{
return
(
Short_t
)
operator
Long_t
(); }
42
43
operator
ULong_t
()
const
;
44
operator
UInt_t
()
const
{
return
(
UInt_t
)
operator
ULong_t
(); }
45
operator
UShort_t
()
const
{
return
(
UShort_t
)
operator
ULong_t
(); }
46
47
operator
Double_t
()
const
;
48
operator
Float_t
()
const
{
return
(
Float_t
)
operator
Double_t
(); }
49
50
// used for both TObject and PyObject conversions
51
operator
void
*()
const
;
52
53
template
<
class
T>
54
operator
T
*()
const
{
return
(
T
*)(
void
*)*
this
; }
55
56
// used strictly for PyObject conversions
57
operator
PyObject*()
const
;
58
59
ClassDef
(
TPyReturn
,1)
//Python morphing return object
60
61
private:
62
PyObject* fPyObject;
//! actual python object
63
};
64
65
#endif
Rtypes.h
Float_t
float Float_t
Definition:
RtypesCore.h:53
TPyReturn::operator=
TPyReturn & operator=(const TPyReturn &)
Assignment operator. Applies python object reference counting.
Definition:
TPyReturn.cxx:74
ROOT::Math::Chebyshev::T
double T(double x)
Definition:
ChebyshevPol.h:34
UShort_t
unsigned short UShort_t
Definition:
RtypesCore.h:36
TPyReturn::TPyReturn
TPyReturn()
Int_t
int Int_t
Definition:
RtypesCore.h:41
ClassDef
#define ClassDef(name, id)
Definition:
Rtypes.h:254
TPyReturn::~TPyReturn
virtual ~TPyReturn()
Destructor. Reference counting for the held python object is in effect.
Definition:
TPyReturn.cxx:88
TPyReturn
Definition:
TPyReturn.h:26
PyObject
_object PyObject
Definition:
TPyReturn.h:22
UInt_t
unsigned int UInt_t
Definition:
RtypesCore.h:42
Short_t
short Short_t
Definition:
RtypesCore.h:35
Long_t
long Long_t
Definition:
RtypesCore.h:50
Double_t
double Double_t
Definition:
RtypesCore.h:55
ULong_t
unsigned long ULong_t
Definition:
RtypesCore.h:51
Char_t
char Char_t
Definition:
RtypesCore.h:29