The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
AuditorSvc.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 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
14#include <GaudiKernel/Service.h>
15#include <memory>
16#include <vector>
17
22class AuditorSvc : public extends<Service, IAuditorSvc> {
23public:
25 // make sure we synchronize auditors at initialization
26 return Service::initialize().andThen( [&] { return syncAuditors(); } );
27 }
28 StatusCode finalize() override;
29
30 void before( std::string const&, std::string const&, EventContext const& ) override;
31 void after( std::string const&, std::string const&, EventContext const&, StatusCode const& ) override;
32
33 bool isEnabled() const override { return m_isEnabled; };
34
37
39 Gaudi::IAuditor* getAuditor( std::string const& name ) const override;
41 bool hasAuditor( std::string const& name ) const override { return getAuditor( name ) != nullptr; };
43 StatusCode addAuditor( std::string const& name ) override;
45 std::optional<StatusCode> removesAuditor( std::string const& name ) override;
46
47 using extends::extends;
48
49private:
50 std::unique_ptr<Gaudi::IAuditor> newAuditor( MsgStream&, std::string_view );
53
55 this,
56 "Auditors",
57 {},
58 [this]( auto& ) {
59 // Warn that any change of this property after initialize
60 // won't be taken into account
62 error() << "Updating 'Auditors' after initialize is not supported. Use addAuditor instead." << endmsg;
63 }
64 },
65 "list of auditors names",
66 "OrderedSet<std::string>" };
67 Gaudi::Property<bool> m_isEnabled{ this, "Enable", true, "enable/disable alltogether the auditors" };
68
69 // Manager list of Auditors
70 std::vector<std::unique_ptr<Gaudi::IAuditor>> m_pAudList;
71};
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
This service manages Auditors.
Definition AuditorSvc.h:22
StatusCode sysFinalize() override
Definition AuditorSvc.h:36
void before(std::string const &, std::string const &, EventContext const &) override
std::vector< std::unique_ptr< Gaudi::IAuditor > > m_pAudList
Definition AuditorSvc.h:70
void after(std::string const &, std::string const &, EventContext const &, StatusCode const &) override
Gaudi::IAuditor * getAuditor(std::string const &name) const override
management functionality: retrieve an Auditor
std::unique_ptr< Gaudi::IAuditor > newAuditor(MsgStream &, std::string_view)
Gaudi::Property< bool > m_isEnabled
Definition AuditorSvc.h:67
StatusCode sysInitialize() override
Definition AuditorSvc.h:35
StatusCode addAuditor(std::string const &name) override
adds a new Auditor
StatusCode finalize() override
Gaudi::Property< std::vector< std::string > > m_audNameList
Definition AuditorSvc.h:54
bool isEnabled() const override
Definition AuditorSvc.h:33
StatusCode initialize() override
Definition AuditorSvc.h:24
bool hasAuditor(std::string const &name) const override
management functionality: check if an Auditor exists
Definition AuditorSvc.h:41
std::optional< StatusCode > removesAuditor(std::string const &name) override
removes an Auditor. Returns whether the Auditor was present (and thus removed)
StatusCode syncAuditors()
internal mathod to update auditors when m_audNameList is changed
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class represents an entry point to all the event specific data.
The IAuditor is the interface implemented by the Auditor base class.
Definition IAuditor.h:26
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
Definition of the MsgStream class used to transmit messages.
Definition MsgStream.h:29
Gaudi::StateMachine::State FSMState() const override
Definition Service.h:55
StatusCode sysFinalize() override
Finalize Service.
Definition Service.cpp:193
StatusCode sysInitialize() override
Initialize Service.
Definition Service.cpp:33
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333
StatusCode initialize() override
Definition Service.cpp:118
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Definition StatusCode.h:163
Base class used to extend a class implementing other interfaces.
Definition extends.h:19