CommonAuditor.cpp
Go to the documentation of this file.
1 #include "CommonAuditor.h"
2 
3 CommonAuditor::CommonAuditor(const std::string& name, ISvcLocator *svcloc): Auditor(name, svcloc) {
4  declareProperty("EventTypes", m_types,
5  "List of event types to audit ([]=all, ['none']=none)");
6  declareProperty("CustomEventTypes", m_customTypes,
7  "OBSOLETE, use EventTypes instead")->declareUpdateHandler(&CommonAuditor::i_updateCustomTypes, this);
8 }
9 
11  MsgStream log(msgSvc(), name());
12  log << MSG::WARNING << "Property CustomEventTypes is deprecated, use EventTypes instead" << endmsg;
14 }
15 
16 void CommonAuditor::before(StandardEventType evt, INamedInterface* caller)
17 {
18  if (caller) before(toStr(evt), caller->name());
19 }
20 void CommonAuditor::before(StandardEventType evt, const std::string& caller)
21 {
22  before(toStr(evt), caller);
23 }
24 void CommonAuditor::before(CustomEventTypeRef evt, INamedInterface* caller)
25 {
26  if (caller) before(evt, caller->name());
27 }
28 void CommonAuditor::before(CustomEventTypeRef evt, const std::string& caller)
29 {
30  if (i_auditEventType(evt)) i_before(evt, caller);
31 }
32 
33 void CommonAuditor::after(StandardEventType evt, INamedInterface* caller, const StatusCode& sc)
34 {
35  if (caller) after(toStr(evt), caller->name(), sc);
36 }
37 void CommonAuditor::after(StandardEventType evt, const std::string& caller, const StatusCode& sc)
38 {
39  after(toStr(evt), caller, sc);
40 }
41 void CommonAuditor::after(CustomEventTypeRef evt, INamedInterface* caller, const StatusCode& sc)
42 {
43  if (caller) after(evt, caller->name(), sc);
44 }
45 void CommonAuditor::after(CustomEventTypeRef evt, const std::string& caller, const StatusCode& sc)
46 {
47  if (i_auditEventType(evt)) i_after(evt, caller, sc);
48 }
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Auditor.cpp:220
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
virtual void before(StandardEventType evt, const std::string &caller)
bool setValue(const TYPE &value) override
implementation of PropertyWithValue::setValue
Definition: Property.h:406
virtual const std::string & name() const =0
Retrieve the name of the instance.
bool i_auditEventType(const std::string &evt)
Check if we are requested to audit the passed event type.
Definition: CommonAuditor.h:42
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Auditor.h:241
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
void i_updateCustomTypes(Property &)
Update handler for the obsolete property CustomEventTypes.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StringArrayProperty m_customTypes
Definition: CommonAuditor.h:58
const TYPE & value() const
explicit conversion
Definition: Property.h:341
IInterface compliant class extending IInterface with the name() method.
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
const std::string & name() const override
Definition: Auditor.cpp:212
CommonAuditor(const std::string &name, ISvcLocator *svcloc)
Constructor.
virtual void after(StandardEventType evt, const std::string &caller, const StatusCode &sc)
virtual void i_before(CustomEventTypeRef evt, const std::string &caller)=0
catch all "before" method, implemented in the derived class
StringArrayProperty m_types
Definition: CommonAuditor.h:54
virtual void i_after(CustomEventTypeRef evt, const std::string &caller, const StatusCode &sc)=0
catch all "after" method, implemented in the derived class
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:34