The Gaudi Framework  v30r3 (a5ef0a68)
TBBMessageSvc.h
Go to the documentation of this file.
1 #ifndef MESSAGESVC_TBBMESSAGESVC_H
2 #define MESSAGESVC_TBBMESSAGESVC_H 1
3 // Include files
4 #include "MessageSvc.h"
5 
7 
8 // just needed for the thread id
9 #include <thread>
10 
11 #include <thread>
12 
20 class TBBMessageSvc : public MessageSvc
21 {
22 public:
24 
26 
28  void reportMessage( const Message& msg ) override;
29 
31  void reportMessage( const Message& msg, int outputLevel ) override;
32 
34  void reportMessage( const StatusCode& code, const std::string& source = "" ) override;
35 
36 private:
37  // ============================================================================
38  // Helper tasks for message reporting.
39  // ============================================================================
42  {
43  public:
44  MessageTaskCommon( TBBMessageSvc& svc ) : m_svc( svc ), m_sender( std::this_thread::get_id() ) {}
45 
46  protected:
49  };
50 
53  {
54  public:
56  : MessageTaskCommon( svc ), m_msg( msg ), m_level( level )
57  {
58  }
59  void run() override { m_svc.i_reportMessage( m_msg, m_level ); }
60 
61  private:
63  int m_level;
64  };
65 
68  {
69  public:
70  MessageWithoutLevel( TBBMessageSvc& svc, Message msg ) : MessageTaskCommon( svc ), m_msg( msg ) {}
71  void run() override
72  {
73  const int level = m_svc.outputLevel( m_msg.getSource() );
74  m_svc.i_reportMessage( m_msg, level );
75  }
76 
77  private:
79  };
80 
83  {
84  public:
85  StatusCodeMessage( TBBMessageSvc& svc, const StatusCode& sc, const std::string& source )
86  : MessageTaskCommon( svc ), m_sc( sc ), m_source( source )
87  {
88  }
89  void run() override { m_svc.i_reportMessage( m_sc, m_source ); }
90 
91  private:
94  };
95 
97 };
98 
99 #endif // MESSAGESVC_TBBMESSAGESVC_H
Gaudi::SerialTaskQueue m_messageQueue
Definition: TBBMessageSvc.h:96
void run() override
Method to be implemented by the actual task classes.
Definition: TBBMessageSvc.h:89
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
virtual void i_reportMessage(const Message &msg, int outputLevel)
Internal implementation of reportMessage(const Message&,int) without lock.
Definition: MessageSvc.cpp:372
void run() override
Method to be implemented by the actual task classes.
Definition: TBBMessageSvc.h:71
void reportMessage(const Message &msg) override
Implementation of IMessageSvc::reportMessage()
Base class for the task to be executed by the serial queue.
STL namespace.
MessageSvc(const std::string &name, ISvcLocator *svcloc)
Definition: MessageSvc.cpp:83
Class for a generic serial queue of tasks (modeled on the Intel Threading Building Blocks Design Patt...
MessageWithoutLevel(TBBMessageSvc &svc, Message msg)
Definition: TBBMessageSvc.h:70
STL class.
Specialized class to report a message with explicit output level.
Definition: TBBMessageSvc.h:52
Specialized class to report a StatusCode message.
Definition: TBBMessageSvc.h:82
void run() override
Method to be implemented by the actual task classes.
Definition: TBBMessageSvc.h:59
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
void reportMessage(const Message &message) override
Definition: MessageSvc.cpp:430
StatusCodeMessage(TBBMessageSvc &svc, const StatusCode &sc, const std::string &source)
Definition: TBBMessageSvc.h:85
The Message class.
Definition: Message.h:15
int outputLevel() const override
Definition: MessageSvc.cpp:598
MessageWithLevel(TBBMessageSvc &svc, Message msg, int level)
Definition: TBBMessageSvc.h:55
MessageTaskCommon(TBBMessageSvc &svc)
Definition: TBBMessageSvc.h:44
Common base class for the different reportMessage cases.
Definition: TBBMessageSvc.h:41
Specialized class to report a message with implicit output level.
Definition: TBBMessageSvc.h:67