Gaudi Framework, version v20r4

Generated: 8 Jan 2009

GaudiPython Namespace Reference


Detailed Description

GaudiPython.h GaudiPython/GaudiPython.h.

Namespace for all classes interfacing Gaudi to Python.

The general namespace to hide all Gaudi-python related classes

Author:
Vanya BELYAEV Ivan.Belyaev@lapp.in2p3.fr
Date:
2005-08-04


Classes

class  AlgDecorator
class  PyAlgorithm
 Python Algorithm base class. More...
class  PyAlg
 general class to embedd the existing algorithm/base class into the python More...
class  CallbackStreamBuf
struct  Helper
class  HistoDecorator
 Simple decorator class to allow to reuse the functionality of GaudiHistos<TYPE> class in pythin. More...
struct  Interface
 Minor mofidication of original Pere's structure GaudiPython::Interface This helper class is nesessary to perform C++ castings from python. More...
struct  Interface< IInterface >
struct  Printer
struct  Printer< ContainedObject >
struct  Printer< DataObject >
class  PyROOTPickle
class  TESSerializer
class  TupleDecorator
 Simple class which performs the decoration of the standard N-Tuple. More...
class  TupleAlgDecorator
 Simple class to perform the "decoration" of Tuples in Python/Reflex. More...
class  TupleToolDecorator
 Simple class to perform the "decoration" of Tuples in Python/Reflex. More...
struct  _identity
 It is here due to 'missing'(?) std::identity. More...

Namespaces

namespace  Bindings
namespace  GaudiAlgs
namespace  GaudiHandles
namespace  GaudiPython_confDb
namespace  GaudiPython_user_confDb
namespace  GaudiPythonConf
namespace  HistoUtils
namespace  Parallel
namespace  Pythonizations
namespace  TupleUtils

Typedefs

typedef std::vector< double > Vector
 useful type definition for implicit loos
typedef Vector Row
typedef std::vector< RowMatrix

Functions

StatusCode call_python_method (PyObject *self, const char *method)
 call the python method
int call_python_method (PyObject *self, const char *method, char *buf)
 call a python method with a string as an argument


Typedef Documentation

typedef std::vector<Row> GaudiPython::Matrix

Definition at line 23 of file Vector.h.

Definition at line 22 of file Vector.h.

typedef std::vector<double> GaudiPython::Vector

useful type definition for implicit loos

Definition at line 21 of file Vector.h.


Function Documentation

int GaudiPython::call_python_method ( PyObject *  self,
const char *  method,
char *  buf 
)

call a python method with a string as an argument

Definition at line 23 of file CallbackStreamBuf.cpp.

00024 {
00025   if ( 0 == self || 0 == method ) { return 1 ; }
00026   PyObject* r = PyObject_CallMethod(self, const_cast<char*>(method),
00027                                           const_cast<char*>("s"), buf);
00028   if ( 0 == r ) {
00029     string err("Unsuccessful call to bound Python method");
00030     err += method;
00031     PyErr_SetString( PyExc_TypeError , err.c_str() ) ;
00032     PyErr_Print() ;
00033     return 1 ;
00034   }
00035   Py_DECREF( r );
00036   return 0 ;
00037 }

StatusCode GaudiPython::call_python_method ( PyObject *  self,
const char *  method 
)

call the python method

Definition at line 33 of file Algorithm.cpp.

00034 {
00035   StatusCode sc = StatusCode::FAILURE;
00036   // check arguments
00037   if ( 0 == self || 0 == method ) { return StatusCode::FAILURE ; }
00038 
00039   // call Python
00040   PyObject* r = PyObject_CallMethod(self, chr(method), chr(""));
00041 
00042   if ( 0 == r ) { PyErr_Print() ;              return sc ; } // RETURN
00043 
00044   if ( PyInt_Check ( r ) )
00045   { sc = PyInt_AS_LONG( r ) ; Py_DECREF( r ) ; return sc ; } // RETURN
00046 
00047   // look for the method getCode with the signature:
00048   //  ' int getCode() '
00049   PyObject* c = PyObject_CallMethod(r, chr("getCode"), chr(""));
00050 
00051   if      ( 0 == c           ) {      PyErr_Print()      ; }
00052   else if ( PyLong_Check( c )) { sc = PyLong_AsLong( c ); }
00053   else
00054   {
00055     std::string msg( " call_python_method unexpected type from '" );
00056     msg += method ;
00057     msg += "().getCode()' " ;
00058     PyErr_SetString( PyExc_TypeError , msg.c_str() ) ;
00059     PyErr_Print() ;
00060   }
00061   // release used objects
00062   Py_XDECREF( c ) ;
00063   Py_XDECREF( r ) ;
00064   //
00065   return sc;
00066 } ;


Generated at Thu Jan 8 17:53:52 2009 for Gaudi Framework, version v20r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004