The Gaudi Framework  v33r0 (d5ea422b)
TBBMessageSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef MESSAGESVC_TBBMESSAGESVC_H
12 #define MESSAGESVC_TBBMESSAGESVC_H 1
13 // Include files
14 #include "MessageSvc.h"
15 
17 
18 // just needed for the thread id
19 #include <thread>
20 
21 #include <thread>
22 
30 class TBBMessageSvc : public MessageSvc {
31 public:
33 
35 
37  void reportMessage( const Message& msg ) override;
38 
40  void reportMessage( const Message& msg, int outputLevel ) override;
41 
43  void reportMessage( const StatusCode& code, const std::string& source = "" ) override;
44 
45 private:
46  // ============================================================================
47  // Helper tasks for message reporting.
48  // ============================================================================
51  public:
52  MessageTaskCommon( TBBMessageSvc& svc ) : m_svc( svc ), m_sender( std::this_thread::get_id() ) {}
53 
54  protected:
57  };
58 
61  public:
63  : MessageTaskCommon( svc ), m_msg( msg ), m_level( level ) {}
64  void run() override { m_svc.i_reportMessage( m_msg, m_level ); }
65 
66  private:
68  int m_level;
69  };
70 
73  public:
75  void run() override {
76  const int level = m_svc.outputLevel( m_msg.getSource() );
78  }
79 
80  private:
82  };
83 
86  public:
87  StatusCodeMessage( TBBMessageSvc& svc, const StatusCode& sc, const std::string& source )
88  : MessageTaskCommon( svc ), m_sc( sc ), m_source( source ) {}
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
virtual void i_reportMessage(const Message &msg, int outputLevel)
Internal implementation of reportMessage(const Message&,int) without lock.
Definition: MessageSvc.cpp:366
void run() override
Method to be implemented by the actual task classes.
Definition: TBBMessageSvc.h:75
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:88
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:74
const std::string & getSource() const
Get the message source.
Definition: Message.cpp:88
STL class.
Specialized class to report a message with explicit output level.
Definition: TBBMessageSvc.h:60
Specialized class to report a StatusCode message.
Definition: TBBMessageSvc.h:85
void run() override
Method to be implemented by the actual task classes.
Definition: TBBMessageSvc.h:64
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
void reportMessage(const Message &message) override
Definition: MessageSvc.cpp:419
StatusCodeMessage(TBBMessageSvc &svc, const StatusCode &sc, const std::string &source)
Definition: TBBMessageSvc.h:87
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
The Message class.
Definition: Message.h:27
MessageWithLevel(TBBMessageSvc &svc, Message msg, int level)
Definition: TBBMessageSvc.h:62
int outputLevel() const override
Definition: MessageSvc.cpp:576
MessageTaskCommon(TBBMessageSvc &svc)
Definition: TBBMessageSvc.h:52
Common base class for the different reportMessage cases.
Definition: TBBMessageSvc.h:50
Specialized class to report a message with implicit output level.
Definition: TBBMessageSvc.h:72