The Gaudi Framework  v33r1 (b1225454)
IAuditor.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 GAUDI_IAUDITOR_H
12 #define GAUDI_IAUDITOR_H
13 
14 // Include files
16 #include <array>
17 #include <string>
18 
28 class GAUDI_API IAuditor : virtual public INamedInterface {
29 public:
32 
34  enum StandardEventType { Initialize, ReInitialize, Execute, Finalize, Start, Stop, ReStart };
35 
42 
44  virtual void before( StandardEventType, INamedInterface* ) = 0;
46  virtual void before( StandardEventType, const std::string& ) = 0;
47 
49  virtual void before( CustomEventTypeRef, INamedInterface* ) = 0;
51  virtual void before( CustomEventTypeRef, const std::string& ) = 0;
52 
54  virtual void after( StandardEventType, INamedInterface*,
55  const StatusCode& sc = StatusCode( StatusCode::SUCCESS, true ) ) = 0;
57  virtual void after( StandardEventType, const std::string&,
58  const StatusCode& sc = StatusCode( StatusCode::SUCCESS, true ) ) = 0;
59 
61  virtual void after( CustomEventTypeRef, INamedInterface*,
62  const StatusCode& sc = StatusCode( StatusCode::SUCCESS, true ) ) = 0;
64  virtual void after( CustomEventTypeRef, const std::string&,
65  const StatusCode& sc = StatusCode( StatusCode::SUCCESS, true ) ) = 0;
66 
68  virtual bool isEnabled() const = 0;
69 
70  // ------- Obsolete interface ------
72  virtual void beforeInitialize( INamedInterface* ) = 0;
74  virtual void afterInitialize( INamedInterface* ) = 0;
75 
77  virtual void beforeReinitialize( INamedInterface* ) = 0;
79  virtual void afterReinitialize( INamedInterface* ) = 0;
80 
82  virtual void beforeExecute( INamedInterface* ) = 0;
84  virtual void afterExecute( INamedInterface*, const StatusCode& ) = 0;
85 
87  virtual void beforeFinalize( INamedInterface* ) = 0;
89  virtual void afterFinalize( INamedInterface* ) = 0;
90 
92  virtual StatusCode sysInitialize() = 0;
93 
95  virtual StatusCode sysFinalize() = 0;
96 };
97 
99 inline const char* toStr( IAuditor::StandardEventType e ) {
101  {"Initialize", "ReInitialize", "Execute", "Finalize", "Start", "Stop", "ReStart"}};
102  return e <= IAuditor::StandardEventType::ReStart ? s_tbl[e] : nullptr;
103 }
104 
106 
107 #endif // GAUDIKERNEL_IAUDITOR_H
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:99
StandardEventType
Defines the standard (= used by the framework) auditable event types.
Definition: IAuditor.h:34
DeclareInterfaceID(INamedInterface, 1, 0)
InterfaceID.
const CustomEventType & CustomEventTypeRef
Used in function calls for optimization purposes.
Definition: IAuditor.h:41
constexpr static const auto SUCCESS
Definition: StatusCode.h:100
STL class.
std::ostream & operator<<(std::ostream &s, IAuditor::StandardEventType e)
Definition: IAuditor.h:105
std::string CustomEventType
Type used to allow users to specify a custom event to be audit.
Definition: IAuditor.h:39
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
IInterface compliant class extending IInterface with the name() method.
string s
Definition: gaudirun.py:328
STL class.
#define GAUDI_API
Definition: Kernel.h:81
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:28
STL class.