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; \ 48 template <
typename Base>
50 std::conditional_t<implementation_detail::has_name<Base>::value, Base, implementation_detail::add_name<Base>>;
51 template <
typename Base>
52 using add_serviceLocator = std::conditional_t<implementation_detail::has_serviceLocator<Base>::value, Base,
53 implementation_detail::add_serviceLocator<Base>>;
55 template <
typename Base>
116 template <
typename Base>
129 template <
typename BASE>
140 return setUpMessaging();
159 m_msgsvc = this->serviceLocator();
170 if (
UNLIKELY( !m_commonMessagingReady ) ) { initMessaging(); }
175 m_commonMessagingReady =
false;
176 return setUpMessaging();
184 if ( m_msgStream.get() ) m_msgStream->setLevel(
level );
186 debug() <<
"Property update for OutputLevel : new value = " <<
level <<
endmsg;
Definition of the MsgStream class used to transmit messages.
bool m_commonMessagingReady
void create_msgStream() const override final
cold functionality
const SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
friend class CommonMessaging
void initMessaging() const
Initialise the messaging objects.
MSG::Level resetMessaging()
Reinitialize internal states.
SmartIF< IMessageSvc > m_msgsvc
Pointer to the message service;.
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
MSG::Level outputLevel() const
Backward compatibility function for getting the output level.
MSG::Level setUpMessaging() const
Set up local caches.
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
std::conditional_t< implementation_detail::has_serviceLocator< Base >::value, Base, implementation_detail::add_serviceLocator< Base > > add_serviceLocator
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual void create_msgStream() const =0
cold functionality
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
bool msgLevel(MSG::Level lvl) const
get the output level from the embedded MsgStream
boost::thread_specific_ptr< MsgStream > m_msgStream
The predefined message stream.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
MsgStream & msgStream() const
Return an uninitialized MsgStream.
std::conditional_t< implementation_detail::has_name< Base >::value, Base, implementation_detail::add_name< Base > > add_name
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
generate_(name, const std::string &,()) generate_(serviceLocator
virtual ~CommonMessagingBase()=default
Virtual destructor.
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
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 & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual void setOutputLevel(int new_level)=0
Set new global output level threshold.