All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiPython Namespace Reference

GaudiPython.h GaudiPython/GaudiPython.h. More...

Namespaces

 Bindings
 
 GaudiAlgs
 
 GaudiHandles
 
 HistoUtils
 
 Persistency
 
 Pythonizations
 
 TupleUtils
 

Classes

struct  _identity
 It is here due to 'missing'(?) std::identity. More...
 
class  AlgDecorator
 
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  PyAlg
 general class to embed the existing algorithm/base class into the python More...
 
class  PyAlgorithm
 Python Algorithm base class. More...
 
class  TupleAlgDecorator
 Simple class to perform the "decoration" of Tuples in Python/ROOT. More...
 
class  TupleDecorator
 Simple class which performs the decoration of the standard N-Tuple. More...
 
class  TupleToolDecorator
 Simple class to perform the "decoration" of Tuples in Python/ROOT. More...
 

Typedefs

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

Functions

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

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..nosp@m.Bely.nosp@m.aev@l.nosp@m.app..nosp@m.in2p3.nosp@m..fr
Date
2005-08-04

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 20 of file CallbackStreamBuf.cpp.

21 {
22  if ( 0 == self || 0 == method ) { return 1 ; }
23  PyObject* r = PyObject_CallMethod(self, const_cast<char*>(method),
24  const_cast<char*>("s"), buf);
25  if ( 0 == r ) {
26  string err("Unsuccessful call to bound Python method");
27  err += method;
28  PyErr_SetString( PyExc_TypeError , err.c_str() ) ;
29  PyErr_Print() ;
30  return 1 ;
31  }
32  Py_DECREF( r );
33  return 0 ;
34 }
StatusCode GaudiPython::call_python_method ( PyObject *  self,
const char *  method 
)

call the python method

Definition at line 30 of file Algorithm.cpp.

31 {
33  // check arguments
34  if ( 0 == self || 0 == method ) { return StatusCode::FAILURE ; }
35 
36  // call Python
37  PyObject* r = PyObject_CallMethod(self, chr(method), chr(""));
38 
39  if ( 0 == r ) { PyErr_Print() ; return sc ; } // RETURN
40 
41  if ( PyInt_Check ( r ) )
42  { sc = PyInt_AS_LONG( r ) ; Py_DECREF( r ) ; return sc ; } // RETURN
43 
44  // look for the method getCode with the signature:
45  // ' int getCode() '
46  PyObject* c = PyObject_CallMethod(r, chr("getCode"), chr(""));
47 
48  if ( 0 == c ) { PyErr_Print() ; }
49  else if ( PyLong_Check( c )) { sc = PyLong_AsLong( c ); }
50  else
51  {
52  std::string msg( " call_python_method unexpected type from '" );
53  msg += method ;
54  msg += "().getCode()' " ;
55  PyErr_SetString( PyExc_TypeError , msg.c_str() ) ;
56  PyErr_Print() ;
57  }
58  // release used objects
59  Py_XDECREF( c ) ;
60  Py_XDECREF( r ) ;
61  //
62  return sc;
63 }
tuple c
Definition: gaudirun.py:341
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30