8 #include "GaudiKernel/Bootstrap.h"
12 #include "GaudiPython/Algorithm.h"
22 inline char *chr(
const char*
c){
return const_cast<char*
>(
c); }
29 ( PyObject*
self,
const char* method )
36 PyObject* r = PyObject_CallMethod(
self, chr(method),
nullptr );
38 if ( !r ) { PyErr_Print() ;
return sc ; }
40 if ( PyInt_Check ( r ) )
41 { sc = PyInt_AS_LONG( r ) ; Py_DECREF( r ) ;
return sc ; }
45 PyObject*
c = PyObject_CallMethod(r, chr(
"getCode"),
nullptr);
47 if ( !c ) { PyErr_Print() ; }
48 else if ( PyLong_Check( c )) { sc = PyLong_AsLong( c ); }
51 std::string
msg(
" call_python_method unexpected type from '" );
53 msg +=
"().getCode()' " ;
54 PyErr_SetString( PyExc_TypeError ,
msg.c_str() ) ;
73 const std::string&
name )
PyAlgorithm(PyObject *self, const std::string &name)
constructor
GAUDI_API ISvcLocator * svcLocator()
This class is used for returning status codes from appropriate routines.
GAUDI_API StatusCode call_python_method(PyObject *self, const char *method)
call the python method
Base class from which all concrete algorithm classes should be derived.