CommonAuditor.h
Go to the documentation of this file.
1 #include "GaudiKernel/Auditor.h"
2 
5 class CommonAuditor : public Auditor
6 {
7 public:
11  CommonAuditor( const std::string& name, ISvcLocator* svcloc );
13  ~CommonAuditor() override = default;
14 
18 
19  void before( StandardEventType evt, const std::string& caller ) override;
20  void before( StandardEventType evt, INamedInterface* caller ) override;
21  void before( CustomEventTypeRef evt, const std::string& caller ) override;
22  void before( CustomEventTypeRef evt, INamedInterface* caller ) override;
24 
28 
29  void after( StandardEventType evt, const std::string& caller, const StatusCode& sc ) override;
30  void after( StandardEventType evt, INamedInterface* caller, const StatusCode& sc ) override;
31  void after( CustomEventTypeRef evt, const std::string& caller, const StatusCode& sc ) override;
32  void after( CustomEventTypeRef evt, INamedInterface* caller, const StatusCode& sc ) override;
34 
35 protected:
37  virtual void i_before( CustomEventTypeRef evt, const std::string& caller ) = 0;
39  virtual void i_after( CustomEventTypeRef evt, const std::string& caller, const StatusCode& sc ) = 0;
40 
42  inline bool i_auditEventType( const std::string& evt )
43  {
44  // Note: there is no way to extract from a Property type the type returned by
45  // value().
46  const std::vector<std::string>& v = m_types.value();
47  // we need to return true is the list is empty or when the list does't
48  // start by "none" and the list contain the event we got.
49  return v.empty() || ( ( v[0] != "none" ) && ( find( v.begin(), v.end(), evt ) != v.end() ) );
50  }
51 
53  this, "EventTypes", {}, "list of event types to audit ([]=all, ['none']=none)"};
55  this, "CustomEventTypes", {}, "[[deprecated]] use EventTypes instead"};
56 };
T empty(T...args)
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Implementation of property with value of concrete type.
Definition: Property.h:314
Base class with common functionalities shared by few auditor implementations.
Definition: CommonAuditor.h:5
Gaudi::Property< std::vector< std::string > > m_types
Definition: CommonAuditor.h:52
void before(StandardEventType evt, const std::string &caller) override
T end(T...args)
STL class.
bool i_auditEventType(const std::string &evt)
Check if we are requested to audit the passed event type.
Definition: CommonAuditor.h:42
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface compliant class extending IInterface with the name() method.
T begin(T...args)
Gaudi::Property< std::vector< std::string > > m_customTypes
Definition: CommonAuditor.h:54
~CommonAuditor() override=default
Destructor.
CommonAuditor(const std::string &name, ISvcLocator *svcloc)
Constructor.
virtual void i_before(CustomEventTypeRef evt, const std::string &caller)=0
catch all "before" method, implemented in the derived class
void after(StandardEventType evt, const std::string &caller, const StatusCode &sc) override
virtual void i_after(CustomEventTypeRef evt, const std::string &caller, const StatusCode &sc)=0
catch all "after" method, implemented in the derived class
const std::string & name() const override
Definition: Auditor.cpp:202
evt
Definition: IOTest.py:85
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:35