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 "
ers/ers.hpp
"
5
#include <QCoreApplication>
6
#include <QEvent>
7
#include <QMutex>
8
#include <QMutexLocker>
9
#include <QTextEdit>
10
#include <iostream>
11
#include <streambuf>
12
#include <string>
13
namespace
daq
{
14
namespace
QTUtils
{
15
27
class
QDebugStream
28
:
public
QObject
29
,
public
std::basic_streambuf<char>
30
{
31
Q_OBJECT
32
public
:
35
QDebugStream
(std::ostream& stream, QTextEdit* text_edit)
36
:
m_stream
(stream)
37
{
38
m_mutex
=
new
QMutex();
39
log_window
= text_edit;
40
m_old_buf
= stream.rdbuf();
41
stream.rdbuf(
this
);
42
}
43
~QDebugStream
()
44
{
45
// output anything that is left
46
if
(!
m_string
.empty())
47
log_window
->append(
m_string
.c_str());
48
49
m_stream
.rdbuf(
m_old_buf
);
50
delete
m_mutex
;
51
}
52
53
protected
:
54
virtual
int_type
overflow
(int_type v);
55
virtual
std::streamsize
xsputn
(
const
char
* p, std::streamsize n);
56
virtual
bool
event
(QEvent*
event
);
57
58
private
:
59
std::ostream&
m_stream
;
60
std::streambuf*
m_old_buf
;
61
std::string
m_string
;
62
QTextEdit*
log_window
;
63
QMutex*
m_mutex
;
64
QString
m_text
;
65
};
66
}
67
}
68
#endif
/*QTEXTEDIT_H_*/
daq::QTUtils::QDebugStream::m_string
std::string m_string
Definition
qdebugstream.hpp:61
daq::QTUtils::QDebugStream::event
virtual bool event(QEvent *event)
Definition
qdebugstream.cpp:23
daq::QTUtils::QDebugStream::m_stream
std::ostream & m_stream
Definition
qdebugstream.hpp:59
daq::QTUtils::QDebugStream::log_window
QTextEdit * log_window
Definition
qdebugstream.hpp:62
daq::QTUtils::QDebugStream::m_text
QString m_text
Definition
qdebugstream.hpp:64
daq::QTUtils::QDebugStream::m_old_buf
std::streambuf * m_old_buf
Definition
qdebugstream.hpp:60
daq::QTUtils::QDebugStream::m_mutex
QMutex * m_mutex
Definition
qdebugstream.hpp:63
daq::QTUtils::QDebugStream::xsputn
virtual std::streamsize xsputn(const char *p, std::streamsize n)
Definition
qdebugstream.cpp:5
daq::QTUtils::QDebugStream::QDebugStream
QDebugStream(std::ostream &stream, QTextEdit *text_edit)
Definition
qdebugstream.hpp:35
daq::QTUtils::QDebugStream::~QDebugStream
~QDebugStream()
Definition
qdebugstream.hpp:43
daq::QTUtils::QDebugStream::overflow
virtual int_type overflow(int_type v)
Definition
qdebugstream.cpp:39
ers.hpp
daq::QTUtils
Definition
FilterTextEdit.hpp:11
daq
Including ers headers.
Definition
config_api_graph.hpp:23
Generated on
for DUNE-DAQ by
1.18.0