GaudiPython.h GaudiPython/GaudiPython.h.
More...
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
useful type definition for implicit loos
Definition at line 21 of file Vector.h.
| 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.
{
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 ;
}
| StatusCode GaudiPython::call_python_method |
( |
PyObject * |
self, |
|
|
const char * |
method |
|
) |
| |
call the python method
Definition at line 30 of file Algorithm.cpp.
{
PyObject* r = PyObject_CallMethod(self, chr(method), chr(""));
if ( 0 == r ) { PyErr_Print() ;
return sc ; }
if ( PyInt_Check ( r ) )
{ sc = PyInt_AS_LONG( r ) ; Py_DECREF( r ) ;
return sc ; }
PyObject*
c = PyObject_CallMethod(r, chr(
"getCode"), chr(
""));
if ( 0 == c ) { PyErr_Print() ; }
else if ( PyLong_Check( c )) { sc = PyLong_AsLong( c ); }
else
{
msg +=
"().getCode()' " ;
PyErr_SetString( PyExc_TypeError ,
msg.c_str() ) ;
PyErr_Print() ;
}
Py_XDECREF( c ) ;
Py_XDECREF( r ) ;
}