8 #ifndef COMMONMESSAGING_H_
9 #define COMMONMESSAGING_H_
10 #include "GaudiKernel/IService.h"
11 #include "GaudiKernel/ISvcLocator.h"
12 #include "GaudiKernel/IMessageSvc.h"
13 #include "GaudiKernel/MsgStream.h"
14 #include "GaudiKernel/SmartIF.h"
15 #include "GaudiKernel/GaudiException.h"
24 #define generate_has_( method, args ) \
25 template <typename T, typename SFINAE = void> \
26 struct has_ ## method : std::false_type {}; \
27 template <typename T> \
28 struct has_ ## method<T, is_valid_t<decltype(std::declval<const T&>().method args)>> : std::true_type {};
30 #define generate_add_(method, ret, args ) \
31 template <typename Base, bool> struct add_ ## method; \
32 template <typename Base> \
33 struct add_ ## method <Base,false> : public Base { \
36 template <typename Base> \
37 struct add_ ## method <Base, true> : public Base { \
39 virtual ~add_ ## method () = default; \
40 virtual ret method args const = 0; \
44 template <
typename>
struct void_t {
typedef void type; };
59 template <
typename BASE>
76 m_msgsvc = this->serviceLocator();
81 #if defined(GAUDI_V20_COMPAT) && !defined(G21_NO_DEPRECATED)
93 if (
UNLIKELY((!m_msgStream) || (!m_streamWithService))) {
96 m_streamWithService =
ms.isValid();
112 return msgStream() <<
level;
144 return msgStream().level();
160 mutable bool m_streamWithService =
false;
165 if (m_msgStream) m_msgStream->
setLevel(level);
Definition of the MsgStream class used to transmit messages.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
Small smart pointer class with automatic reference counting for IInterface.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
generate_has_(name,()) generate_add_(name
MsgStream & msgStream() const
Return an uninitialized MsgStream.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
bool msgLevel(MSG::Level lvl) const
get the output level from the embedded MsgStream
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
#define generate_add_(method, ret, args)
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
std::unique_ptr< MsgStream > m_msgStream
The predefined message stream.
implementation_detail::add_serviceLocator< Base,!implementation_detail::has_serviceLocator< Base >::value > add_serviceLocator
void setLevel(int level)
Update outputlevel.
SmartIF< IMessageSvc > m_msgsvc
Pointer to the message service;.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
typename void_t< T >::type is_valid_t
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
implementation_detail::add_name< Base,!implementation_detail::has_name< Base >::value > add_name
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MSG::Level msgLevel() const
get the output level from the embedded MsgStream