Go to the documentation of this file.
18 #ifndef COMMONMESSAGING_H_
19 #define COMMONMESSAGING_H_
27 #include <boost/thread/tss.hpp>
36 #define generate_( method, ret, args ) \
38 template <typename T> \
39 using _has_##method = decltype( std::declval<const T&>().method args ); \
41 template <typename T> \
42 using has_##method = Gaudi::cpp17::is_detected<_has_##method, T>; \
44 template <typename Base> \
45 struct add_##method : public Base { \
47 virtual ~add_##method() = default; \
48 virtual ret method args const = 0; \
58 template <
typename Base>
60 std::conditional_t<implementation_detail::has_name<Base>::value, Base, implementation_detail::add_name<Base>>;
61 template <
typename Base>
62 using add_serviceLocator = std::conditional_t<implementation_detail::has_serviceLocator<Base>::value, Base,
63 implementation_detail::add_serviceLocator<Base>>;
65 template <
typename Base>
82 if ( !m_msgStream.get() ) create_msgStream();
126 template <
typename Base>
129 mutable bool m_commonMessagingReady =
false;
139 template <
typename BASE>
149 if ( m_commonMessagingReady )
return m_level;
150 return setUpMessaging();
164 m_msgsvc = this->serviceLocator();
169 m_commonMessagingReady = m_msgsvc;
175 if ( !m_commonMessagingReady ) { initMessaging(); }
180 m_commonMessagingReady =
false;
181 return setUpMessaging();
189 if ( m_msgStream.get() ) m_msgStream->setLevel(
level );
191 debug() <<
"Property update for OutputLevel : new value = " <<
level <<
endmsg;
MsgStream & msgStream(const MSG::Level level) const
Predefined configurable message stream for the efficient printouts.
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
virtual ~CommonMessagingBase()=default
Virtual destructor.
MSG::Level resetMessaging()
Reinitialize internal states.
void create_msgStream() const override final
SmartIF< IMessageSvc > m_msgsvc
Pointer to the message service;.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
void initMessaging() const
Initialise the messaging objects.
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
MSG::Level setUpMessaging() const
Set up local caches.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
std::conditional_t< implementation_detail::has_serviceLocator< Base >::value, Base, implementation_detail::add_serviceLocator< Base > > add_serviceLocator
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
virtual void create_msgStream() const =0
cold functionality
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
MsgStream & msgStream() const
Return an uninitialized MsgStream.
boost::thread_specific_ptr< MsgStream > m_msgStream
The predefined message stream.
bool msgLevel(MSG::Level lvl) const
get the output level from the embedded MsgStream
generate_(name, const std::string &,()) generate_(serviceLocator
std::conditional_t< implementation_detail::has_name< Base >::value, Base, implementation_detail::add_name< Base > > add_name
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)