GaudiPython.h GaudiPython/GaudiPython.h.
More...
|
typedef std::vector< double > | Vector |
| useful type definition for implicit loos
|
|
typedef Vector | Row |
|
typedef std::vector< Row > | Matrix |
|
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
◆ Matrix
◆ Row
◆ Vector
useful type definition for implicit loos
Definition at line 27 of file Vector.h.
◆ call_python_method() [1/2]
StatusCode GaudiPython::call_python_method |
( |
PyObject * | self, |
|
|
const char * | method ) |
call the python method
Definition at line 48 of file Algorithm.cpp.
48 {
50
52
53
54 PyObject* r = PyObject_CallMethod(
self, chr( method ),
nullptr );
55
56 if ( !r ) {
57 PyErr_Print();
58 return sc;
59 }
60
61 if ( PyInt_Check( r ) ) {
62 sc = StatusCode( PyInt_AS_LONG( r ) );
63 Py_DECREF( r );
64 return sc;
65 }
66
67
68
69 PyObject*
c = PyObject_CallMethod( r, chr(
"getCode" ),
nullptr );
70
71 if ( !c ) {
72 PyErr_Print();
73 } else if ( PyLong_Check( c ) ) {
74 sc = StatusCode( PyLong_AsLong( c ) );
75 } else {
76 std::string
msg(
" call_python_method unexpected type from '" );
78 msg +=
"().getCode()' ";
79 PyErr_SetString( PyExc_TypeError,
msg.c_str() );
80 PyErr_Print();
81 }
82
83 Py_XDECREF( c );
84 Py_XDECREF( r );
85
86 return sc;
87}
This class is used for returning status codes from appropriate routines.
constexpr static const auto FAILURE
◆ call_python_method() [2/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 22 of file CallbackStreamBuf.cpp.
22 {
23 if ( !
self || !method ) {
return 1; }
24 PyObject* r = PyObject_CallMethod(
self,
const_cast<char*
>( method ),
const_cast<char*
>(
"s" ), buf );
25 if ( !r ) {
26 std::string err( "Unsuccessful call to bound Python method" );
27 err += method;
28 PyErr_SetString( PyExc_TypeError, err.c_str() );
29 PyErr_Print();
30 return 1;
31 }
32 Py_DECREF( r );
33 return 0;
34}