All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CommonAuditor Class Referenceabstract

Base class with common functionalities shared by few auditor implementations. More...

#include <src/CommonAuditor.h>

Inheritance diagram for CommonAuditor:
Collaboration diagram for CommonAuditor:

Public Member Functions

 CommonAuditor (const std::string &name, ISvcLocator *svcloc)
 Constructor. More...
 
virtual ~CommonAuditor ()
 Destructor. More...
 
"before" Auditor hooks

The default behavior is to fall back on the version accepting 2 strings, which must be implemented in the derived class.

virtual void before (StandardEventType evt, const std::string &caller)
 Audit the start of a standard "event" for callers that do not implement INamedInterface. More...
 
virtual void before (StandardEventType evt, INamedInterface *caller)
 The following methods are meant to be implemented by the child class... More...
 
virtual void before (CustomEventTypeRef evt, const std::string &caller)
 Audit the start of a custom "event" for callers that do not implement INamedInterface. More...
 
virtual void before (CustomEventTypeRef evt, INamedInterface *caller)
 Audit the start of a custom "event". More...
 
"after" Auditor hooks

The default behavior is to fall back on the version accepting 2 strings, which must be implemented in the derived class.

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. More...
 
virtual void after (StandardEventType evt, INamedInterface *caller, const StatusCode &sc)
 Audit the end of a standard "event". More...
 
virtual void after (CustomEventTypeRef evt, const std::string &caller, const StatusCode &sc)
 Audit the end of a custom "event" for callers that do not implement INamedInterface. More...
 
virtual void after (CustomEventTypeRef evt, INamedInterface *caller, const StatusCode &sc)
 Audit the end of a custom "event". More...
 
- Public Member Functions inherited from Auditor
 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor. More...
 
virtual ~Auditor ()
 Destructor. More...
 
StatusCode sysInitialize ()
 Initialization method invoked by the framework. More...
 
StatusCode sysFinalize ()
 Finalization method invoked by the framework. More...
 
virtual void beforeInitialize (INamedInterface *)
 
virtual void afterInitialize (INamedInterface *)
 
virtual void beforeReinitialize (INamedInterface *)
 
virtual void afterReinitialize (INamedInterface *)
 
virtual void beforeExecute (INamedInterface *)
 
virtual void afterExecute (INamedInterface *, const StatusCode &)
 
virtual void beforeFinalize (INamedInterface *)
 
virtual void afterFinalize (INamedInterface *)
 
virtual void beforeBeginRun (INamedInterface *)
 
virtual void afterBeginRun (INamedInterface *)
 
virtual void beforeEndRun (INamedInterface *)
 
virtual void afterEndRun (INamedInterface *)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual const std::string & name () const
 Retrieve the name of the instance. More...
 
virtual bool isEnabled () const
 Tell if the auditor is enabled or not. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
int outputLevel () const
 Retrieve the output level of current auditor. More...
 
void setOutputLevel (int level)
 Set the output level for current auditor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 The standard service locator. More...
 
template<class T >
StatusCode service (const std::string &name, T *&svc, bool createIf=false) const
 Access a service by name, creating it if it doesn't already exist. More...
 
virtual StatusCode setProperty (const Property &p)
 Set a value of a property of an auditor. More...
 
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the value of a property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty. More...
 
const std::vector< Property * > & getProperties () const
 Get all properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode setProperties ()
 Set the auditor's properties. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
- Public Member Functions inherited from extend_interfaces2< IAuditor, IProperty >
virtual ~extend_interfaces2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAuditor
 DeclareInterfaceID (IAuditor, 3, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 

Protected Member Functions

virtual void i_before (CustomEventTypeRef evt, const std::string &caller)=0
 catch all "before" method, implemented in the derived class More...
 
virtual void i_after (CustomEventTypeRef evt, const std::string &caller, const StatusCode &sc)=0
 catch all "after" method, implemented in the derived class More...
 
bool i_auditEventType (const std::string &evt)
 Check if we are requested to audit the passed event type. More...
 
void i_updateCustomTypes (Property &)
 Update handler for the obsolete property CustomEventTypes. More...
 

Protected Attributes

StringArrayProperty m_types
 
StringArrayProperty m_customTypes
 

Additional Inherited Members

- Public Types inherited from Auditor
typedef
Gaudi::PluginService::Factory
< IAuditor *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from implements2< IAuditor, IProperty >
typedef implements2 base_class
 Typedef to this class. More...
 
typedef extend_interfaces2
< IAuditor, IProperty
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces2< IAuditor, IProperty >
typedef mpl::fold< typename
IAuditor::iid::iids::type,
typename
IProperty::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IAuditor
enum  StandardEventType {
  Initialize, ReInitialize, Execute, BeginRun,
  EndRun, Finalize, Start, Stop,
  ReStart
}
 Defines the standard (= used by the framework) auditable event types. More...
 
typedef std::string CustomEventType
 Type used to allow users to specify a custom event to be audit. More...
 
typedef const CustomEventTypeCustomEventTypeRef
 Used in function calls for optimization purposes. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

Base class with common functionalities shared by few auditor implementations.

Author
Marco Clemencic

Definition at line 5 of file CommonAuditor.h.

Constructor & Destructor Documentation

CommonAuditor::CommonAuditor ( const std::string &  name,
ISvcLocator svcloc 
)

Constructor.

Parameters
nameThe algorithm object's name
svclocA pointer to a service location service

Definition at line 3 of file CommonAuditor.cpp.

3  : 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 }
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
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:235
void i_updateCustomTypes(Property &)
Update handler for the obsolete property CustomEventTypes.
Auditor(const std::string &name, ISvcLocator *svcloc)
Constructor.
Definition: Auditor.cpp:14
StringArrayProperty m_customTypes
Definition: CommonAuditor.h:58
StringArrayProperty m_types
Definition: CommonAuditor.h:54
CommonAuditor::~CommonAuditor ( )
virtual

Destructor.

Definition at line 10 of file CommonAuditor.cpp.

10 {}

Member Function Documentation

void CommonAuditor::after ( StandardEventType  ,
const std::string &  ,
const StatusCode sc 
)
virtual

Audit the end of a standard "event" for callers that do not implement INamedInterface.

Reimplemented from Auditor.

Definition at line 39 of file CommonAuditor.cpp.

40 {
41  after(toStr(evt), caller, sc);
42 }
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
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.
void CommonAuditor::after ( StandardEventType  ,
INamedInterface ,
const StatusCode sc 
)
virtual

Audit the end of a standard "event".

Reimplemented from Auditor.

Definition at line 35 of file CommonAuditor.cpp.

36 {
37  if (caller) after(toStr(evt), caller->name(), sc);
38 }
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
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.
void CommonAuditor::after ( CustomEventTypeRef  ,
const std::string &  ,
const StatusCode sc 
)
virtual

Audit the end of a custom "event" for callers that do not implement INamedInterface.

Reimplemented from Auditor.

Definition at line 47 of file CommonAuditor.cpp.

48 {
49  if (i_auditEventType(evt)) i_after(evt, caller, sc);
50 }
bool i_auditEventType(const std::string &evt)
Check if we are requested to audit the passed event type.
Definition: CommonAuditor.h:42
virtual void i_after(CustomEventTypeRef evt, const std::string &caller, const StatusCode &sc)=0
catch all "after" method, implemented in the derived class
void CommonAuditor::after ( CustomEventTypeRef  ,
INamedInterface ,
const StatusCode sc 
)
virtual

Audit the end of a custom "event".

Reimplemented from Auditor.

Definition at line 43 of file CommonAuditor.cpp.

44 {
45  if (caller) after(evt, caller->name(), sc);
46 }
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.
void CommonAuditor::before ( StandardEventType  ,
const std::string &   
)
virtual

Audit the start of a standard "event" for callers that do not implement INamedInterface.

Reimplemented from Auditor.

Definition at line 22 of file CommonAuditor.cpp.

23 {
24  before(toStr(evt), caller);
25 }
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
virtual void before(StandardEventType evt, const std::string &caller)
Audit the start of a standard "event" for callers that do not implement INamedInterface.
void CommonAuditor::before ( StandardEventType  evt,
INamedInterface obj 
)
virtual

The following methods are meant to be implemented by the child class...

Reimplemented from Auditor.

Definition at line 18 of file CommonAuditor.cpp.

19 {
20  if (caller) before(toStr(evt), caller->name());
21 }
const char * toStr(IAuditor::StandardEventType e)
Simple mapping function from IAuditor::StandardEventType to string.
Definition: IAuditor.h:106
virtual void before(StandardEventType evt, const std::string &caller)
Audit the start of a standard "event" for callers that do not implement INamedInterface.
void CommonAuditor::before ( CustomEventTypeRef  ,
const std::string &   
)
virtual

Audit the start of a custom "event" for callers that do not implement INamedInterface.

Reimplemented from Auditor.

Definition at line 30 of file CommonAuditor.cpp.

31 {
32  if (i_auditEventType(evt)) i_before(evt, caller);
33 }
bool i_auditEventType(const std::string &evt)
Check if we are requested to audit the passed event type.
Definition: CommonAuditor.h:42
virtual void i_before(CustomEventTypeRef evt, const std::string &caller)=0
catch all "before" method, implemented in the derived class
void CommonAuditor::before ( CustomEventTypeRef  ,
INamedInterface  
)
virtual

Audit the start of a custom "event".

Reimplemented from Auditor.

Definition at line 26 of file CommonAuditor.cpp.

27 {
28  if (caller) before(evt, caller->name());
29 }
virtual void before(StandardEventType evt, const std::string &caller)
Audit the start of a standard "event" for callers that do not implement INamedInterface.
virtual void CommonAuditor::i_after ( CustomEventTypeRef  evt,
const std::string &  caller,
const StatusCode sc 
)
protectedpure virtual

catch all "after" method, implemented in the derived class

Implemented in ChronoAuditor, MemoryAuditor, and NameAuditor.

bool CommonAuditor::i_auditEventType ( const std::string &  evt)
inlineprotected

Check if we are requested to audit the passed event type.

Definition at line 42 of file CommonAuditor.h.

42  {
43  // Note: there is no way to extract from a Property type the type returned by
44  // value().
45  const std::vector<std::string> &v = m_types.value();
46  // we need to return true is the list is empty or when the list does't
47  // start by "none" and the list contain the event we got.
48  return (v.size() == 0) || (
49  (v[0] != "none") &&
50  (find(v.begin(), v.end(), evt) != v.end())
51  );
52  }
const TYPE & value() const
explicit conversion
Definition: Property.h:355
StringArrayProperty m_types
Definition: CommonAuditor.h:54
virtual void CommonAuditor::i_before ( CustomEventTypeRef  evt,
const std::string &  caller 
)
protectedpure virtual

catch all "before" method, implemented in the derived class

Implemented in ChronoAuditor, MemStatAuditor, MemoryAuditor, and NameAuditor.

void CommonAuditor::i_updateCustomTypes ( Property )
protected

Update handler for the obsolete property CustomEventTypes.

Definition at line 12 of file CommonAuditor.cpp.

12  {
13  MsgStream log(msgSvc(), name());
14  log << MSG::WARNING << "Property CustomEventTypes is deprecated, use EventTypes instead" << endmsg;
16 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
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
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
StringArrayProperty m_types
Definition: CommonAuditor.h:54
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

Member Data Documentation

StringArrayProperty CommonAuditor::m_customTypes
protected

Definition at line 58 of file CommonAuditor.h.

StringArrayProperty CommonAuditor::m_types
protected

Definition at line 54 of file CommonAuditor.h.


The documentation for this class was generated from the following files: