All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
13  MsgStream log(msgSvc(), name());
14  log << MSG::WARNING << "Property CustomEventTypes is deprecated, use EventTypes instead" << endmsg;
16 }
17 
19 {
20  if (caller) before(toStr(evt), caller->name());
21 }
22 void CommonAuditor::before(StandardEventType evt, const std::string& caller)
23 {
24  before(toStr(evt), caller);
25 }
27 {
28  if (caller) before(evt, caller->name());
29 }
30 void CommonAuditor::before(CustomEventTypeRef evt, const std::string& caller)
31 {
32  if (i_auditEventType(evt)) i_before(evt, caller);
33 }
34 
36 {
37  if (caller) after(toStr(evt), caller->name(), sc);
38 }
39 void CommonAuditor::after(StandardEventType evt, const std::string& caller, const StatusCode& sc)
40 {
41  after(toStr(evt), caller, sc);
42 }
44 {
45  if (caller) after(evt, caller->name(), sc);
46 }
47 void CommonAuditor::after(CustomEventTypeRef evt, const std::string& caller, const StatusCode& sc)
48 {
49  if (i_auditEventType(evt)) i_after(evt, caller, sc);
50 }
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
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:26
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Auditor.cpp:226
StandardEventType
Defines the standard (= used by the framework) auditable event types.
Definition: IAuditor.h:24
virtual void before(StandardEventType evt, const std::string &caller)
Audit the start of a standard "event" for callers that do not implement INamedInterface.
const CustomEventType & CustomEventTypeRef
Used in function calls for optimization purposes.
Definition: IAuditor.h:41
virtual ~CommonAuditor()
Destructor.
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
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Auditor.h:233
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:30
StringArrayProperty m_customTypes
Definition: CommonAuditor.h:58
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual bool setValue(const TYPE &value)
implementation of PropertyWithValue::setValue
Definition: Property.h:420
IInterface compliant class extending IInterface with the name() method.
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:43
CommonAuditor(const std::string &name, ISvcLocator *svcloc)
Constructor.
virtual void after(StandardEventType evt, const std::string &caller, const StatusCode &sc)
Audit the end of a standard "event" for callers that do not implement INamedInterface.
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
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243
Base class from which all concrete auditor classes should be derived.
Definition: Auditor.h:34