| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

CallbackStreamBuf.h
Go to the documentation of this file.
1 #ifndef GAUDIPYTHON_CALLBACKSTREAMBUF_H
2 #define GAUDIPYTHON_CALLBACKSTREAMBUF_H
3 // ============================================================================
4 #include "Python.h" //included for the python API
5 // ============================================================================
6 #include <array>
7 #include <sstream> //included for stringbuf
8 // ============================================================================
9 #include "GaudiKernel/Kernel.h"
10 #include "GaudiPython/GaudiPython.h"
11 // ============================================================================
12
13 namespace GaudiPython
14 {
15 int GAUDI_API call_python_method( PyObject* self, const char* method, char* buf );
16
17 class GAUDI_API CallbackStreamBuf : public std::stringbuf
18 {
19 private:
20 class PyObject_t
21 {
22 PyObject* m_obj;
23
24 public:
25 PyObject_t( PyObject* obj = nullptr ) : m_obj( obj )
26 {
27 if ( m_obj ) Py_INCREF( m_obj );
28 }
29 ~PyObject_t()
30 {
31 if ( m_obj ) Py_DECREF( m_obj );
32 }
33 PyObject* get() { return m_obj; }
34 };
35 PyObject_t m_self;
36 std::array<char, 512> m_callbackBuff; // used for passing the flushed chars in the python callback
37
38 public:
39 CallbackStreamBuf( PyObject* self );
40 int sync() override;
41 };
42 }
43
44 #endif
GaudiPython::CallbackStreamBuf::PyObject_t::PyObject_t
PyObject_t(PyObject *obj=nullptr)
Definition: CallbackStreamBuf.h:25
Kernel.h
std::stringbuf
GaudiPython::CallbackStreamBuf::m_self
PyObject_t m_self
Definition: CallbackStreamBuf.h:35
GaudiPython::CallbackStreamBuf::PyObject_t::m_obj
PyObject * m_obj
Definition: CallbackStreamBuf.h:22
GaudiPython::CallbackStreamBuf::m_callbackBuff
std::array< char, 512 > m_callbackBuff
Definition: CallbackStreamBuf.h:36
GaudiPython::CallbackStreamBuf::PyObject_t::~PyObject_t
~PyObject_t()
Definition: CallbackStreamBuf.h:29
GaudiPython.h
GaudiPython
GaudiPython.h GaudiPython/GaudiPython.h.
Definition: AlgDecorators.h:37
GaudiPython::CallbackStreamBuf::PyObject_t
Definition: CallbackStreamBuf.h:20
std::array< char, 512 >
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
GaudiPython::CallbackStreamBuf
Definition: CallbackStreamBuf.h:17
GaudiPython::call_python_method
GAUDI_API StatusCode call_python_method(PyObject *self, const char *method)
call the python method
Definition: Algorithm.cpp:29