The Gaudi Framework  master (37c0b60a)
AuditorSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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 AuditorSvc_AuditorSvc_H
12 #define AuditorSvc_AuditorSvc_H
13 
14 // Include Files
16 #include <GaudiKernel/Service.h>
17 #include <list>
18 #include <vector>
19 
20 //------------------------------------------------------------------
21 //
22 // ClassName: AuditorSvc
23 //
24 // Description: This service manages Auditors.
25 // Auditors can be inserted in the system to audit the Algorithms is
26 // in their functions.
27 //------------------------------------------------------------------
28 class AuditorSvc : public extends<Service, IAuditorSvc> {
29 public:
30  // Inherited Service overrides:
31  //
32  // Initialize the service.
33  StatusCode initialize() override;
34 
35  // Finalize the service.
36  StatusCode finalize() override;
37 
38  // IAuditorSvc interfaces overwrite
39  //
41 
42  void before( StandardEventType, INamedInterface* ) override;
43  void before( StandardEventType, const std::string& ) override;
44 
45  void before( CustomEventTypeRef, INamedInterface* ) override;
46  void before( CustomEventTypeRef, const std::string& ) override;
47 
48  void after( StandardEventType, INamedInterface*, const StatusCode& ) override;
49  void after( StandardEventType, const std::string&, const StatusCode& ) override;
50 
51  void after( CustomEventTypeRef, INamedInterface*, const StatusCode& ) override;
52  void after( CustomEventTypeRef, const std::string&, const StatusCode& ) override;
53 
54  // inform Auditors that the initialize() is about to be called
55  void beforeInitialize( INamedInterface* ini ) override;
56  // inform Auditors that the initialize() has been called
57  void afterInitialize( INamedInterface* ini ) override;
58 
59  // inform Auditors that the reinitialize() is about to be called
60  void beforeReinitialize( INamedInterface* ini ) override;
61  // inform Auditors that the reinitialize() has been called
62  void afterReinitialize( INamedInterface* ini ) override;
63 
64  // inform Auditors that the execute() is about to be called
65  void beforeExecute( INamedInterface* ini ) override;
66  // inform Auditors that the execute() has been called
67  void afterExecute( INamedInterface* ini, const StatusCode& ) override;
68 
69  // inform Auditors that the finalize() is about to be called
70  void beforeFinalize( INamedInterface* ini ) override;
71  // inform Auditors that the finalize() has been called
72  void afterFinalize( INamedInterface* ini ) override;
73 
74  bool isEnabled() const override;
75 
76  StatusCode sysInitialize() override;
77  StatusCode sysFinalize() override;
78 
79  // management functionality: retrieve an Auditor
80  IAuditor* getAuditor( const std::string& name ) override;
81 
82  using extends::extends;
83 
84 private:
85  // management helper
86  SmartIF<IAuditor> newAuditor_( MsgStream&, std::string_view );
87  SmartIF<IAuditor> findAuditor_( std::string_view );
89 
91  this, "Auditors", {}, "list of auditors names", "OrderedSet<std::string>" };
92  Gaudi::Property<bool> m_isEnabled{ this, "Enable", true, "enable/disable alltogether the auditors" };
93 
94  // Manager list of Auditors
96 };
97 
98 #endif
AuditorSvc::m_isEnabled
Gaudi::Property< bool > m_isEnabled
Definition: AuditorSvc.h:92
AuditorSvc::sysFinalize
StatusCode sysFinalize() override
Definition: AuditorSvc.cpp:196
AuditorSvc::after
void after(StandardEventType, INamedInterface *, const StatusCode &) override
Definition: AuditorSvc.cpp:143
std::string
STL class.
AuditorSvc::syncAuditors_
StatusCode syncAuditors_()
Definition: AuditorSvc.cpp:60
AuditorSvc::m_pAudList
std::vector< SmartIF< IAuditor > > m_pAudList
Definition: AuditorSvc.h:95
AuditorSvc::before
void before(StandardEventType, INamedInterface *) override
The following methods are meant to be implemented by the child class...
Definition: AuditorSvc.cpp:114
std::vector
STL class.
AuditorSvc::initialize
StatusCode initialize() override
Definition: AuditorSvc.cpp:91
AuditorSvc::beforeExecute
void beforeExecute(INamedInterface *ini) override
AuditorSvc::afterInitialize
void afterInitialize(INamedInterface *ini) override
IAuditorSvc.h
AuditorSvc::beforeInitialize
void beforeInitialize(INamedInterface *ini) override
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
StatusCode
Definition: StatusCode.h:65
AuditorSvc
Definition: AuditorSvc.h:28
AuditorSvc::afterReinitialize
void afterReinitialize(INamedInterface *ini) override
AuditorSvc::afterExecute
void afterExecute(INamedInterface *ini, const StatusCode &) override
Definition: AuditorSvc.cpp:185
AuditorSvc::isEnabled
bool isEnabled() const override
Definition: AuditorSvc.cpp:193
AuditorSvc::finalize
StatusCode finalize() override
Definition: AuditorSvc.cpp:102
SmartIF< IAuditor >
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
MsgStream
Definition: MsgStream.h:33
AuditorSvc::newAuditor_
SmartIF< IAuditor > newAuditor_(MsgStream &, std::string_view)
Definition: AuditorSvc.cpp:32
AuditorSvc::beforeReinitialize
void beforeReinitialize(INamedInterface *ini) override
Service.h
AuditorSvc::sysInitialize
StatusCode sysInitialize() override
Definition: AuditorSvc.cpp:195
INamedInterface
Definition: INamedInterface.h:25
AuditorSvc::afterFinalize
void afterFinalize(INamedInterface *ini) override
AuditorSvc::m_audNameList
Gaudi::Property< std::vector< std::string > > m_audNameList
Definition: AuditorSvc.h:90
AuditorSvc::findAuditor_
SmartIF< IAuditor > findAuditor_(std::string_view)
Definition: AuditorSvc.cpp:51
AuditorSvc::beforeFinalize
void beforeFinalize(INamedInterface *ini) override
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:37
IAuditor
Definition: IAuditor.h:28
AuditorSvc::getAuditor
IAuditor * getAuditor(const std::string &name) override
Definition: AuditorSvc.cpp:198