AuditorSvc.h
Go to the documentation of this file.
1 #ifndef AuditorSvc_AuditorSvc_H
2 #define AuditorSvc_AuditorSvc_H
3 
4 // Include Files
5 #include "GaudiKernel/Service.h"
6 #include "GaudiKernel/IAuditorSvc.h"
7 #include <list>
8 #include <vector>
9 
10 //------------------------------------------------------------------
11 //
12 // ClassName: AuditorSvc
13 //
14 // Description: This service manages Auditors.
15 // Auditors can be inserted in the system to audit the Algorithms is
16 // in their functions.
17 //------------------------------------------------------------------
18 class AuditorSvc : public extends1<Service, IAuditorSvc> {
19 
20 public:
21 
22 
23 // Inherited Service overrides:
24 //
25  // Initialize the service.
26  StatusCode initialize() override;
27 
28  // Finalize the service.
29  StatusCode finalize() override;
30 
31 // IAuditorSvc interfaces overwrite
32 //
34 
35  void before(StandardEventType, INamedInterface*) override;
36  void before(StandardEventType, const std::string&) override;
37 
38  void before(CustomEventTypeRef, INamedInterface*) override;
39  void before(CustomEventTypeRef, const std::string&) override;
40 
41  void after(StandardEventType, INamedInterface*, const StatusCode&) override;
42  void after(StandardEventType, const std::string&, const StatusCode&) override;
43 
44  void after(CustomEventTypeRef, INamedInterface*, const StatusCode&) override;
45  void after(CustomEventTypeRef, const std::string&, const StatusCode&) override;
46 
47  // inform Auditors that the initialize() is about to be called
48  void beforeInitialize(INamedInterface* ini) override;
49  // inform Auditors that the initialize() has been called
50  void afterInitialize(INamedInterface* ini) override;
51 
52  // inform Auditors that the reinitialize() is about to be called
53  void beforeReinitialize(INamedInterface* ini) override;
54  // inform Auditors that the reinitialize() has been called
55  void afterReinitialize(INamedInterface* ini) override;
56 
57  // inform Auditors that the execute() is about to be called
58  void beforeExecute(INamedInterface* ini) override;
59  // inform Auditors that the execute() has been called
60  void afterExecute(INamedInterface* ini, const StatusCode& ) override;
61 
62  // inform Auditors that the beginRun() is about to be called
63  void beforeBeginRun(INamedInterface* ini) override;
64  // inform Auditors that the beginRun() has been called
65  void afterBeginRun(INamedInterface* ini) override;
66 
67  // inform Auditors that the endRun() is about to be called
68  void beforeEndRun(INamedInterface* ini) override;
69  // inform Auditors that the endRun() has been called
70  void afterEndRun(INamedInterface* ini) override;
71 
72  // inform Auditors that the finalize() is about to be called
73  void beforeFinalize(INamedInterface* ini) override;
74  // inform Auditors that the finalize() has been called
75  void afterFinalize(INamedInterface* ini) override;
76 
77  bool isEnabled() const override;
78 
79  StatusCode sysInitialize() override;
80  StatusCode sysFinalize() override;
81 
82  // management functionality: retrieve an Auditor
83  IAuditor* getAuditor( const std::string& name ) override;
84 
85  // Standard Constructor.
86  // Input: name String with service name
87  // Input: svc Pointer to service locator interface
88  AuditorSvc( const std::string& name, ISvcLocator* svc );
89 
90  // Destructor.
91  ~AuditorSvc() override = default;
92 
93 private:
94  // management helper
95  SmartIF<IAuditor> newAuditor_( MsgStream&, const std::string& );
96  SmartIF<IAuditor> findAuditor_( const std::string& );
98 
99  // List of auditor names
100  std::vector<std::string> m_audNameList;
101 
102  // Manager list of Auditors
103  std::vector<SmartIF<IAuditor>> m_pAudList;
104 
105  // To disable alltogether the auditors
106  bool m_isEnabled = true;
107 };
108 
109 #endif
void beforeBeginRun(INamedInterface *ini) override
StatusCode initialize() override
Definition: AuditorSvc.cpp:91
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
void after(StandardEventType, INamedInterface *, const StatusCode &) override
Definition: AuditorSvc.cpp:144
void afterReinitialize(INamedInterface *ini) override
StatusCode sysFinalize() override
Definition: AuditorSvc.cpp:208
void afterExecute(INamedInterface *ini, const StatusCode &) override
Definition: AuditorSvc.cpp:186
AuditorSvc(const std::string &name, ISvcLocator *svc)
Definition: AuditorSvc.cpp:82
void beforeEndRun(INamedInterface *ini) override
std::vector< SmartIF< IAuditor > > m_pAudList
Definition: AuditorSvc.h:103
void before(StandardEventType, INamedInterface *) override
The following methods are meant to be implemented by the child class...
Definition: AuditorSvc.cpp:115
bool isEnabled() const override
Definition: AuditorSvc.cpp:201
void beforeExecute(INamedInterface *ini) override
StatusCode sysInitialize() override
Definition: AuditorSvc.cpp:205
void beforeReinitialize(INamedInterface *ini) override
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
void beforeInitialize(INamedInterface *ini) override
void afterInitialize(INamedInterface *ini) override
void afterEndRun(INamedInterface *ini) override
void afterBeginRun(INamedInterface *ini) override
SmartIF< IAuditor > findAuditor_(const std::string &)
Definition: AuditorSvc.cpp:41
IInterface compliant class extending IInterface with the name() method.
void beforeFinalize(INamedInterface *ini) override
StatusCode finalize() override
Definition: AuditorSvc.cpp:103
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
~AuditorSvc() override=default
IAuditor * getAuditor(const std::string &name) override
Definition: AuditorSvc.cpp:213
SmartIF< IAuditor > newAuditor_(MsgStream &, const std::string &)
Definition: AuditorSvc.cpp:22
std::vector< std::string > m_audNameList
Definition: AuditorSvc.h:100
bool m_isEnabled
Definition: AuditorSvc.h:106
void afterFinalize(INamedInterface *ini) override
StatusCode syncAuditors_()
Definition: AuditorSvc.cpp:49
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:18