The Gaudi Framework  v33r1 (b1225454)
InertMessageSvc.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_INERTMESSAGESVC_H
12 #define MESSAGESVC_INERTMESSAGESVC_H 1
13 // Include files
14 // FW
15 #include "MessageSvc.h"
16 // C++
17 #include <functional>
18 #include <memory>
19 #include <thread>
20 // External libs
21 #include "tbb/concurrent_queue.h"
22 
36 class InertMessageSvc : public MessageSvc {
37 public:
40 
42  StatusCode initialize() override;
43 
45  StatusCode finalize() override;
46 
48 
50  void reportMessage( const Message& msg ) override;
51 
53  void reportMessage( const Message& msg, int outputLevel ) override;
54 
56  void reportMessage( const StatusCode& code, const std::string& source = "" ) override;
57 
58 private:
59  void m_activate();
60  void m_deactivate();
61  bool m_isActive = false;
62 
63  tbb::concurrent_bounded_queue<std::function<void()>> m_messageActionsQueue;
64 
66 };
67 
68 #endif // MESSAGESVC_INERTMESSAGESVC_H
StatusCode initialize() override
Initialization of the service.
Thread safe extension to the standard MessageSvc.
void reportMessage(const Message &msg) override
Implementation of IMessageSvc::reportMessage()
MessageSvc(const std::string &name, ISvcLocator *svcloc)
Definition: MessageSvc.cpp:88
std::thread m_thread
StatusCode finalize() override
Finalization of the service.
STL class.
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
tbb::concurrent_bounded_queue< std::function< void()> > m_messageActionsQueue
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
The Message class.
Definition: Message.h:27
int outputLevel() const override
Definition: MessageSvc.cpp:576
STL class.