| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Auditor Class Reference

Base class from which all concrete auditor classes should be derived. More...

#include <GaudiKernel/Auditor.h>

Inheritance diagram for Auditor:

[legend]
Collaboration diagram for Auditor:
[legend]
List of all members.

Public Types

typedef std::string CustomEventType
 Type used to allow users to specify a custom event to be audit.
typedef const CustomEventTypeCustomEventTypeRef
 Used in function calls for optimization purposes.
 Initialize
 ReInitialize
 Execute
 BeginRun
 EndRun
 Finalize
 Start
 Stop
 ReStart
enum  StandardEventType {
  Initialize, ReInitialize, Execute, BeginRun,
  EndRun, Finalize, Start, Stop,
  ReStart
}
 Defines the standard (= used by the framework) auditable event types. More...
 SUCCESS = 1
 Normal successful completion.
 NO_INTERFACE
 Requested interface is not available.
 VERSMISMATCH
 Requested interface version is incompatible.
 LAST_ERROR
 Last error.
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...

Public Member Functions

 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor.
virtual ~Auditor ()
 Destructor.
StatusCode sysInitialize ()
 Initialization method invoked by the framework.
StatusCode sysFinalize ()
 Finalization method invoked by the framework.
virtual void before (StandardEventType, INamedInterface *)
 The following methods are meant to be implemented by the child class...
virtual void before (StandardEventType, const std::string &)
virtual void before (CustomEventTypeRef, INamedInterface *)
virtual void before (CustomEventTypeRef, const std::string &)
virtual void after (StandardEventType, INamedInterface *, const StatusCode &)
virtual void after (StandardEventType, const std::string &, const StatusCode &)
virtual void after (CustomEventTypeRef, INamedInterface *, const StatusCode &)
virtual void after (CustomEventTypeRef, const std::string &, const StatusCode &)
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.
virtual bool isEnabled () const
 Tell if the auditor is enabled or not.
IMessageSvcmsgSvc () const
 The standard message service.
int outputLevel () const
 Retrieve the outputlevel of current auditor.
void setOutputLevel (int level)
 Set the outputlevel for current auditor.
ISvcLocatorserviceLocator () const
 The standard service locator.
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.
virtual StatusCode setProperty (const Property &p)
 Set a value of a property of an auditor.
virtual StatusCode setProperty (const std::string &s)
 Implementation of IProperty::setProperty.
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Implementation of IProperty::setProperty.
virtual StatusCode getProperty (Property *p) const
 Get the value of a property.
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name.
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Implementation of IProperty::getProperty.
const std::vector< Property * > & getProperties () const
 Get all properties.
template<class TYPE>
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value
StatusCode setProperties ()
 Set the auditor's properties.
template<class T>
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
unsigned long addRef ()
 Methods for IInterface.
unsigned long release ()
 Release Interface instance.
StatusCode queryInterface (const InterfaceID &riid, void **)
 Query interfaces of Interface.
virtual void before (StandardEventType, INamedInterface *)=0
 Audit the start of a standard "event".
virtual void before (StandardEventType, const std::string &)=0
 Audit the start of a standard "event" for callers that do not implement INamedInterface.
virtual void before (CustomEventTypeRef, INamedInterface *)=0
 Audit the start of a custom "event".
virtual void before (CustomEventTypeRef, const std::string &)=0
 Audit the start of a custom "event" for callers that do not implement INamedInterface.
virtual void after (StandardEventType, INamedInterface *, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
 Audit the end of a standard "event".
virtual void after (StandardEventType, const std::string &, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
 Audit the end of a standard "event" for callers that do not implement INamedInterface.
virtual void after (CustomEventTypeRef, INamedInterface *, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
 Audit the end of a custom "event".
virtual void after (CustomEventTypeRef, const std::string &, const StatusCode &sc=StatusCode(StatusCode::SUCCESS, true))=0
 Audit the end of a custom "event" for callers that do not implement INamedInterface.

Static Public Member Functions

static const InterfaceIDinterfaceID ()
 Retrieve interface ID.
static const InterfaceIDinterfaceID ()
 Retrieve interface ID.

Private Member Functions

 Auditor (const Auditor &a)
Auditoroperator= (const Auditor &rhs)

Private Attributes

long m_refCount
 Counter for references to Auditor.
std::string m_name
 Auditor's name for identification.
IMessageSvcm_MS
 Message service.
ISvcLocatorm_pSvcLocator
 Pointer to service locator service.
PropertyMgrm_PropertyMgr
 For management of properties.
int m_outputLevel
 Auditor output level.
bool m_isEnabled
 Auditor is enabled flag.
bool m_isInitialized
 Auditor has been initialized flag.
bool m_isFinalized
 Auditor has been finalized flag.

Detailed Description

Base class from which all concrete auditor classes should be derived.

The only base class functionality which may be used in the constructor of a concrete auditor is the declaration of member variables as properties. All other functionality, i.e. the use of services, may be used only in initialise() and afterwards.

Author:
David Quarrie
Date:
2000
Author:
Marco Clemencic
Date:
2008-03

Definition at line 34 of file Auditor.h.


Member Typedef Documentation

typedef std::string IAuditor::CustomEventType [inherited]

Type used to allow users to specify a custom event to be audit.

Examples of custom events are callbacks (see patch #1725).

Definition at line 43 of file IAuditor.h.

typedef const CustomEventType& IAuditor::CustomEventTypeRef [inherited]

Used in function calls for optimization purposes.

Definition at line 45 of file IAuditor.h.


Member Enumeration Documentation

enum IAuditor::StandardEventType [inherited]

Defines the standard (= used by the framework) auditable event types.

Enumerator:
Initialize 
ReInitialize 
Execute 
BeginRun 
EndRun 
Finalize 
Start 
Stop 
ReStart 

Definition at line 28 of file IAuditor.h.

00028                          {
00029     Initialize,
00030     ReInitialize,
00031     Execute,
00032     BeginRun,
00033     EndRun,
00034     Finalize,
00035     Start,
00036     Stop,
00037     ReStart
00038   };

enum IInterface::Status [inherited]

Return status.

Enumerator:
SUCCESS  Normal successful completion.
NO_INTERFACE  Requested interface is not available.
VERSMISMATCH  Requested interface version is incompatible.
LAST_ERROR  Last error.

Reimplemented in IConversionSvc, IConverter, and IDataProviderSvc.

Definition at line 113 of file IInterface.h.

00113                 {
00115     SUCCESS = 1,
00117     NO_INTERFACE,
00119     VERSMISMATCH,
00121     LAST_ERROR
00122   };


Constructor & Destructor Documentation

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

Constructor.

Parameters:
name The algorithm object's name
svcloc A pointer to a service location service

virtual Auditor::~Auditor (  )  [virtual]

Destructor.

Auditor::Auditor ( const Auditor a  )  [private]


Member Function Documentation

StatusCode Auditor::sysInitialize (  )  [virtual]

Initialization method invoked by the framework.

This method is responsible for any bookkeeping of initialization required by the framework itself.

Implements IAuditor.

StatusCode Auditor::sysFinalize (  )  [virtual]

Finalization method invoked by the framework.

This method is responsible for any bookkeeping of initialization required by the framework itself.

Implements IAuditor.

virtual void Auditor::before ( StandardEventType  ,
INamedInterface  
) [virtual]

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

virtual void Auditor::before ( StandardEventType  ,
const std::string &   
) [virtual]

virtual void Auditor::before ( CustomEventTypeRef  ,
INamedInterface  
) [virtual]

virtual void Auditor::before ( CustomEventTypeRef  ,
const std::string &   
) [virtual]

virtual void Auditor::after ( StandardEventType  ,
INamedInterface ,
const StatusCode  
) [virtual]

virtual void Auditor::after ( StandardEventType  ,
const std::string &  ,
const StatusCode  
) [virtual]

virtual void Auditor::after ( CustomEventTypeRef  ,
INamedInterface ,
const StatusCode  
) [virtual]

virtual void Auditor::after ( CustomEventTypeRef  ,
const std::string &  ,
const StatusCode  
) [virtual]

virtual void Auditor::beforeInitialize ( INamedInterface  )  [virtual]

Deprecated:
use before

Implements IAuditor.

virtual void Auditor::afterInitialize ( INamedInterface  )  [virtual]

Deprecated:
use after

Implements IAuditor.

virtual void Auditor::beforeReinitialize ( INamedInterface  )  [virtual]

Deprecated:
use before

Implements IAuditor.

virtual void Auditor::afterReinitialize ( INamedInterface  )  [virtual]

Deprecated:
use after

Implements IAuditor.

virtual void Auditor::beforeExecute ( INamedInterface  )  [virtual]

Deprecated:
use before

Implements IAuditor.

virtual void Auditor::afterExecute ( INamedInterface ,
const StatusCode  
) [virtual]

Deprecated:
use after

Implements IAuditor.

virtual void Auditor::beforeFinalize ( INamedInterface  )  [virtual]

Deprecated:
use before

Implements IAuditor.

virtual void Auditor::afterFinalize ( INamedInterface  )  [virtual]

Deprecated:
use after

Implements IAuditor.

virtual void Auditor::beforeBeginRun ( INamedInterface  )  [virtual]

Deprecated:
use before

Implements IAuditor.

virtual void Auditor::afterBeginRun ( INamedInterface  )  [virtual]

Deprecated:
use after

Implements IAuditor.

virtual void Auditor::beforeEndRun ( INamedInterface  )  [virtual]

Deprecated:
use before

Implements IAuditor.

virtual void Auditor::afterEndRun ( INamedInterface  )  [virtual]

Deprecated:
use after

Implements IAuditor.

virtual StatusCode Auditor::initialize (  )  [virtual]

virtual StatusCode Auditor::finalize (  )  [virtual]

virtual const std::string& Auditor::name (  )  const [virtual]

Retrieve the name of the instance.

Implements INamedInterface.

virtual bool Auditor::isEnabled (  )  const [virtual]

Tell if the auditor is enabled or not.

Implements IAuditor.

IMessageSvc* Auditor::msgSvc (  )  const

The standard message service.

Returns a pointer to the standard message service. May not be invoked before sysInitialize() has been invoked.

int Auditor::outputLevel (  )  const [inline]

Retrieve the outputlevel of current auditor.

Definition at line 101 of file Auditor.h.

00101 { return m_outputLevel; }

void Auditor::setOutputLevel ( int  level  ) 

Set the outputlevel for current auditor.

ISvcLocator* Auditor::serviceLocator (  )  const

The standard service locator.

Returns a pointer to the service locator service. This service may be used by an auditor to request any services it requires in addition to those provided by default.

template<class T>
StatusCode Auditor::service ( const std::string &  name,
T *&  svc,
bool  createIf = false 
) const [inline]

Access a service by name, creating it if it doesn't already exist.

Definition at line 115 of file Auditor.h.

00115                                                                                     {
00116     IService* theSvc;
00117     StatusCode sc = serviceLocator()->getService( name, theSvc, createIf );
00118     if ( sc.isSuccess() ) {
00119       return theSvc->queryInterface(T::interfaceID(), (void**)&svc);
00120     }
00121     svc = 0;
00122     return sc;
00123   }

virtual StatusCode Auditor::setProperty ( const Property p  )  [virtual]

Set a value of a property of an auditor.

Implements IProperty.

virtual StatusCode Auditor::setProperty ( const std::string &  s  )  [virtual]

Implementation of IProperty::setProperty.

Implements IProperty.

virtual StatusCode Auditor::setProperty ( const std::string &  n,
const std::string &  v 
) [virtual]

Implementation of IProperty::setProperty.

Implements IProperty.

virtual StatusCode Auditor::getProperty ( Property p  )  const [virtual]

Get the value of a property.

Implements IProperty.

virtual const Property& Auditor::getProperty ( const std::string &  name  )  const [virtual]

Get the property by name.

Implements IProperty.

virtual StatusCode Auditor::getProperty ( const std::string &  n,
std::string &  v 
) const [virtual]

Implementation of IProperty::getProperty.

Implements IProperty.

const std::vector<Property*>& Auditor::getProperties (  )  const [virtual]

Get all properties.

Implements IProperty.

template<class TYPE>
StatusCode Auditor::setProperty ( const std::string &  name,
const TYPE &  value 
) [inline]

set the property form the value

  std::vector<double> data = ... ;
  setProperty( "Data" , data ) ;

  std::map<std::string,double> cuts = ... ;
  setProperty( "Cuts" , cuts ) ;

  std::map<std::string,std::string> dict = ... ;
  setProperty( "Dictionary" , dict ) ;

Note: the interface IProperty allows setting of the properties either directly from other properties or from strings only

This is very convinient in resetting of the default properties in the derived classes. E.g. without this method one needs to convert everything into strings to use IProperty::setProperty

    setProperty ( "OutputLevel" , "1"    ) ;
    setProperty ( "Enable"      , "True" ) ;
    setProperty ( "ErrorMax"    , "10"   ) ;

For simple cases it is more or less ok, but for complicated properties it is just ugly..

Parameters:
name name of the property
value value of the property
See also:
Gaudi::Utils::setProperty
Author:
Vanya BELYAEV ibelyaev@physics.syr.edu
Date:
2007-05-13

Definition at line 189 of file Auditor.h.

00191   { return Gaudi::Utils::setProperty ( m_PropertyMgr , name , value ) ; }

StatusCode Auditor::setProperties (  ) 

Set the auditor's properties.

This method requests the job options service to set the values of any declared properties. The method is invoked from within sysInitialize() by the framework and does not need to be explicitly called by a concrete auditor.

template<class T>
Property* Auditor::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
) const [inline]

Declare the named property.

  MyAuditor( ... )
     : Auditor ( ...  )
     , m_property1   ( ... )
     , m_property2   ( ... )
   {
     // declare the property
     declareProperty( "Property1" , m_property1 , "Doc fro property #1" ) ;

     // declare the property and attach the handler  to it
     declareProperty( "Property2" , m_property2 , "Doc for property #2" )
        -> declareUpdateHandler( &MyAlg::handler_2 ) ;

   }

See also:
PropertyMgr

PropertyMgr::declareProperty

Parameters:
name the property name
proeprty the property itself,
doc the documentation string
Returns:
the actual property objects

Definition at line 229 of file Auditor.h.

00230                                                                   {
00231         return m_PropertyMgr->declareProperty(name, property, doc);
00232   }

unsigned long Auditor::addRef (  )  [virtual]

Methods for IInterface.

Implements IInterface.

unsigned long Auditor::release (  )  [virtual]

Release Interface instance.

Implements IInterface.

StatusCode Auditor::queryInterface ( const InterfaceID riid,
void **   
) [virtual]

Query interfaces of Interface.

Parameters:
riid ID of Interface to be retrieved
ppvInterface Pointer to Location for interface pointer

Implements IInterface.

Auditor& Auditor::operator= ( const Auditor rhs  )  [private]

static const InterfaceID& IAuditor::interfaceID (  )  [inline, static, inherited]

Retrieve interface ID.

Reimplemented from INamedInterface.

Reimplemented in IAuditorSvc.

Definition at line 25 of file IAuditor.h.

00025 { return IID_IAuditor; }

virtual void IAuditor::before ( StandardEventType  ,
INamedInterface  
) [pure virtual, inherited]

Audit the start of a standard "event".

virtual void IAuditor::before ( StandardEventType  ,
const std::string &   
) [pure virtual, inherited]

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

virtual void IAuditor::before ( CustomEventTypeRef  ,
INamedInterface  
) [pure virtual, inherited]

Audit the start of a custom "event".

virtual void IAuditor::before ( CustomEventTypeRef  ,
const std::string &   
) [pure virtual, inherited]

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

virtual void IAuditor::after ( StandardEventType  ,
INamedInterface ,
const StatusCode sc = StatusCode(StatusCode::SUCCESS, true) 
) [pure virtual, inherited]

Audit the end of a standard "event".

virtual void IAuditor::after ( StandardEventType  ,
const std::string &  ,
const StatusCode sc = StatusCode(StatusCode::SUCCESS, true) 
) [pure virtual, inherited]

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

virtual void IAuditor::after ( CustomEventTypeRef  ,
INamedInterface ,
const StatusCode sc = StatusCode(StatusCode::SUCCESS, true) 
) [pure virtual, inherited]

Audit the end of a custom "event".

virtual void IAuditor::after ( CustomEventTypeRef  ,
const std::string &  ,
const StatusCode sc = StatusCode(StatusCode::SUCCESS, true) 
) [pure virtual, inherited]

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

static const InterfaceID& IProperty::interfaceID (  )  [inline, static, inherited]

Retrieve interface ID.

Reimplemented from IInterface.

Definition at line 28 of file IProperty.h.

00028 { return IID_IProperty; }


Member Data Documentation

long Auditor::m_refCount [private]

Counter for references to Auditor.

Definition at line 241 of file Auditor.h.

std::string Auditor::m_name [private]

Auditor's name for identification.

Definition at line 242 of file Auditor.h.

IMessageSvc* Auditor::m_MS [private]

Message service.

Definition at line 244 of file Auditor.h.

ISvcLocator* Auditor::m_pSvcLocator [private]

Pointer to service locator service.

Definition at line 245 of file Auditor.h.

PropertyMgr* Auditor::m_PropertyMgr [private]

For management of properties.

Definition at line 246 of file Auditor.h.

int Auditor::m_outputLevel [private]

Auditor output level.

Definition at line 247 of file Auditor.h.

bool Auditor::m_isEnabled [private]

Auditor is enabled flag.

Definition at line 248 of file Auditor.h.

bool Auditor::m_isInitialized [private]

Auditor has been initialized flag.

Definition at line 249 of file Auditor.h.

bool Auditor::m_isFinalized [private]

Auditor has been finalized flag.

Definition at line 250 of file Auditor.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 19:57:05 2011 for GaudiKernel by doxygen 1.4.7