ROOT logo
// @(#)root/pyroot:$Id: TPyReturn.h 22698 2008-03-18 01:02:02Z wlav $
// Author: Wim Lavrijsen   May 2004

#ifndef ROOT_TPyReturn
#define ROOT_TPyReturn

//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// TPyReturn                                                                //
//                                                                          //
// Morphing return type from evaluating python expressions.                 //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////


// ROOT
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif

// Python
struct _object;
typedef _object PyObject;


class TPyReturn {
public:
   TPyReturn();
   TPyReturn( PyObject* pyobject );
   TPyReturn( const TPyReturn& );
   TPyReturn& operator=( const TPyReturn& );
   virtual ~TPyReturn();

// conversions to standard types, may fail if unconvertible
   operator const char*() const;
   operator Char_t() const;

   operator Long_t() const;
   operator Int_t() const { return (Int_t)operator Long_t(); }
   operator Short_t() const { return (Short_t)operator Long_t(); }

   operator ULong_t() const;
   operator UInt_t() const { return (UInt_t)operator ULong_t(); }
   operator UShort_t() const { return (UShort_t)operator ULong_t(); }

   operator Double_t() const;
   operator Float_t() const { return (Float_t)operator Double_t(); }

// used for both TObject and PyObject conversions
   operator void*() const;

// used strictly for PyObject conversions
   operator PyObject*() const;

   ClassDef(TPyReturn,1)   //Python morphing return object

private:
   PyObject* fPyObject;            //! actual python object
};

#endif
 TPyReturn.h:1
 TPyReturn.h:2
 TPyReturn.h:3
 TPyReturn.h:4
 TPyReturn.h:5
 TPyReturn.h:6
 TPyReturn.h:7
 TPyReturn.h:8
 TPyReturn.h:9
 TPyReturn.h:10
 TPyReturn.h:11
 TPyReturn.h:12
 TPyReturn.h:13
 TPyReturn.h:14
 TPyReturn.h:15
 TPyReturn.h:16
 TPyReturn.h:17
 TPyReturn.h:18
 TPyReturn.h:19
 TPyReturn.h:20
 TPyReturn.h:21
 TPyReturn.h:22
 TPyReturn.h:23
 TPyReturn.h:24
 TPyReturn.h:25
 TPyReturn.h:26
 TPyReturn.h:27
 TPyReturn.h:28
 TPyReturn.h:29
 TPyReturn.h:30
 TPyReturn.h:31
 TPyReturn.h:32
 TPyReturn.h:33
 TPyReturn.h:34
 TPyReturn.h:35
 TPyReturn.h:36
 TPyReturn.h:37
 TPyReturn.h:38
 TPyReturn.h:39
 TPyReturn.h:40
 TPyReturn.h:41
 TPyReturn.h:42
 TPyReturn.h:43
 TPyReturn.h:44
 TPyReturn.h:45
 TPyReturn.h:46
 TPyReturn.h:47
 TPyReturn.h:48
 TPyReturn.h:49
 TPyReturn.h:50
 TPyReturn.h:51
 TPyReturn.h:52
 TPyReturn.h:53
 TPyReturn.h:54
 TPyReturn.h:55
 TPyReturn.h:56
 TPyReturn.h:57
 TPyReturn.h:58
 TPyReturn.h:59
 TPyReturn.h:60
 TPyReturn.h:61