The Gaudi Framework  v32r2 (46d42edc)
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

◆ Matrix

Definition at line 20 of file Vector.h.

◆ Row

Definition at line 19 of file Vector.h.

◆ Vector

useful type definition for implicit loos

Definition at line 18 of file Vector.h.

Function Documentation

◆ call_python_method() [1/2]

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

12  {
13  if ( !self || !method ) { return 1; }
14  PyObject* r = PyObject_CallMethod( self, const_cast<char*>( method ), const_cast<char*>( "s" ), buf );
15  if ( !r ) {
16  std::string err( "Unsuccessful call to bound Python method" );
17  err += method;
18  PyErr_SetString( PyExc_TypeError, err.c_str() );
19  PyErr_Print();
20  return 1;
21  }
22  Py_DECREF( r );
23  return 0;
24 }
STL class.

◆ call_python_method() [2/2]

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

call the python method

Definition at line 38 of file Algorithm.cpp.

38  {
40  // check arguments
41  if ( !self || !method ) { return StatusCode::FAILURE; }
42 
43  // call Python
44  PyObject* r = PyObject_CallMethod( self, chr( method ), nullptr );
45 
46  if ( !r ) {
47  PyErr_Print();
48  return sc;
49  } // RETURN
50 
51  if ( PyInt_Check( r ) ) {
52  sc = StatusCode( PyInt_AS_LONG( r ) );
53  Py_DECREF( r );
54  return sc;
55  } // RETURN
56 
57  // look for the method getCode with the signature:
58  // ' int getCode() '
59  PyObject* c = PyObject_CallMethod( r, chr( "getCode" ), nullptr );
60 
61  if ( !c ) {
62  PyErr_Print();
63  } else if ( PyLong_Check( c ) ) {
64  sc = StatusCode( PyLong_AsLong( c ) );
65  } else {
66  std::string msg( " call_python_method unexpected type from '" );
67  msg += method;
68  msg += "().getCode()' ";
69  PyErr_SetString( PyExc_TypeError, msg.c_str() );
70  PyErr_Print();
71  }
72  // release used objects
73  Py_XDECREF( c );
74  Py_XDECREF( r );
75  //
76  return sc;
77 }
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
constexpr static const auto FAILURE
Definition: StatusCode.h:86