Gaudi Framework, version v23r8

Home   Generated: Fri May 31 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Auditor Class Reference

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

#include <GaudiKernel/Auditor.h>

Inheritance diagram for Auditor:
Inheritance graph
[legend]
Collaboration diagram for Auditor:
Collaboration graph
[legend]

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::stringname () const
 
virtual bool isEnabled () const
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service.
 
int outputLevel () const
 Retrieve the output level of current auditor.
 
void setOutputLevel (int level)
 Set the output level for current auditor.
 
SmartIF< ISvcLocator > & serviceLocator () 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.
 

Private Member Functions

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

Private Attributes

std::string m_name
 Auditor's name for identification.
 
SmartIF< IMessageSvcm_MS
 Message service.
 
SmartIF< 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.
 

Additional Inherited Members

- Public Types inherited from implements2< IAuditor, IProperty >
typedef implements2 base_class
 Typedef to this class.
 
typedef extend_interfaces2
< IAuditor, IProperty
extend_interfaces_base
 Typedef to the base of this class.
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces.
 

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 initialize() and afterwards.

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

Definition at line 34 of file Auditor.h.

Constructor & Destructor Documentation

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

Constructor.

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

Definition at line 14 of file Auditor.cpp.

m_pSvcLocator(pSvcLocator),
m_isEnabled(true),
{
// Declare common Auditor properties with their defaults
declareProperty( "Enable", m_isEnabled = true);
}
Auditor::~Auditor ( )
virtual

Destructor.

Definition at line 29 of file Auditor.cpp.

{
delete m_PropertyMgr;
}
Auditor::Auditor ( const Auditor a)
private

Member Function Documentation

void Auditor::after ( StandardEventType  evt,
INamedInterface obj,
const StatusCode sc 
)
virtual

Reimplemented in PerfMonAuditor, Google::AuditorBase, IntelProfilerAuditor, TimingAuditor, and CommonAuditor.

Definition at line 122 of file Auditor.cpp.

{
switch (evt) {
case Initialize: afterInitialize(obj); break;
case ReInitialize: afterReinitialize(obj); break;
case Execute: afterExecute(obj, sc); break;
case BeginRun: afterBeginRun(obj); break;
case EndRun: afterEndRun(obj); break;
case Finalize: afterFinalize(obj); break;
case Start: break;
case Stop: break;
case ReStart: break;
default: break ;// do nothing
}
}
void Auditor::after ( StandardEventType  ,
const std::string ,
const StatusCode  
)
virtual

Reimplemented in Google::AuditorBase, and CommonAuditor.

Definition at line 136 of file Auditor.cpp.

{}
void Auditor::after ( CustomEventTypeRef  ,
INamedInterface ,
const StatusCode  
)
virtual

Reimplemented in Google::AuditorBase, and CommonAuditor.

Definition at line 138 of file Auditor.cpp.

{}
void Auditor::after ( CustomEventTypeRef  ,
const std::string ,
const StatusCode  
)
virtual

Reimplemented in Google::AuditorBase, TimingAuditor, and CommonAuditor.

Definition at line 139 of file Auditor.cpp.

{}
void Auditor::afterBeginRun ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase.

Definition at line 155 of file Auditor.cpp.

{}
void Auditor::afterEndRun ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase.

Definition at line 159 of file Auditor.cpp.

{}
void Auditor::afterExecute ( INamedInterface ,
const StatusCode  
)
virtual

Reimplemented in Google::AuditorBase, AlgContextAuditor, and AlgErrorAuditor.

Definition at line 151 of file Auditor.cpp.

{}
void Auditor::afterFinalize ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase, and AlgContextAuditor.

Definition at line 163 of file Auditor.cpp.

{}
void Auditor::afterInitialize ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase, and AlgContextAuditor.

Definition at line 143 of file Auditor.cpp.

{}
void Auditor::afterReinitialize ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase.

Definition at line 147 of file Auditor.cpp.

{}
void Auditor::before ( StandardEventType  evt,
INamedInterface obj 
)
virtual

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

Reimplemented in PerfMonAuditor, Google::AuditorBase, IntelProfilerAuditor, TimingAuditor, and CommonAuditor.

Definition at line 102 of file Auditor.cpp.

{
switch (evt) {
case Initialize: beforeInitialize(obj); break;
case ReInitialize: beforeReinitialize(obj); break;
case Execute: beforeExecute(obj); break;
case BeginRun: beforeBeginRun(obj); break;
case EndRun: beforeEndRun(obj); break;
case Finalize: beforeFinalize(obj); break;
case Start: break;
case Stop: break;
case ReStart: break;
default: break ;// do nothing
}
}
void Auditor::before ( StandardEventType  ,
const std::string  
)
virtual

Reimplemented in Google::AuditorBase, and CommonAuditor.

Definition at line 116 of file Auditor.cpp.

{}
void Auditor::before ( CustomEventTypeRef  ,
INamedInterface  
)
virtual

Reimplemented in Google::AuditorBase, and CommonAuditor.

Definition at line 118 of file Auditor.cpp.

{}
void Auditor::before ( CustomEventTypeRef  ,
const std::string  
)
virtual

Reimplemented in Google::AuditorBase, TimingAuditor, and CommonAuditor.

Definition at line 119 of file Auditor.cpp.

{}
void Auditor::beforeBeginRun ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase.

Definition at line 153 of file Auditor.cpp.

{}
void Auditor::beforeEndRun ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase.

Definition at line 157 of file Auditor.cpp.

{}
void Auditor::beforeExecute ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase, AlgContextAuditor, and AlgErrorAuditor.

Definition at line 149 of file Auditor.cpp.

{}
void Auditor::beforeFinalize ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase, and AlgContextAuditor.

Definition at line 161 of file Auditor.cpp.

{}
void Auditor::beforeInitialize ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase, and AlgContextAuditor.

Definition at line 141 of file Auditor.cpp.

{}
void Auditor::beforeReinitialize ( INamedInterface )
virtual

Reimplemented in Google::AuditorBase.

Definition at line 145 of file Auditor.cpp.

{}
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 for property #1" ) ;
// declare the property and attach the handler to it
declareProperty( "Property2" , m_property2 , "Doc for property #2" )
-> declareUpdateHandler( &MyAuditor::handler_2 ) ;
}
See Also
PropertyMgr
PropertyMgr::declareProperty
Parameters
namethe property name
propertythe property itself,
docthe documentation string
Returns
the actual property objects

Definition at line 230 of file Auditor.h.

{
return m_PropertyMgr->declareProperty(name, property, doc);
}
StatusCode Auditor::finalize ( )
virtual

Reimplemented in PerfMonAuditor, Google::AuditorBase, TimingAuditor, AlgContextAuditor, and AlgErrorAuditor.

Definition at line 213 of file Auditor.cpp.

{
m_MS = 0; // release message service
}
const std::vector< Property * > & Auditor::getProperties ( ) const

Get all properties.

Definition at line 274 of file Auditor.cpp.

{
}
StatusCode Auditor::getProperty ( Property p) const
virtual

Get the value of a property.

Definition at line 265 of file Auditor.cpp.

{
}
const Property & Auditor::getProperty ( const std::string name) const
virtual

Get the property by name.

Definition at line 268 of file Auditor.cpp.

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

Implementation of IProperty::getProperty.

Definition at line 271 of file Auditor.cpp.

{
return m_PropertyMgr->getProperty(n,v);
}
StatusCode Auditor::initialize ( )
virtual
bool Auditor::isEnabled ( ) const
virtual

Definition at line 222 of file Auditor.cpp.

{
return m_isEnabled;
}
SmartIF< 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.

Definition at line 226 of file Auditor.cpp.

{
return m_MS;
}
const std::string & Auditor::name ( ) const
virtual

Definition at line 218 of file Auditor.cpp.

{
return m_name;
}
Auditor& Auditor::operator= ( const Auditor rhs)
private
int Auditor::outputLevel ( ) const
inline

Retrieve the output level of current auditor.

Definition at line 100 of file Auditor.h.

{ return m_outputLevel; }
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 114 of file Auditor.h.

{
SmartIF<T> ptr(serviceLocator()->service(name, createIf));
if (ptr.isValid()) {
svc = ptr.get();
svc->addRef();
}
// else
svc = 0;
}
SmartIF< 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.

Definition at line 236 of file Auditor.cpp.

{
return m_pSvcLocator;
}
void Auditor::setOutputLevel ( int  level)

Set the output level for current auditor.

Definition at line 230 of file Auditor.cpp.

{
if( m_MS != 0) {
m_MS->setOutputLevel( name(), level );
}
}
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.

Definition at line 241 of file Auditor.cpp.

{
if( m_pSvcLocator != 0 ) {
StatusCode sc = service("JobOptionsSvc", jos);
if( sc.isSuccess() ) {
jos->setMyProperties( name(), this ).ignore();
jos->release();
}
}
}
StatusCode Auditor::setProperty ( const Property p)
virtual

Set a value of a property of an auditor.

Definition at line 256 of file Auditor.cpp.

{
}
StatusCode Auditor::setProperty ( const std::string s)
virtual

Implementation of IProperty::setProperty.

Definition at line 259 of file Auditor.cpp.

{
}
StatusCode Auditor::setProperty ( const std::string n,
const std::string v 
)
virtual

Implementation of IProperty::setProperty.

Definition at line 262 of file Auditor.cpp.

{
return m_PropertyMgr->setProperty(n,v);
}
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 ) ;
setProperty( "Cuts" , cuts ) ;
setProperty( "Dictionary" , dict ) ;

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

This is very convenient 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
namename of the property
valuevalue of the property
See Also
Gaudi::Utils::setProperty
Author
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-05-13

Definition at line 190 of file Auditor.h.

{ return Gaudi::Utils::setProperty ( m_PropertyMgr , name , value ) ; }
StatusCode Auditor::sysFinalize ( )

Finalization method invoked by the framework.

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

RETURN !!!

catch GaudiExeption

(1) perform the printout of message

(2) print the exception itself (NB! - GaudiException is a linked list of all "previous exceptions")

catch std::exception

(1) perform the printout of message

(2) print the exception itself

catch unknown exception

(1) perform the printout

Definition at line 165 of file Auditor.cpp.

{
try{
//
// Invoke the finalize() method of the derived class if
// it has been initialized.
m_isFinalized = true;
sc = finalize();
if( !sc.isSuccess() ) return StatusCode::FAILURE;
}
return sc;
//
}
catch( const GaudiException& Exception )
{
MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
<< " Exception with tag=" << Exception.tag() << " is catched " << endmsg;
MsgStream logEx ( msgSvc() , Exception.tag() );
logEx << MSG::ERROR
<< Exception << endmsg;
}
catch( const std::exception& Exception )
{
MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
<< " Standard std::exception is caught " << endmsg;
MsgStream logEx ( msgSvc() , name() + "*std::exception*" );
logEx << MSG::ERROR
<< Exception.what() << endmsg;
}
catch( ... )
{
MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
<< " UNKNOWN Exception is caught " << endmsg;
}
}
StatusCode Auditor::sysInitialize ( )

Initialization method invoked by the framework.

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

RETURN !!!

catch Gaudi Exception

(1) perform the printout of message

(2) print the exception itself (NB! - GaudiException is a linked list of all "previous exceptions")

catch std::exception

(1) perform the printout of message

(2) print the exception itself (NB! - GaudiException is a linked list of all "previous exceptions")

(1) perform the printout

Definition at line 34 of file Auditor.cpp.

{
// Bypass the initialization if the auditor is disabled or
// has already been initialized.
if ( isEnabled( ) && ! m_isInitialized ) {
// Setup the default service ... this should be upgraded so as to be configurable.
if( m_pSvcLocator == 0 )
// Set up message service
m_MS = serviceLocator(); // get default message service
if( !m_MS.isValid() ) return StatusCode::FAILURE;
// Set the Auditor's properties
sc = setProperties();
if( !sc.isSuccess() ) return StatusCode::FAILURE;
// Check current outputLevel to eventually inform the MessagsSvc
}
{
try{
// Invoke the initialize() method of the derived class
sc = initialize();
if( !sc.isSuccess() ) return StatusCode::FAILURE;
return sc;
}
catch ( const GaudiException& Exception )
{
MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
log << MSG::FATAL << " Exception with tag=" << Exception.tag() << " is catched " << endmsg;
MsgStream logEx ( msgSvc() , Exception.tag() );
logEx << MSG::ERROR << Exception << endmsg;
}
catch( const std::exception& Exception )
{
MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
log << MSG::FATAL << " Standard std::exception is catched " << endmsg;
MsgStream logEx ( msgSvc() , name() + "*std::exception*" );
logEx << MSG::ERROR << Exception.what() << endmsg;
}
catch(...)
{
MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
log << MSG::FATAL << " UNKNOWN Exception is catched " << endmsg;
}
}
}
}

Member Data Documentation

bool Auditor::m_isEnabled
private

Auditor is enabled flag.

Definition at line 243 of file Auditor.h.

bool Auditor::m_isFinalized
private

Auditor has been finalized flag.

Definition at line 245 of file Auditor.h.

bool Auditor::m_isInitialized
private

Auditor has been initialized flag.

Definition at line 244 of file Auditor.h.

SmartIF<IMessageSvc> Auditor::m_MS
mutableprivate

Message service.

Definition at line 239 of file Auditor.h.

std::string Auditor::m_name
private

Auditor's name for identification.

Definition at line 237 of file Auditor.h.

int Auditor::m_outputLevel
private

Auditor output level.

Definition at line 242 of file Auditor.h.

PropertyMgr* Auditor::m_PropertyMgr
private

For management of properties.

Definition at line 241 of file Auditor.h.

SmartIF<ISvcLocator> Auditor::m_pSvcLocator
mutableprivate

Pointer to service locator service.

Definition at line 240 of file Auditor.h.


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

Generated at Fri May 31 2013 15:09:13 for Gaudi Framework, version v23r8 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004