Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooHelpers::HijackMessageStream Class Reference

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 74 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 HijackMessageStreamoperator<< (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>

Constructor & Destructor Documentation

◆ HijackMessageStream()

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.

Parameters
[in]levelMinimum level to hijack. Higher levels also get captured.
[in]topicsTopics to hijack. Use | to combine different topics, and cast to RooFit::MsgTopic if necessary.
[in]objectNameOnly hijack messages from an object with the given name. Defaults to any object.

Definition at line 71 of file RooHelpers.cxx.

◆ ~HijackMessageStream()

RooHelpers::HijackMessageStream::~HijackMessageStream ( )

Deregister the hijacked stream and restore the stream state of all previous streams.

Definition at line 104 of file RooHelpers.cxx.

Member Function Documentation

◆ operator<<()

template<typename T >
const HijackMessageStream & RooHelpers::HijackMessageStream::operator<< ( const T &  v) const
inline

Definition at line 78 of file RooHelpers.h.

◆ str()

std::string RooHelpers::HijackMessageStream::str ( )
inline

Definition at line 82 of file RooHelpers.h.

◆ stream()

std::ostringstream & RooHelpers::HijackMessageStream::stream ( )
inline

Definition at line 83 of file RooHelpers.h.

Member Data Documentation

◆ _oldConf

std::vector<RooMsgService::StreamConfig> RooHelpers::HijackMessageStream::_oldConf
private

Definition at line 89 of file RooHelpers.h.

◆ _oldKillBelow

RooFit::MsgLevel RooHelpers::HijackMessageStream::_oldKillBelow
private

Definition at line 88 of file RooHelpers.h.

◆ _str

std::ostringstream RooHelpers::HijackMessageStream::_str
private

Definition at line 87 of file RooHelpers.h.

◆ _thisStream

Int_t RooHelpers::HijackMessageStream::_thisStream
private

Definition at line 90 of file RooHelpers.h.

Libraries for RooHelpers::HijackMessageStream:

The documentation for this class was generated from the following files: