ROOT logo
ROOT » BINDINGS » PYROOT » TPyReturn

class TPyReturn

                        Python expression eval result


 Transport class for bringing objects from python (dynamically typed) to CINT
 (statically typed). It is best to immediately cast a TPyReturn to the real
 type, either implicitly (for builtin types) or explicitly (through a void*
 cast for pointers to ROOT objects).

 Examples:

  root [0] TBrowser* b = (void*)TPython::Eval( "ROOT.TBrowser()" );
  root [1] int i = TPython::Eval( "1+1" );
  root [2] i
  (int)2
  root [3] double d = TPython::Eval( "1+3.1415" );
  root [4] d
  (double)4.14150000000000063e+00

Function Members (Methods)

Data Members

private:
PyObject*fPyObject! actual python object

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TPyReturn()
 Construct a TPyReturn object from Py_None.
TPyReturn(PyObject* pyobject)
 Construct a TPyReturn from a python object. The python object may represent
 a ROOT object. Steals reference to given python object.
TPyReturn(const TPyReturn& )
 Copy constructor. Applies python object reference counting.
TPyReturn& operator=(const TPyReturn& )
 Assignment operator. Applies python object reference counting.
~TPyReturn()
 Destructor. Reference counting for the held python object is in effect.
operator const char*() const
 Cast python return value to C-style string (may fail).
operator Char_t() const
 Cast python return value to C++ char (may fail).
operator Long_t() const
 Cast python return value to C++ long (may fail).
operator ULong_t() const
 Cast python return value to C++ unsigned long (may fail).
operator Double_t() const
 Cast python return value to to C++ double (may fail).
operator void*() const
 Cast python return value to ROOT object with dictionary (may fail; note that
 you have to use the void* converter, as CINT will not call any other).
operator Int_t() const
{ return (Int_t)operator Long_t(); }
operator Short_t() const
{ return (Short_t)operator Long_t(); }
operator UInt_t() const
{ return (UInt_t)operator ULong_t(); }
operator UShort_t() const
{ return (UShort_t)operator ULong_t(); }
operator Float_t() const
{ return (Float_t)operator Double_t(); }