CommonMessaging< BASE > Class Template Referenceabstract

Templated class to add the standard messaging functionalities. More...

#include </scratch/z5/marcocle/GaudiDocs/lhcb-release/825/GAUDI/GAUDI_v26r3/InstallArea/x86_64-slc6-gcc48-opt/include/GaudiKernel/CommonMessaging.h>

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

Public Types

typedef CommonMessaging base_class
 
typedef CommonMessaging base_class
 

Public Member Functions

template<typename A1 , typename A2 , typename A3 >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
template<typename A1 , typename A2 >
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
template<typename A1 >
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
virtual SmartIF< ISvcLocator > & serviceLocator () const =0
 Needed to locate the message service. More...
 
virtual const std::string & name () const =0
 This is needed to avoid ambiguous calls to name() More...
 
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...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
template<typename A1 , typename A2 , typename A3 >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
template<typename A1 , typename A2 >
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
template<typename A1 >
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
virtual SmartIF< ISvcLocator > & serviceLocator () const =0
 Needed to locate the message service. More...
 
virtual const std::string & name () const =0
 This is needed to avoid ambiguous calls to name() More...
 
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...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 

Protected Member Functions

void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Detailed Description

template<class BASE>
class CommonMessaging< BASE >

Templated class to add the standard messaging functionalities.

Definition at line 23 of file CommonMessaging.h.

Member Typedef Documentation

template<class BASE>
typedef CommonMessaging CommonMessaging< BASE >::base_class

Definition at line 25 of file CommonMessaging.h.

template<class BASE>
typedef CommonMessaging CommonMessaging< BASE >::base_class

Definition at line 25 of file CommonMessaging.h.

Constructor & Destructor Documentation

template<class BASE>
template<typename A1 , typename A2 , typename A3 >
CommonMessaging< BASE >::CommonMessaging ( const A1 &  a1,
const A2 &  a2,
const A3 &  a3 
)
inline

Templated constructor with 3 arguments.

Definition at line 28 of file CommonMessaging.h.

28  :
29  BASE(a1,a2,a3), m_streamWithService(false) {}
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
template<class BASE>
template<typename A1 , typename A2 >
CommonMessaging< BASE >::CommonMessaging ( const A1 &  a1,
const A2 &  a2 
)
inline

Templated constructor with 2 arguments.

Definition at line 31 of file CommonMessaging.h.

31  :
32  BASE(a1, a2), m_streamWithService(false) {}
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
template<class BASE>
template<typename A1 >
CommonMessaging< BASE >::CommonMessaging ( const A1 &  a1)
inline

Templated constructor with 1 argument.

Definition at line 34 of file CommonMessaging.h.

34  :
35  BASE(a1), m_streamWithService(false) {}
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
template<class BASE>
CommonMessaging< BASE >::CommonMessaging ( )
inline

Default constructor.

Definition at line 37 of file CommonMessaging.h.

37  :
38  BASE(), m_streamWithService(false) {}
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
template<class BASE>
virtual CommonMessaging< BASE >::~CommonMessaging ( )
inlinevirtual

Virtual destructor.

Definition at line 41 of file CommonMessaging.h.

41 {}
template<class BASE>
template<typename A1 , typename A2 , typename A3 >
CommonMessaging< BASE >::CommonMessaging ( const A1 &  a1,
const A2 &  a2,
const A3 &  a3 
)
inline

Templated constructor with 3 arguments.

Definition at line 28 of file CommonMessaging.h.

28  :
29  BASE(a1,a2,a3), m_streamWithService(false) {}
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
template<class BASE>
template<typename A1 , typename A2 >
CommonMessaging< BASE >::CommonMessaging ( const A1 &  a1,
const A2 &  a2 
)
inline

Templated constructor with 2 arguments.

Definition at line 31 of file CommonMessaging.h.

31  :
32  BASE(a1, a2), m_streamWithService(false) {}
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
template<class BASE>
template<typename A1 >
CommonMessaging< BASE >::CommonMessaging ( const A1 &  a1)
inline

Templated constructor with 1 argument.

Definition at line 34 of file CommonMessaging.h.

34  :
35  BASE(a1), m_streamWithService(false) {}
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
template<class BASE>
CommonMessaging< BASE >::CommonMessaging ( )
inline

Default constructor.

Definition at line 37 of file CommonMessaging.h.

37  :
38  BASE(), m_streamWithService(false) {}
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
template<class BASE>
virtual CommonMessaging< BASE >::~CommonMessaging ( )
inlinevirtual

Virtual destructor.

Definition at line 41 of file CommonMessaging.h.

41 {}

Member Function Documentation

template<class BASE>
MsgStream& CommonMessaging< BASE >::always ( ) const
inline

shortcut for the method msgStream(MSG::ALWAYS)

Definition at line 95 of file CommonMessaging.h.

95 { return msgStream(MSG::ALWAYS); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::always ( ) const
inline

shortcut for the method msgStream(MSG::ALWAYS)

Definition at line 95 of file CommonMessaging.h.

95 { return msgStream(MSG::ALWAYS); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::debug ( ) const
inline

shortcut for the method msgStream(MSG::DEBUG)

Definition at line 113 of file CommonMessaging.h.

113 { return msgStream(MSG::DEBUG); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::debug ( ) const
inline

shortcut for the method msgStream(MSG::DEBUG)

Definition at line 113 of file CommonMessaging.h.

113 { return msgStream(MSG::DEBUG); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::err ( ) const
inline

shortcut for the method msgStream(MSG::ERROR)

Definition at line 101 of file CommonMessaging.h.

101 { return msgStream(MSG::ERROR); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::err ( ) const
inline

shortcut for the method msgStream(MSG::ERROR)

Definition at line 101 of file CommonMessaging.h.

101 { return msgStream(MSG::ERROR); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::error ( ) const
inline

shortcut for the method msgStream(MSG::ERROR)

Definition at line 104 of file CommonMessaging.h.

104 { return msgStream(MSG::ERROR); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::error ( ) const
inline

shortcut for the method msgStream(MSG::ERROR)

Definition at line 104 of file CommonMessaging.h.

104 { return msgStream(MSG::ERROR); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::fatal ( ) const
inline

shortcut for the method msgStream(MSG::FATAL)

Definition at line 98 of file CommonMessaging.h.

98 { return msgStream(MSG::FATAL); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::fatal ( ) const
inline

shortcut for the method msgStream(MSG::FATAL)

Definition at line 98 of file CommonMessaging.h.

98 { return msgStream(MSG::FATAL); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::info ( ) const
inline

shortcut for the method msgStream(MSG::INFO)

Definition at line 110 of file CommonMessaging.h.

110 { return msgStream(MSG::INFO); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::info ( ) const
inline

shortcut for the method msgStream(MSG::INFO)

Definition at line 110 of file CommonMessaging.h.

110 { return msgStream(MSG::INFO); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::msg ( ) const
inline

shortcut for the method msgStream(MSG::INFO)

Definition at line 119 of file CommonMessaging.h.

119 { return msgStream(MSG::INFO); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::msg ( ) const
inline

shortcut for the method msgStream(MSG::INFO)

Definition at line 119 of file CommonMessaging.h.

119 { return msgStream(MSG::INFO); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MSG::Level CommonMessaging< BASE >::msgLevel ( ) const
inline

get the output level from the embedded MsgStream

Definition at line 122 of file CommonMessaging.h.

122  {
123  return msgStream().level();
124  }
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MSG::Level CommonMessaging< BASE >::msgLevel ( ) const
inline

get the output level from the embedded MsgStream

Definition at line 122 of file CommonMessaging.h.

122  {
123  return msgStream().level();
124  }
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
bool CommonMessaging< BASE >::msgLevel ( MSG::Level  lvl) const
inline

get the output level from the embedded MsgStream

Definition at line 127 of file CommonMessaging.h.

127  {
128  return UNLIKELY(msgLevel() <= lvl);
129  }
#define UNLIKELY(x)
Definition: Kernel.h:127
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
template<class BASE>
bool CommonMessaging< BASE >::msgLevel ( MSG::Level  lvl) const
inline

get the output level from the embedded MsgStream

Definition at line 127 of file CommonMessaging.h.

127  {
128  return UNLIKELY(msgLevel() <= lvl);
129  }
#define UNLIKELY(x)
Definition: Kernel.h:127
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
template<class BASE>
MsgStream& CommonMessaging< BASE >::msgStream ( ) const
inline

Return an uninitialized MsgStream.

Definition at line 71 of file CommonMessaging.h.

71  {
72  if (UNLIKELY((!m_msgStream.get()) || (!m_streamWithService))) {
74  m_msgStream.reset(new MsgStream(ms, this->name()));
75  m_streamWithService = ms.get() != 0;
76  }
77  return *m_msgStream;
78  }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
std::auto_ptr< MsgStream > m_msgStream
The predefined message stream.
virtual const std::string & name() const =0
This is needed to avoid ambiguous calls to name()
#define UNLIKELY(x)
Definition: Kernel.h:127
constexpr double ms
template<class BASE>
MsgStream& CommonMessaging< BASE >::msgStream ( ) const
inline

Return an uninitialized MsgStream.

Definition at line 71 of file CommonMessaging.h.

71  {
72  if (UNLIKELY((!m_msgStream.get()) || (!m_streamWithService))) {
74  m_msgStream.reset(new MsgStream(ms, this->name()));
75  m_streamWithService = ms.get() != 0;
76  }
77  return *m_msgStream;
78  }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
bool m_streamWithService
Flag to create a new MsgStream if it was created without the message service.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
std::auto_ptr< MsgStream > m_msgStream
The predefined message stream.
virtual const std::string & name() const =0
This is needed to avoid ambiguous calls to name()
#define UNLIKELY(x)
Definition: Kernel.h:127
constexpr double ms
template<class BASE>
MsgStream& CommonMessaging< BASE >::msgStream ( const MSG::Level  level) const
inline

Predefined configurable message stream for the efficient printouts.

if ( a < 0 ) { msgStream( MSG::ERROR ) << "a = " << endmsg ; }
Returns
Reference to the predefined stream

Definition at line 90 of file CommonMessaging.h.

90  {
91  return msgStream() << level;
92  }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::msgStream ( const MSG::Level  level) const
inline

Predefined configurable message stream for the efficient printouts.

if ( a < 0 ) { msgStream( MSG::ERROR ) << "a = " << endmsg ; }
Returns
Reference to the predefined stream

Definition at line 90 of file CommonMessaging.h.

90  {
91  return msgStream() << level;
92  }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
SmartIF<IMessageSvc>& CommonMessaging< BASE >::msgSvc ( ) const
inline

The standard message service.

Returns a pointer to the standard message service.

Definition at line 52 of file CommonMessaging.h.

52  {
53  if (!m_msgsvc.get()) {
54  // Get default implementation of the message service.
55  m_msgsvc = this->serviceLocator();
56  }
57  return m_msgsvc;
58  }
virtual SmartIF< ISvcLocator > & serviceLocator() const =0
Needed to locate the message service.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
SmartIF< IMessageSvc > m_msgsvc
Pointer to the message service;.
template<class BASE>
SmartIF<IMessageSvc>& CommonMessaging< BASE >::msgSvc ( ) const
inline

The standard message service.

Returns a pointer to the standard message service.

Definition at line 52 of file CommonMessaging.h.

52  {
53  if (!m_msgsvc.get()) {
54  // Get default implementation of the message service.
55  m_msgsvc = this->serviceLocator();
56  }
57  return m_msgsvc;
58  }
virtual SmartIF< ISvcLocator > & serviceLocator() const =0
Needed to locate the message service.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
SmartIF< IMessageSvc > m_msgsvc
Pointer to the message service;.
template<class BASE>
virtual const std::string& CommonMessaging< BASE >::name ( ) const
pure virtual

This is needed to avoid ambiguous calls to name()

Implemented in ServiceManager, ApplicationMgr, AlgorithmManager, Service, and Service.

template<class BASE>
virtual const std::string& CommonMessaging< BASE >::name ( ) const
pure virtual

This is needed to avoid ambiguous calls to name()

Implemented in ServiceManager, ApplicationMgr, AlgorithmManager, Service, and Service.

template<class BASE>
virtual SmartIF<ISvcLocator>& CommonMessaging< BASE >::serviceLocator ( ) const
pure virtual

Needed to locate the message service.

Implemented in ApplicationMgr, Service, Service, ServiceManager, ComponentManager, and ComponentManager.

template<class BASE>
virtual SmartIF<ISvcLocator>& CommonMessaging< BASE >::serviceLocator ( ) const
pure virtual

Needed to locate the message service.

Implemented in ApplicationMgr, Service, Service, ServiceManager, ComponentManager, and ComponentManager.

template<class 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 143 of file CommonMessaging.h.

143  {
144  if (m_msgStream.get()) m_msgStream->setLevel(level);
145  }
std::auto_ptr< MsgStream > m_msgStream
The predefined message stream.
template<class 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 143 of file CommonMessaging.h.

143  {
144  if (m_msgStream.get()) m_msgStream->setLevel(level);
145  }
std::auto_ptr< MsgStream > m_msgStream
The predefined message stream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::verbose ( ) const
inline

shortcut for the method msgStream(MSG::VERBOSE)

Definition at line 116 of file CommonMessaging.h.

116 { return msgStream(MSG::VERBOSE); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::verbose ( ) const
inline

shortcut for the method msgStream(MSG::VERBOSE)

Definition at line 116 of file CommonMessaging.h.

116 { return msgStream(MSG::VERBOSE); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::warning ( ) const
inline

shortcut for the method msgStream(MSG::WARNING)

Definition at line 107 of file CommonMessaging.h.

107 { return msgStream(MSG::WARNING); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
template<class BASE>
MsgStream& CommonMessaging< BASE >::warning ( ) const
inline

shortcut for the method msgStream(MSG::WARNING)

Definition at line 107 of file CommonMessaging.h.

107 { return msgStream(MSG::WARNING); }
MsgStream & msgStream() const
Return an uninitialized MsgStream.

Member Data Documentation

template<class BASE>
std::auto_ptr< MsgStream > CommonMessaging< BASE >::m_msgStream
mutableprotected

The predefined message stream.

Definition at line 136 of file CommonMessaging.h.

template<class BASE>
SmartIF< IMessageSvc > CommonMessaging< BASE >::m_msgsvc
mutableprotected

Pointer to the message service;.

Definition at line 133 of file CommonMessaging.h.

template<class BASE>
bool CommonMessaging< BASE >::m_streamWithService
mutableprotected

Flag to create a new MsgStream if it was created without the message service.

Definition at line 139 of file CommonMessaging.h.


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