|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
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< Row > | Matrix |
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 | |
GaudiPython.h GaudiPython/GaudiPython.h.
Namespace for all classes interfacing Gaudi to Python.
The general namespace to hide all Gaudi-python related classes
| typedef std::vector<Row> GaudiPython::Matrix |
| typedef Vector GaudiPython::Row |
| typedef std::vector<double> GaudiPython::Vector |
| 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 }