The Gaudi Framework  master (991ff291)
Loading...
Searching...
No Matches
InertMessageSvc.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 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#pragma once
12
13#include "MessageSvc.h"
14#include <functional>
15#include <memory>
16#include <tbb/concurrent_queue.h>
17#include <thread>
18
33public:
35
37 StatusCode initialize() override;
38
40 StatusCode finalize() override;
41
43
45 void reportMessage( const Message& msg ) override;
46
48 void reportMessage( const Message& msg, int outputLevel ) override;
49
51 void reportMessage( const StatusCode& code, std::string_view source = "" ) override;
52
53private:
54 void m_activate();
55 void m_deactivate();
56 std::atomic<bool> m_isActive = false;
57
58 void i_onSuppressChanged( bool v ) override {
59 m_messageActionsQueue.emplace( [this, v] { m_suppress = v; } );
60 }
61 void i_onDefaultFormatChanged( const std::string& v ) override {
62 m_messageActionsQueue.emplace( [this, v] { m_defaultFormat = v; } );
63 }
64 tbb::concurrent_bounded_queue<std::function<void()>> m_messageActionsQueue;
65
66 std::thread m_thread;
67};
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Thread safe extension to the standard MessageSvc.
void i_onDefaultFormatChanged(const std::string &v) override
void reportMessage(const Message &msg) override
Implementation of IMessageSvc::reportMessage()
StatusCode finalize() override
Finalization of the service.
StatusCode initialize() override
Initialization of the service.
std::atomic< bool > m_isActive
std::thread m_thread
tbb::concurrent_bounded_queue< std::function< void()> > m_messageActionsQueue
void i_onSuppressChanged(bool v) override
MessageSvc(const std::string &name, ISvcLocator *svcloc)
The Message class.
Definition Message.h:25
void reportMessage(const Message &message) override
int outputLevel() const override
std::string m_defaultFormat
Definition MessageSvc.h:138
bool m_suppress
Definition MessageSvc.h:137
MessageSvc(const std::string &name, ISvcLocator *svcloc)
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64