ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConf::MsgStreamTC Class Reference

MsgStreamTC class to be used in TrigConf equivalent to Gaudi's MsgStream. More...

#include <MsgStream.h>

Inheritance diagram for TrigConf::MsgStreamTC:
Collaboration diagram for TrigConf::MsgStreamTC:

Public Member Functions

 MsgStreamTC (const std::string &name)
MSGTC::Level level ()
 Return message level of stream.
void setLevel (MSGTC::Level lvl)
 Set message level of stream.
void setWidth (unsigned int width)
MsgStreamTCoperator<< (MSGTC::Level lvl)
 Output operator for message levels.
template<typename T>
MsgStreamTCoperator<< (const T &t)
 Output operator for default types.
MsgStreamTCoperator<< (std::ios &(*f)(std::ios &))
 Output operator for stream modifiers.
MsgStreamTCoperator<< (std::ostream &(*f)(std::ostream &))
 Output operator to support endl, etc.
MsgStreamTCoperator<< (MsgStreamTC &(*f)(MsgStreamTC &))
 Output operator to support endmsg, etc.
void doOutput ()
 Print the current message buffer.
bool isActive ()
 Is the stream active?
void setName (const std::string &name)
 set the name if you want to change the message stream name

Private Attributes

bool m_active
 stream active?
MSGTC::Level m_level
 stream level
MSGTC::Level m_msgLevel
 current message level
std::string m_name
 stream name
unsigned int m_width { 30 }
 width for printing owner name

Detailed Description

MsgStreamTC class to be used in TrigConf equivalent to Gaudi's MsgStream.

The usage and behavior is identical to the default Gaudi message stream. If the code is run within a Gaudi/Athena environment, the MsgStreamTC will try to print its messages via the Gaudi MessageSvc. This is achieved via weak linking. In a non-Gaudi/Athena environment std::cout will be used. The class can be used directly or better via inheriting from TrigConf::TrigConfMessaging, which is the equivalent of AthMessaging.

Main difference to Gaudi MsgStream:

  • OutputLevel cannot be configued via job options, instead the global OutputLevel of the MessageSvc is being used

Definition at line 48 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

Constructor & Destructor Documentation

◆ MsgStreamTC()

MsgStreamTC::MsgStreamTC ( const std::string & name)

Member Function Documentation

◆ doOutput()

void MsgStreamTC::doOutput ( )

Print the current message buffer.

Definition at line 60 of file Trigger/TrigConfiguration/TrigConfBase/Root/MsgStream.cxx.

61{
62 if (getMessageSvc()) {
64 }
65 else {
66 std::ios::fmtflags f( std::cout.flags() );
67 std::cout << std::setw(m_width) << std::left << m_name << " " << levelNames[m_msgLevel] << " " << str() << std::endl;
68 std::cout.flags(f);
69 }
70 str(""); // Clear our buffer after message has been printed
71}
static const std::string levelNames[MSG::NUM_LEVELS]
void reportMessage(IMessageSvc *ims, const std::string &source, int type, const std::string &message)
Wrappers for some of the IMessageSvc methods These can be used from libraries without explicit Gaudi ...

◆ isActive()

bool TrigConf::MsgStreamTC::isActive ( )
inline

Is the stream active?

Definition at line 99 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

99{ return m_active; }

◆ level()

MSGTC::Level TrigConf::MsgStreamTC::level ( )
inline

Return message level of stream.

Definition at line 53 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

53{return m_level;}

◆ operator<<() [1/5]

template<typename T>
MsgStreamTC & TrigConf::MsgStreamTC::operator<< ( const T & t)
inline

Output operator for default types.

Definition at line 72 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

72 {
73 if (m_active) *static_cast<std::ostringstream*>(this) << t;
74 return *this;
75 }

◆ operator<<() [2/5]

MsgStreamTC & TrigConf::MsgStreamTC::operator<< ( MsgStreamTC &(* )(MsgStreamTC &))
inline

Output operator to support endmsg, etc.

Definition at line 90 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

90 {
91 if (m_active) f(*this);
92 return *this;
93 }

◆ operator<<() [3/5]

MsgStreamTC & TrigConf::MsgStreamTC::operator<< ( MSGTC::Level lvl)
inline

Output operator for message levels.

Definition at line 64 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

◆ operator<<() [4/5]

MsgStreamTC & TrigConf::MsgStreamTC::operator<< ( std::ios &(* )(std::ios &))
inline

Output operator for stream modifiers.

Definition at line 78 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

78 {
79 if (m_active) f(*this);
80 return *this;
81 }

◆ operator<<() [5/5]

MsgStreamTC & TrigConf::MsgStreamTC::operator<< ( std::ostream &(* )(std::ostream &))
inline

Output operator to support endl, etc.

Definition at line 84 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

84 {
85 if (m_active) f(*this);
86 return *this;
87 }

◆ setLevel()

void MsgStreamTC::setLevel ( MSGTC::Level lvl)

Set message level of stream.

Definition at line 52 of file Trigger/TrigConfiguration/TrigConfBase/Root/MsgStream.cxx.

52 {
53 lvl = (lvl >= MSGTC::NUM_LEVELS) ? MSGTC::ALWAYS : (lvl<MSGTC::NIL) ? MSGTC::NIL : lvl;
54 m_level = lvl;
55 if (getMessageSvc()) {
57 }
58}
void setOutputLevel(IMessageSvc *ims, const std::string &source, int level)

◆ setName()

void TrigConf::MsgStreamTC::setName ( const std::string & name)
inline

set the name if you want to change the message stream name

Definition at line 102 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

◆ setWidth()

void TrigConf::MsgStreamTC::setWidth ( unsigned int width)
inline

Definition at line 59 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

59 {
60 m_width = width;
61 }
const double width

Member Data Documentation

◆ m_active

bool TrigConf::MsgStreamTC::m_active
private

stream active?

Definition at line 105 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

◆ m_level

MSGTC::Level TrigConf::MsgStreamTC::m_level
private

stream level

Definition at line 106 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

◆ m_msgLevel

MSGTC::Level TrigConf::MsgStreamTC::m_msgLevel
private

current message level

Definition at line 107 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

◆ m_name

std::string TrigConf::MsgStreamTC::m_name
private

◆ m_width

unsigned int TrigConf::MsgStreamTC::m_width { 30 }
private

width for printing owner name

Definition at line 109 of file Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h.

109{ 30 };

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