8 #ifndef COMMONMESSAGING_H_
9 #define COMMONMESSAGING_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; };
65 virtual void create_msgSvc()
const = 0;
66 virtual void create_msgStream()
const = 0;
74 if (
UNLIKELY(!m_msgsvc)) create_msgSvc();
78 #if defined(GAUDI_V20_COMPAT) && !defined(G21_NO_DEPRECATED)
90 if (
UNLIKELY((m_createMsgStream))) create_msgStream();
105 return msgStream() <<
level;
137 if (
UNLIKELY(!m_msgStream)) create_msgStream();
163 template <
typename BASE>
175 m_msgsvc = this->serviceLocator();
180 m_createMsgStream = (!
ms.isValid() || !m_msgStream);
181 m_level = m_msgStream ? m_msgStream->level() :
MSG::NIL;
188 if (level !=
MSG::NIL && level != m_level) {
189 msgSvc()->setOutputLevel(this->
name(), level);
190 if (m_msgStream) m_msgStream->setLevel(level);
192 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;.
void create_msgSvc() const overridefinal
cold functionality
std::unique_ptr< MsgStream > m_msgStream
The predefined message stream.
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
generate_has_(name,()) generate_add_(name
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
#define generate_add_(method, ret, args)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
implementation_detail::add_serviceLocator< Base,!implementation_detail::has_serviceLocator< Base >::value > add_serviceLocator
void create_msgStream() const overridefinal
MSG::Level outputLevel() const __attribute__((deprecated))
Backward compatibility function for getting the output level.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
implementation_detail::add_name< Base,!implementation_detail::has_name< Base >::value > add_name
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)
bool m_createMsgStream
Flag to trigger a new MsgStream.
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.