The Gaudi Framework  v30r3 (a5ef0a68)
CommonMessaging< BASE > Class Template Reference

#include <GaudiKernel/CommonMessaging.h>

Inheritance diagram for CommonMessaging< BASE >:
Collaboration diagram for CommonMessaging< BASE >:

Public Types

using base_class = CommonMessaging
 

Public Member Functions

MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Protected Member Functions

MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Private Member Functions

void create_msgStream () const override final
 cold functionality More...
 
void initMessaging () const
 Initialise the messaging objects. More...
 

Detailed Description

template<typename BASE>
class CommonMessaging< BASE >

Definition at line 57 of file CommonMessaging.h.

Member Typedef Documentation

template<typename BASE>
using CommonMessaging< BASE >::base_class = CommonMessaging

Definition at line 136 of file CommonMessaging.h.

Member Function Documentation

template<typename BASE>
void CommonMessaging< BASE >::create_msgStream ( ) const
inlinefinaloverrideprivatevirtual

cold functionality

Implements CommonMessagingBase.

Definition at line 159 of file CommonMessaging.h.

159 { m_msgStream.reset( new MsgStream( msgSvc(), this->name() ) ); }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
boost::thread_specific_ptr< MsgStream > m_msgStream
The predefined message stream.
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
template<typename BASE>
void CommonMessaging< BASE >::initMessaging ( ) const
inlineprivate

Initialise the messaging objects.

Definition at line 162 of file CommonMessaging.h.

163  {
164  if ( !m_msgsvc ) {
165  // Get default implementation of the message service.
166  m_msgsvc = this->serviceLocator();
167  }
169  m_level = MSG::Level( m_msgStream.get() ? m_msgStream->level() : MSG::NIL );
170  // if we could not get a MessageSvc, we should try again the initial set up
172  }
SmartIF< IMessageSvc > m_msgsvc
Pointer to the message service;.
boost::thread_specific_ptr< MsgStream > m_msgStream
The predefined message stream.
void create_msgStream() const override final
cold functionality
template<typename BASE>
MSG::Level CommonMessaging< BASE >::msgLevel ( ) const
inline

get the cached level (originally extracted from the embedded MsgStream)

Definition at line 142 of file CommonMessaging.h.

143  {
144  if ( LIKELY( m_commonMessagingReady ) ) return m_level;
145  return setUpMessaging();
146  }
MSG::Level setUpMessaging() const
Set up local caches.
#define LIKELY(x)
Definition: Kernel.h:121
template<typename BASE>
bool CommonMessaging< BASE >::msgLevel ( MSG::Level  lvl) const
inline

get the output level from the embedded MsgStream

Definition at line 155 of file CommonMessaging.h.

155 { return UNLIKELY( msgLevel() <= lvl ); }
#define UNLIKELY(x)
Definition: Kernel.h:122
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
template<typename BASE>
MSG::Level CommonMessaging< BASE >::outputLevel ( ) const
inline

Backward compatibility function for getting the output level.

Definition at line 149 of file CommonMessaging.h.

150  {
151  return msgLevel();
152  }
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
template<typename BASE>
MSG::Level CommonMessaging< BASE >::resetMessaging ( )
inlineprotected

Reinitialize internal states.

Definition at line 184 of file CommonMessaging.h.

185  {
186  m_commonMessagingReady = false;
187  return setUpMessaging();
188  }
MSG::Level setUpMessaging() const
Set up local caches.
template<typename BASE>
MSG::Level CommonMessaging< BASE >::setUpMessaging ( ) const
inlineprotected

Set up local caches.

Definition at line 176 of file CommonMessaging.h.

177  {
178  if ( UNLIKELY( !m_commonMessagingReady ) ) {
179  initMessaging();
180  }
181  return m_level;
182  }
#define UNLIKELY(x)
Definition: Kernel.h:122
void initMessaging() const
Initialise the messaging objects.
template<typename BASE>
void CommonMessaging< BASE >::updateMsgStreamOutputLevel ( int  level)
inlineprotected

Update the output level of the cached MsgStream.

This function is meant to be called by the update handler of the OutputLevel property.

Definition at line 191 of file CommonMessaging.h.

192  {
193  setUpMessaging();
194  if ( level != MSG::NIL && level != m_level ) {
195  if ( msgSvc() ) msgSvc()->setOutputLevel( this->name(), level );
196  if ( m_msgStream.get() ) m_msgStream->setLevel( level );
197  if ( UNLIKELY( MSG::Level( level ) <= MSG::DEBUG ) )
198  debug() << "Property update for OutputLevel : new value = " << level << endmsg;
199  m_level = MSG::Level( level );
200  }
201  }
#define UNLIKELY(x)
Definition: Kernel.h:122
MSG::Level setUpMessaging() const
Set up local caches.
boost::thread_specific_ptr< MsgStream > m_msgStream
The predefined message stream.
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
virtual void setOutputLevel(int new_level)=0
Set new global output level threshold.

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