The Gaudi Framework
master (9f3f8895)
Toggle main menu visibility
Loading...
Searching...
No Matches
CallbackStreamBuf.h
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\***********************************************************************************/
11
#pragma once
12
// ============================================================================
13
#include <Python.h>
//included for the python API
14
// ============================================================================
15
#include <array>
16
#include <sstream>
//included for stringbuf
17
// ============================================================================
18
#include <
GaudiKernel/Kernel.h
>
19
#include <
GaudiPython/GaudiPython.h
>
20
// ============================================================================
21
22
namespace
GaudiPython
{
23
int
GAUDI_API
call_python_method
( PyObject*
self
,
const
char
* method,
char
* buf );
24
25
class
GAUDI_API
CallbackStreamBuf
:
public
std::stringbuf {
26
private
:
27
class
PyObject_t
{
28
PyObject*
m_obj
;
29
30
public
:
31
PyObject_t
( PyObject* obj =
nullptr
) :
m_obj
( obj ) {
32
if
(
m_obj
) Py_INCREF(
m_obj
);
33
}
34
~PyObject_t
() {
35
if
(
m_obj
) Py_DECREF(
m_obj
);
36
}
37
PyObject*
get
() {
return
m_obj
; }
38
};
39
PyObject_t
m_self
;
40
std::array<char, 512>
m_callbackBuff
;
// used for passing the flushed chars in the python callback
41
42
public
:
43
CallbackStreamBuf
( PyObject*
self
);
44
int
sync
()
override
;
45
};
46
}
// namespace GaudiPython
GaudiPython.h
Kernel.h
GAUDI_API
#define GAUDI_API
Definition
Kernel.h:49
GaudiPython::CallbackStreamBuf::PyObject_t
Definition
CallbackStreamBuf.h:27
GaudiPython::CallbackStreamBuf::PyObject_t::~PyObject_t
~PyObject_t()
Definition
CallbackStreamBuf.h:34
GaudiPython::CallbackStreamBuf::PyObject_t::m_obj
PyObject * m_obj
Definition
CallbackStreamBuf.h:28
GaudiPython::CallbackStreamBuf::PyObject_t::PyObject_t
PyObject_t(PyObject *obj=nullptr)
Definition
CallbackStreamBuf.h:31
GaudiPython::CallbackStreamBuf::PyObject_t::get
PyObject * get()
Definition
CallbackStreamBuf.h:37
GaudiPython::CallbackStreamBuf::sync
int sync() override
reimplementation of stringbuf::sync()
Definition
CallbackStreamBuf.cpp:45
GaudiPython::CallbackStreamBuf::m_self
PyObject_t m_self
Definition
CallbackStreamBuf.h:39
GaudiPython::CallbackStreamBuf::m_callbackBuff
std::array< char, 512 > m_callbackBuff
Definition
CallbackStreamBuf.h:40
GaudiPython::CallbackStreamBuf::CallbackStreamBuf
CallbackStreamBuf(PyObject *self)
CallbackStreamBuf constructor.
Definition
CallbackStreamBuf.cpp:40
GaudiPython.Pythonizations.self
self
Definition
Pythonizations.py:554
GaudiPython
GaudiPython.h GaudiPython/GaudiPython.h.
Definition
Algorithm.h:29
GaudiPython::call_python_method
GAUDI_API StatusCode call_python_method(PyObject *self, const char *method)
call the python method
Definition
Algorithm.cpp:48
GaudiPython
include
GaudiPython
CallbackStreamBuf.h
Generated on
for The Gaudi Framework by
1.17.0