Hijacks all messages with given level and topic (and optionally object name) while alive.
Use this like an ostringstream afterwards. The messages can e.g. be retrieved using str()
. Useful for unit tests / debugging.
Definition at line 65 of file RooHelpers.h.
Public Member Functions | |
HijackMessageStream (RooFit::MsgLevel level, RooFit::MsgTopic topics, const char *objectName=nullptr) | |
Hijack all messages with given level and topics while this object is alive. | |
~HijackMessageStream () | |
Deregister the hijacked stream and restore the stream state of all previous streams. | |
template<typename T > | |
const HijackMessageStream & | operator<< (const T &v) const |
std::string | str () |
std::ostringstream & | stream () |
Private Attributes | |
std::vector< RooMsgService::StreamConfig > | _oldConf |
RooFit::MsgLevel | _oldKillBelow |
std::ostringstream | _str |
Int_t | _thisStream |
#include <RooHelpers.h>
RooHelpers::HijackMessageStream::HijackMessageStream | ( | RooFit::MsgLevel | level, |
RooFit::MsgTopic | topics, | ||
const char * | objectName = nullptr |
||
) |
Hijack all messages with given level and topics while this object is alive.
[in] | level | Minimum level to hijack. Higher levels also get captured. |
[in] | topics | Topics to hijack. Use | to combine different topics, and cast to RooFit::MsgTopic if necessary. |
[in] | objectName | Only hijack messages from an object with the given name. Defaults to any object. |
Definition at line 72 of file RooHelpers.cxx.
RooHelpers::HijackMessageStream::~HijackMessageStream | ( | ) |
Deregister the hijacked stream and restore the stream state of all previous streams.
Definition at line 99 of file RooHelpers.cxx.
|
inline |
Definition at line 69 of file RooHelpers.h.
|
inline |
Definition at line 74 of file RooHelpers.h.
|
inline |
Definition at line 75 of file RooHelpers.h.
|
private |
Definition at line 81 of file RooHelpers.h.
|
private |
Definition at line 80 of file RooHelpers.h.
|
private |
Definition at line 79 of file RooHelpers.h.
|
private |
Definition at line 82 of file RooHelpers.h.