Gaudi Framework, version v22r2

Home   Generated: Tue May 10 2011
Namespaces | Classes | Typedefs | Functions

GaudiPython Namespace Reference

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

Namespaces

namespace  Bindings
namespace  GaudiAlgs
namespace  GaudiHandles
namespace  HistoUtils
namespace  Pythonizations
namespace  TupleUtils

Classes

class  AlgDecorator
class  PyAlgorithm
 Python Algorithm base class. More...
class  PyAlg
 general class to embed 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  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...

Typedefs

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

Functions

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

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

Typedef Documentation

Definition at line 23 of file Vector.h.

Definition at line 22 of file Vector.h.

useful type definition for implicit loos

Definition at line 21 of file Vector.h.


Function Documentation

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

call the python method

Definition at line 33 of file Algorithm.cpp.

{
  StatusCode sc = StatusCode::FAILURE;
  // check arguments
  if ( 0 == self || 0 == method ) { return StatusCode::FAILURE ; }

  // call Python
  PyObject* r = PyObject_CallMethod(self, chr(method), chr(""));

  if ( 0 == r ) { PyErr_Print() ;              return sc ; } // RETURN

  if ( PyInt_Check ( r ) )
  { sc = PyInt_AS_LONG( r ) ; Py_DECREF( r ) ; return sc ; } // RETURN

  // look for the method getCode with the signature:
  //  ' int getCode() '
  PyObject* c = PyObject_CallMethod(r, chr("getCode"), chr(""));

  if      ( 0 == c           ) {      PyErr_Print()      ; }
  else if ( PyLong_Check( c )) { sc = PyLong_AsLong( c ); }
  else
  {
    std::string msg( " call_python_method unexpected type from '" );
    msg += method ;
    msg += "().getCode()' " ;
    PyErr_SetString( PyExc_TypeError , msg.c_str() ) ;
    PyErr_Print() ;
  }
  // release used objects
  Py_XDECREF( c ) ;
  Py_XDECREF( r ) ;
  //
  return sc;
}
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.

{
  if ( 0 == self || 0 == method ) { return 1 ; }
  PyObject* r = PyObject_CallMethod(self, const_cast<char*>(method),
                                          const_cast<char*>("s"), buf);
  if ( 0 == r ) {
    string err("Unsuccessful call to bound Python method");
    err += method;
    PyErr_SetString( PyExc_TypeError , err.c_str() ) ;
    PyErr_Print() ;
    return 1 ;
  }
  Py_DECREF( r );
  return 0 ;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Tue May 10 2011 18:55:35 for Gaudi Framework, version v22r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004