The Gaudi Framework  v30r1 (5d4f4ae2)
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:
25 
27 
29  void reportMessage( const Message& msg ) override;
30 
32  void reportMessage( const Message& msg, int outputLevel ) override;
33 
35  void reportMessage( const StatusCode& code, const std::string& source = "" ) override;
36 
37 private:
38  // ============================================================================
39  // Helper tasks for message reporting.
40  // ============================================================================
43  {
44  public:
45  MessageTaskCommon( TBBMessageSvc& svc ) : m_svc( svc ), m_sender( std::this_thread::get_id() ) {}
46 
47  protected:
50  };
51 
54  {
55  public:
57  : MessageTaskCommon( svc ), m_msg( msg ), m_level( level )
58  {
59  }
60  void run() override { m_svc.i_reportMessage( m_msg, m_level ); }
61 
62  private:
64  int m_level;
65  };
66 
69  {
70  public:
71  MessageWithoutLevel( TBBMessageSvc& svc, Message msg ) : MessageTaskCommon( svc ), m_msg( msg ) {}
72  void run() override
73  {
74  const int level = m_svc.outputLevel( m_msg.getSource() );
75  m_svc.i_reportMessage( m_msg, level );
76  }
77 
78  private:
80  };
81 
84  {
85  public:
86  StatusCodeMessage( TBBMessageSvc& svc, const StatusCode& sc, const std::string& source )
87  : MessageTaskCommon( svc ), m_sc( sc ), m_source( source )
88  {
89  }
90  void run() override { m_svc.i_reportMessage( m_sc, m_source ); }
91 
92  private:
95  };
96 
98 };
99 
100 #endif // MESSAGESVC_TBBMESSAGESVC_H
Gaudi::SerialTaskQueue m_messageQueue
Definition: TBBMessageSvc.h:97
void run() override
Method to be implemented by the actual task classes.
Definition: TBBMessageSvc.h:90
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:72
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:71
STL class.
Specialized class to report a message with explicit output level.
Definition: TBBMessageSvc.h:53
Specialized class to report a StatusCode message.
Definition: TBBMessageSvc.h:83
void run() override
Method to be implemented by the actual task classes.
Definition: TBBMessageSvc.h:60
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
void reportMessage(const Message &message) override
Definition: MessageSvc.cpp:430
StatusCodeMessage(TBBMessageSvc &svc, const StatusCode &sc, const std::string &source)
Definition: TBBMessageSvc.h:86
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:56
MessageTaskCommon(TBBMessageSvc &svc)
Definition: TBBMessageSvc.h:45
Common base class for the different reportMessage cases.
Definition: TBBMessageSvc.h:42
Specialized class to report a message with implicit output level.
Definition: TBBMessageSvc.h:68