DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
dbe
include
dbe
qdebugstream.hpp
Go to the documentation of this file.
1
#ifndef QDEBUGSTREAM_H_
2
#define QDEBUGSTREAM_H_
3
4
#include <iostream>
5
#include <streambuf>
6
#include <string>
7
#include "
ers/ers.hpp
"
8
#include <QTextEdit>
9
#include <QMutexLocker>
10
#include <QMutex>
11
#include <QEvent>
12
#include <QCoreApplication>
13
namespace
daq
{
14
namespace
QTUtils
{
15
27
class
QDebugStream
:
public
QObject,
public
std::basic_streambuf<char> {
28
Q_OBJECT
29
public
:
30
33
QDebugStream
(std::ostream &stream, QTextEdit* text_edit) :
34
m_stream
(stream) {
35
m_mutex
=
new
QMutex();
36
log_window
= text_edit;
37
m_old_buf
= stream.rdbuf();
38
stream.rdbuf(
this
);
39
}
40
~QDebugStream
() {
41
// output anything that is left
42
if
(!
m_string
.empty())
43
log_window
->append(
m_string
.c_str());
44
45
m_stream
.rdbuf(
m_old_buf
);
46
delete
m_mutex
;
47
}
48
49
protected
:
50
virtual
int_type
overflow
(int_type v);
51
virtual
std::streamsize
xsputn
(
const
char
*p, std::streamsize n);
52
virtual
bool
event
(QEvent*
event
);
53
private
:
54
std::ostream &
m_stream
;
55
std::streambuf *
m_old_buf
;
56
std::string
m_string
;
57
QTextEdit*
log_window
;
58
QMutex *
m_mutex
;
59
QString
m_text
;
60
};
61
}
62
}
63
#endif
/*QTEXTEDIT_H_*/
daq::QTUtils::QDebugStream::m_string
std::string m_string
Definition
qdebugstream.hpp:56
daq::QTUtils::QDebugStream::event
virtual bool event(QEvent *event)
Definition
qdebugstream.cpp:20
daq::QTUtils::QDebugStream::m_stream
std::ostream & m_stream
Definition
qdebugstream.hpp:54
daq::QTUtils::QDebugStream::log_window
QTextEdit * log_window
Definition
qdebugstream.hpp:57
daq::QTUtils::QDebugStream::m_text
QString m_text
Definition
qdebugstream.hpp:59
daq::QTUtils::QDebugStream::m_old_buf
std::streambuf * m_old_buf
Definition
qdebugstream.hpp:55
daq::QTUtils::QDebugStream::m_mutex
QMutex * m_mutex
Definition
qdebugstream.hpp:58
daq::QTUtils::QDebugStream::xsputn
virtual std::streamsize xsputn(const char *p, std::streamsize n)
Definition
qdebugstream.cpp:4
daq::QTUtils::QDebugStream::QDebugStream
QDebugStream(std::ostream &stream, QTextEdit *text_edit)
Definition
qdebugstream.hpp:33
daq::QTUtils::QDebugStream::~QDebugStream
~QDebugStream()
Definition
qdebugstream.hpp:40
daq::QTUtils::QDebugStream::overflow
virtual int_type overflow(int_type v)
Definition
qdebugstream.cpp:34
ers.hpp
daq::QTUtils
Definition
FilterTextEdit.hpp:11
daq
Including ers headers.
Definition
config_api_graph.hpp:24
Generated on
for DUNE-DAQ by
1.17.0