8 #ifndef COMMONMESSAGING_H_ 9 #define COMMONMESSAGING_H_ 16 #include <boost/thread/tss.hpp> 25 #define generate_( method, ret, args ) \ 27 template <typename T, typename SFINAE = void> \ 28 struct has_##method : std::false_type { \ 30 template <typename T> \ 31 struct has_##method<T, is_valid_t<decltype( std::declval<const T&>().method args )>> : std::true_type { \ 34 template <typename Base> \ 35 struct add_##method : public Base { \ 37 virtual ~add_##method() = default; \ 38 virtual ret method args const = 0; \ 54 template <
typename Base>
56 implementation_detail::add_name<Base>>
::type;
57 template <
typename Base>
59 implementation_detail::add_serviceLocator<Base>>
::type;
61 template <
typename Base>
70 virtual void create_msgSvc()
const = 0;
71 virtual void create_msgStream()
const = 0;
78 if (
UNLIKELY( !m_msgsvc ) ) create_msgSvc();
85 if (
UNLIKELY( ( !m_msgStream.get() ) ) ) create_msgStream();
131 if (
UNLIKELY( ( !m_msgStream.get() ) ) ) create_msgStream();
132 if (
UNLIKELY( ( !m_level.get() ) ) ) {
145 template <
typename Base>
152 mutable boost::thread_specific_ptr<MSG::Level>
m_level;
158 template <
typename BASE>
172 m_msgsvc = this->serviceLocator();
178 m_level.reset(
new MSG::Level( m_msgStream.get() ? m_msgStream->level() :
MSG::NIL ) );
186 if ( !m_msgStream.get() ) {
189 if ( level !=
MSG::NIL && level != *m_level ) {
191 msgSvc()->setOutputLevel( this->
name(), level );
193 if ( m_msgStream.get() ) m_msgStream->setLevel( level );
195 debug() <<
"Property update for OutputLevel : new value = " << level <<
endmsg;
Definition of the MsgStream class used to transmit messages.
Small smart pointer class with automatic reference counting for IInterface.
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
SmartIF< IMessageSvc > m_msgsvc
Pointer to the message service;.
class MergingTransformer< Out(const vector_of_const_< In > void
typename std::conditional< implementation_detail::has_name< Base >::value, Base, implementation_detail::add_name< Base >>::type add_name
void create_msgSvc() const override final
cold functionality
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)
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
boost::thread_specific_ptr< MSG::Level > m_level
boost::thread_specific_ptr< MsgStream > m_msgStream
The predefined message stream.
void create_msgStream() const override final
MSG::Level outputLevel() const __attribute__((deprecated))
Backward compatibility function for getting the output level.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
generate_(name, const std::string &,()) generate_(serviceLocator
MsgStream & msgStream() const
Return an uninitialized MsgStream.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
typename void_t< T >::type is_valid_t
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)
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
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
bool msgLevel(MSG::Level lvl) const
get the output level from the embedded MsgStream
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.