8 #ifndef COMMONMESSAGING_H_ 9 #define COMMONMESSAGING_H_ 17 #include <boost/thread/tss.hpp> 26 #define generate_( method, ret, args ) \ 28 template <typename T> \ 29 using _has_##method = decltype( std::declval<const T&>().method args ); \ 31 template <typename T> \ 32 using has_##method = Gaudi::cpp17::is_detected<_has_##method, T>; \ 34 template <typename Base> \ 35 struct add_##method : public Base { \ 37 virtual ~add_##method() = default; \ 38 virtual ret method args const = 0; \ 49 template <
typename Base>
51 implementation_detail::add_name<Base>>
::type;
52 template <
typename Base>
54 implementation_detail::add_serviceLocator<Base>>
::type;
56 template <
typename Base>
65 virtual void create_msgStream()
const = 0;
75 if (
UNLIKELY( ( !m_msgStream.get() ) ) ) create_msgStream();
119 template <
typename Base>
132 template <
typename BASE>
144 if (
LIKELY( m_commonMessagingReady ) )
return m_level;
145 return setUpMessaging();
166 m_msgsvc = this->serviceLocator();
171 m_commonMessagingReady = m_msgsvc;
178 if (
UNLIKELY( !m_commonMessagingReady ) ) {
186 m_commonMessagingReady =
false;
187 return setUpMessaging();
194 if ( level !=
MSG::NIL && level != m_level ) {
196 if ( m_msgStream.get() ) m_msgStream->setLevel( level );
198 debug() <<
"Property update for OutputLevel : new value = " << level <<
endmsg;
Definition of the MsgStream class used to transmit messages.
bool m_commonMessagingReady
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
MSG::Level resetMessaging()
Reinitialize internal states.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
SmartIF< IMessageSvc > m_msgsvc
Pointer to the message service;.
typename std::conditional< implementation_detail::has_name< Base >::value, Base, implementation_detail::add_name< Base >>::type add_name
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
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.
MSG::Level outputLevel() const
Backward compatibility function for getting the output level.
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.
void create_msgStream() const override final
cold functionality
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
generate_(name, const std::string &,()) generate_(serviceLocator
MsgStream & msgStream() const
Return an uninitialized MsgStream.
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
typename std::conditional< implementation_detail::has_serviceLocator< Base >::value, Base, implementation_detail::add_serviceLocator< Base >>::type add_serviceLocator
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
void initMessaging() const
Initialise the messaging objects.
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)