TPyDispatcher.h

Go to the documentation of this file.
00001 // Author: Wim Lavrijsen   Aug 2007
00002 
00003 #ifndef ROOT_TPyDispatcher
00004 #define ROOT_TPyDispatcher
00005 
00006 //////////////////////////////////////////////////////////////////////////////
00007 //                                                                          //
00008 // TPyDispatcher                                                            //
00009 //                                                                          //
00010 // Dispatcher for CINT callbacks into python code.                          //
00011 //                                                                          //
00012 //////////////////////////////////////////////////////////////////////////////
00013 
00014 
00015 // ROOT
00016 #ifndef ROOT_TObject
00017 #include "TObject.h"
00018 #endif
00019 
00020 // Python
00021 struct _object;
00022 typedef _object PyObject;
00023 
00024 
00025 class TPyDispatcher : public TObject {
00026 public:
00027    TPyDispatcher( PyObject* callable );
00028    TPyDispatcher( const TPyDispatcher& );
00029    TPyDispatcher& operator=( const TPyDispatcher& );
00030    ~TPyDispatcher();
00031 
00032 public:
00033 #ifndef __CINT__
00034    PyObject* DispatchVA( const char* format = 0, ... );
00035 #else
00036    PyObject* DispatchVA( const char* format, ... );
00037 #endif
00038 
00039 // pre-defined dispatches, same as per TQObject::Emit(); note that
00040 // Emit() maps exclusively to this set, so several builtin types (e.g.
00041 // Int_t, Bool_t, Float_t, etc.) have been omitted here
00042    PyObject* Dispatch() { return DispatchVA( 0 ); }
00043    PyObject* Dispatch( const char* param ) { return DispatchVA( "s", param ); }
00044    PyObject* Dispatch( Double_t param )    { return DispatchVA( "d", param ); }
00045    PyObject* Dispatch( Long_t param )      { return DispatchVA( "l", param ); }
00046    PyObject* Dispatch( Long64_t param )    { return DispatchVA( "L", param ); }
00047 
00048    ClassDef( TPyDispatcher, 1 );   // Python dispatcher class
00049 
00050 private:
00051    PyObject* fCallable;            //! callable object to be dispatched
00052 };
00053 
00054 #endif

Generated on Tue Jul 5 14:10:09 2011 for ROOT_528-00b_version by  doxygen 1.5.1