All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Auditor Class Reference

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

#include <GaudiKernel/Auditor.h>

Inheritance diagram for Auditor:
Collaboration diagram for Auditor:

Public Types

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...
 

Public Member Functions

 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 before (StandardEventType, INamedInterface *)
 The following methods are meant to be implemented by the child class... More...
 
virtual void before (StandardEventType, const std::string &)
 Audit the start of a standard "event" for callers that do not implement INamedInterface. More...
 
virtual void before (CustomEventTypeRef, INamedInterface *)
 Audit the start of a custom "event". More...
 
virtual void before (CustomEventTypeRef, const std::string &)
 Audit the start of a custom "event" for callers that do not implement INamedInterface. More...
 
virtual void after (StandardEventType, INamedInterface *, const StatusCode &)
 Audit the end of a standard "event". More...
 
virtual void after (StandardEventType, const std::string &, const StatusCode &)
 Audit the end of a standard "event" for callers that do not implement INamedInterface. More...
 
virtual void after (CustomEventTypeRef, INamedInterface *, const StatusCode &)
 Audit the end of a custom "event". More...
 
virtual void after (CustomEventTypeRef, const std::string &, const StatusCode &)
 Audit the end of a custom "event" for callers that do not implement INamedInterface. 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...
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

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.

Member Typedef Documentation

Definition at line 39 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.

15 : m_name(name),
16  m_pSvcLocator(pSvcLocator),
17  m_isEnabled(true),
18  m_isInitialized(false),
19  m_isFinalized(false)
20 {
21  m_PropertyMgr = new PropertyMgr();
22 
23  // Declare common Auditor properties with their defaults
24  declareProperty( "OutputLevel", m_outputLevel = MSG::NIL);
25  declareProperty( "Enable", m_isEnabled = true);
26 }
bool m_isEnabled
Auditor is enabled flag.
Definition: Auditor.h:248
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
Property manager helper class.
Definition: PropertyMgr.h:38
std::string m_name
Auditor's name for identification.
Definition: Auditor.h:242
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Auditor.h:235
bool m_isInitialized
Auditor has been initialized flag.
Definition: Auditor.h:249
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:245
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
int m_outputLevel
Auditor output level.
Definition: Auditor.h:247
bool m_isFinalized
Auditor has been finalized flag.
Definition: Auditor.h:250
Auditor::~Auditor ( )
virtual

Destructor.

Definition at line 29 of file Auditor.cpp.

29  {
30  delete m_PropertyMgr;
31 }
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
Auditor::Auditor ( const Auditor a)
private

Member Function Documentation

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

Audit the end of a standard "event".

Implements IAuditor.

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

Definition at line 122 of file Auditor.cpp.

122  {
123  switch (evt) {
124  case Initialize: afterInitialize(obj); break;
125  case ReInitialize: afterReinitialize(obj); break;
126  case Execute: afterExecute(obj, sc); break;
127  case BeginRun: afterBeginRun(obj); break;
128  case EndRun: afterEndRun(obj); break;
129  case Finalize: afterFinalize(obj); break;
130  case Start: break;
131  case Stop: break;
132  case ReStart: break;
133  default: break ;// do nothing
134  }
135 }
virtual void afterBeginRun(INamedInterface *)
Definition: Auditor.cpp:155
virtual void afterFinalize(INamedInterface *)
Definition: Auditor.cpp:163
virtual void afterExecute(INamedInterface *, const StatusCode &)
Definition: Auditor.cpp:151
virtual void afterReinitialize(INamedInterface *)
Definition: Auditor.cpp:147
virtual void afterInitialize(INamedInterface *)
Definition: Auditor.cpp:143
virtual void afterEndRun(INamedInterface *)
Definition: Auditor.cpp:159
void Auditor::after ( StandardEventType  ,
const std::string &  ,
const StatusCode sc 
)
virtual

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

Implements IAuditor.

Reimplemented in Google::AuditorBase, and CommonAuditor.

Definition at line 136 of file Auditor.cpp.

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

Audit the end of a custom "event".

Implements IAuditor.

Reimplemented in Google::AuditorBase, and CommonAuditor.

Definition at line 138 of file Auditor.cpp.

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

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

Implements IAuditor.

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

Definition at line 139 of file Auditor.cpp.

139 {}
void Auditor::afterBeginRun ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

Reimplemented in Google::AuditorBase.

Definition at line 155 of file Auditor.cpp.

155 {}
void Auditor::afterEndRun ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

Reimplemented in Google::AuditorBase.

Definition at line 159 of file Auditor.cpp.

159 {}
void Auditor::afterExecute ( INamedInterface ,
const StatusCode  
)
virtual
Deprecated:
use after

Implements IAuditor.

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

Definition at line 151 of file Auditor.cpp.

151 {}
void Auditor::afterFinalize ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

Reimplemented in Google::AuditorBase, and AlgContextAuditor.

Definition at line 163 of file Auditor.cpp.

163 {}
void Auditor::afterInitialize ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

Reimplemented in Google::AuditorBase, and AlgContextAuditor.

Definition at line 143 of file Auditor.cpp.

143 {}
void Auditor::afterReinitialize ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

Reimplemented in Google::AuditorBase.

Definition at line 147 of file Auditor.cpp.

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

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

Implements IAuditor.

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

Definition at line 102 of file Auditor.cpp.

102  {
103  switch (evt) {
104  case Initialize: beforeInitialize(obj); break;
105  case ReInitialize: beforeReinitialize(obj); break;
106  case Execute: beforeExecute(obj); break;
107  case BeginRun: beforeBeginRun(obj); break;
108  case EndRun: beforeEndRun(obj); break;
109  case Finalize: beforeFinalize(obj); break;
110  case Start: break;
111  case Stop: break;
112  case ReStart: break;
113  default: break ;// do nothing
114  }
115 }
virtual void beforeBeginRun(INamedInterface *)
Definition: Auditor.cpp:153
virtual void beforeExecute(INamedInterface *)
Definition: Auditor.cpp:149
virtual void beforeReinitialize(INamedInterface *)
Definition: Auditor.cpp:145
virtual void beforeFinalize(INamedInterface *)
Definition: Auditor.cpp:161
virtual void beforeEndRun(INamedInterface *)
Definition: Auditor.cpp:157
virtual void beforeInitialize(INamedInterface *)
Definition: Auditor.cpp:141
void Auditor::before ( StandardEventType  ,
const std::string &   
)
virtual

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

Implements IAuditor.

Reimplemented in Google::AuditorBase, and CommonAuditor.

Definition at line 116 of file Auditor.cpp.

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

Audit the start of a custom "event".

Implements IAuditor.

Reimplemented in Google::AuditorBase, and CommonAuditor.

Definition at line 118 of file Auditor.cpp.

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

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

Implements IAuditor.

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

Definition at line 119 of file Auditor.cpp.

119 {}
void Auditor::beforeBeginRun ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

Reimplemented in Google::AuditorBase.

Definition at line 153 of file Auditor.cpp.

153 {}
void Auditor::beforeEndRun ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

Reimplemented in Google::AuditorBase.

Definition at line 157 of file Auditor.cpp.

157 {}
void Auditor::beforeExecute ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

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

Definition at line 149 of file Auditor.cpp.

149 {}
void Auditor::beforeFinalize ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

Reimplemented in Google::AuditorBase, and AlgContextAuditor.

Definition at line 161 of file Auditor.cpp.

161 {}
void Auditor::beforeInitialize ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

Reimplemented in Google::AuditorBase, and AlgContextAuditor.

Definition at line 141 of file Auditor.cpp.

141 {}
void Auditor::beforeReinitialize ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

Reimplemented in Google::AuditorBase.

Definition at line 145 of file Auditor.cpp.

145 {}
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 235 of file Auditor.h.

236  {
237  return m_PropertyMgr->declareProperty(name, property, doc);
238  }
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
Property * declareProperty(const std::string &name, TYPE &value, const std::string &doc="none")
Declare a property (templated)
Definition: PropertyMgr.h:177
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
StatusCode Auditor::finalize ( )
virtual

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

Definition at line 213 of file Auditor.cpp.

213  {
214  m_MS = 0; // release message service
215  return StatusCode::SUCCESS;
216 }
SmartIF< IMessageSvc > m_MS
Message service.
Definition: Auditor.h:244
const std::vector< Property * > & Auditor::getProperties ( ) const
virtual

Get all properties.

Implements IProperty.

Definition at line 274 of file Auditor.cpp.

274  {
275  return m_PropertyMgr->getProperties();
276 }
const std::vector< Property * > & getProperties() const
get all properties
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
StatusCode Auditor::getProperty ( Property p) const
virtual

Get the value of a property.

Implements IProperty.

Definition at line 265 of file Auditor.cpp.

265  {
266  return m_PropertyMgr->getProperty(p);
267 }
StatusCode getProperty(Property *p) const
get the property
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
const Property & Auditor::getProperty ( const std::string &  name) const
virtual

Get the property by name.

Implements IProperty.

Definition at line 268 of file Auditor.cpp.

268  {
269  return m_PropertyMgr->getProperty(name);
270 }
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
StatusCode getProperty(Property *p) const
get the property
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
StatusCode Auditor::getProperty ( const std::string &  n,
std::string &  v 
) const
virtual

Implementation of IProperty::getProperty.

Implements IProperty.

Definition at line 271 of file Auditor.cpp.

271  {
272  return m_PropertyMgr->getProperty(n,v);
273 }
StatusCode getProperty(Property *p) const
get the property
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
bool Auditor::isEnabled ( ) const
virtual

Tell if the auditor is enabled or not.

Implements IAuditor.

Definition at line 222 of file Auditor.cpp.

222  {
223  return m_isEnabled;
224 }
bool m_isEnabled
Auditor is enabled flag.
Definition: Auditor.h:248
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.

226  {
227  return m_MS;
228 }
SmartIF< IMessageSvc > m_MS
Message service.
Definition: Auditor.h:244
const std::string & Auditor::name ( ) const
virtual

Retrieve the name of the instance.

Implements INamedInterface.

Definition at line 218 of file Auditor.cpp.

218  {
219  return m_name;
220 }
std::string m_name
Auditor's name for identification.
Definition: Auditor.h:242
Auditor& Auditor::operator= ( const Auditor rhs)
private
int Auditor::outputLevel ( ) const
inline

Retrieve the output level of current auditor.

Definition at line 105 of file Auditor.h.

105 { return m_outputLevel; }
int m_outputLevel
Auditor output level.
Definition: Auditor.h:247
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 119 of file Auditor.h.

119  {
120  SmartIF<T> ptr(serviceLocator()->service(name, createIf));
121  if (ptr.isValid()) {
122  svc = ptr.get();
123  svc->addRef();
124  return StatusCode::SUCCESS;
125  }
126  // else
127  svc = 0;
128  return StatusCode::FAILURE;
129  }
Small smart pointer class with automatic reference counting for IInterface.
Definition: IConverter.h:14
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.
Definition: Auditor.h:119
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Auditor.cpp:236
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.

236  {
237  return m_pSvcLocator;
238 }
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:245
void Auditor::setOutputLevel ( int  level)

Set the output level for current auditor.

Definition at line 230 of file Auditor.cpp.

230  {
231  if( m_MS != 0) {
232  m_MS->setOutputLevel( name(), level );
233  }
234 }
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
SmartIF< IMessageSvc > m_MS
Message service.
Definition: Auditor.h:244
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.

241  {
242  if( m_pSvcLocator != 0 ) {
243  IJobOptionsSvc* jos;
244  StatusCode sc = service("JobOptionsSvc", jos);
245  if( sc.isSuccess() ) {
246  jos->setMyProperties( name(), this ).ignore();
247  jos->release();
248  return StatusCode::SUCCESS;
249  }
250  }
251  return StatusCode::FAILURE;
252 }
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.
Definition: Auditor.h:119
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:245
Main interface for the JobOptions service.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode setMyProperties(const std::string &client, IProperty *me)=0
Override default properties of the calling client.
virtual unsigned long release()=0
Release Interface instance.
void ignore() const
Definition: StatusCode.h:107
StatusCode Auditor::setProperty ( const Property p)
virtual

Set a value of a property of an auditor.

Implements IProperty.

Definition at line 256 of file Auditor.cpp.

256  {
257  return m_PropertyMgr->setProperty(p);
258 }
StatusCode setProperty(const Property &p)
set the property form another property
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
StatusCode Auditor::setProperty ( const std::string &  s)
virtual

Implementation of IProperty::setProperty.

Implements IProperty.

Definition at line 259 of file Auditor.cpp.

259  {
260  return m_PropertyMgr->setProperty(s);
261 }
StatusCode setProperty(const Property &p)
set the property form another property
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
string s
Definition: gaudirun.py:210
StatusCode Auditor::setProperty ( const std::string &  n,
const std::string &  v 
)
virtual

Implementation of IProperty::setProperty.

Implements IProperty.

Definition at line 262 of file Auditor.cpp.

262  {
263  return m_PropertyMgr->setProperty(n,v);
264 }
StatusCode setProperty(const Property &p)
set the property form another property
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
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 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 195 of file Auditor.h.

StatusCode setProperty(IProperty *component, const std::string &name, const TYPE &value, const std::string &doc)
simple function to set the property of the given object from the value
Definition: Property.h:1212
virtual const std::string & name() const
Retrieve the name of the instance.
Definition: Auditor.cpp:218
PropertyMgr * m_PropertyMgr
For management of properties.
Definition: Auditor.h:246
StatusCode Auditor::sysFinalize ( )
virtual

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

Implements IAuditor.

Definition at line 165 of file Auditor.cpp.

165  {
167  try{
168  //
169  // Invoke the finalize() method of the derived class if
170  // it has been initialized.
171  if ( m_isInitialized && ! m_isFinalized ) {
172  m_isFinalized = true;
173  sc = finalize();
174  if( !sc.isSuccess() ) return StatusCode::FAILURE;
175  }
176  return sc;
177  //
178  }
179  catch( const GaudiException& Exception )
180  {
182  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
183  log << MSG::FATAL
184  << " Exception with tag=" << Exception.tag() << " is catched " << endmsg;
187  MsgStream logEx ( msgSvc() , Exception.tag() );
188  logEx << MSG::ERROR
189  << Exception << endmsg;
190  }
191  catch( const std::exception& Exception )
192  {
194  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
195  log << MSG::FATAL
196  << " Standard std::exception is caught " << endmsg;
198  MsgStream logEx ( msgSvc() , name() + "*std::exception*" );
199  logEx << MSG::ERROR
200  << Exception.what() << endmsg;
201  }
202  catch( ... )
203  {
205  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
206  log << MSG::FATAL
207  << " UNKNOWN Exception is caught " << endmsg;
208  }
210  return StatusCode::FAILURE ;
211 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode finalize()
Definition: Auditor.cpp:213
Define general base for Gaudi exception.
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
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
bool m_isInitialized
Auditor has been initialized flag.
Definition: Auditor.h:249
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
bool m_isFinalized
Auditor has been finalized flag.
Definition: Auditor.h:250
StatusCode Auditor::sysInitialize ( )
virtual

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

Implements IAuditor.

Definition at line 34 of file Auditor.cpp.

34  {
35  StatusCode sc;
36 
37  // Bypass the initialization if the auditor is disabled or
38  // has already been initialized.
39  if ( isEnabled( ) && ! m_isInitialized ) {
40 
41  // Setup the default service ... this should be upgraded so as to be configurable.
42  if( m_pSvcLocator == 0 )
43  return StatusCode::FAILURE;
44 
45  // Set up message service
46  m_MS = serviceLocator(); // get default message service
47  if( !m_MS.isValid() ) return StatusCode::FAILURE;
48 
49  // Set the Auditor's properties
50  sc = setProperties();
51  if( !sc.isSuccess() ) return StatusCode::FAILURE;
52 
53  // Check current outputLevel to eventually inform the MessagsSvc
54  if( m_outputLevel != MSG::NIL ) {
56  }
57 
58  {
59  try{
60  // Invoke the initialize() method of the derived class
61  sc = initialize();
62  if( !sc.isSuccess() ) return StatusCode::FAILURE;
63  m_isInitialized = true;
64 
65  return sc;
66  }
67  catch ( const GaudiException& Exception )
68  {
70  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
71  log << MSG::FATAL << " Exception with tag=" << Exception.tag() << " is catched " << endmsg;
73  MsgStream logEx ( msgSvc() , Exception.tag() );
74  logEx << MSG::ERROR << Exception << endmsg;
75  }
76  catch( const std::exception& Exception )
77  {
79  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
80  log << MSG::FATAL << " Standard std::exception is catched " << endmsg;
82  MsgStream logEx ( msgSvc() , name() + "*std::exception*" );
83  logEx << MSG::ERROR << Exception.what() << endmsg;
84  }
85  catch(...)
86  {
88  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
89  log << MSG::FATAL << " UNKNOWN Exception is catched " << endmsg;
90  }
91  }
92  }
94  return StatusCode::FAILURE;
95 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
void setOutputLevel(int level)
Set the output level for current auditor.
Definition: Auditor.cpp:230
Define general base for Gaudi exception.
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
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
StatusCode setProperties()
Set the auditor's properties.
Definition: Auditor.cpp:241
SmartIF< IMessageSvc > m_MS
Message service.
Definition: Auditor.h:244
bool m_isInitialized
Auditor has been initialized flag.
Definition: Auditor.h:249
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:245
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:51
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Auditor.cpp:236
virtual StatusCode initialize()
Definition: Auditor.cpp:97
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual bool isEnabled() const
Tell if the auditor is enabled or not.
Definition: Auditor.cpp:222
int m_outputLevel
Auditor output level.
Definition: Auditor.h:247

Member Data Documentation

bool Auditor::m_isEnabled
private

Auditor is enabled flag.

Definition at line 248 of file Auditor.h.

bool Auditor::m_isFinalized
private

Auditor has been finalized flag.

Definition at line 250 of file Auditor.h.

bool Auditor::m_isInitialized
private

Auditor has been initialized flag.

Definition at line 249 of file Auditor.h.

SmartIF<IMessageSvc> Auditor::m_MS
mutableprivate

Message service.

Definition at line 244 of file Auditor.h.

std::string Auditor::m_name
private

Auditor's name for identification.

Definition at line 242 of file Auditor.h.

int Auditor::m_outputLevel
private

Auditor output level.

Definition at line 247 of file Auditor.h.

PropertyMgr* Auditor::m_PropertyMgr
private

For management of properties.

Definition at line 246 of file Auditor.h.

SmartIF<ISvcLocator> Auditor::m_pSvcLocator
mutableprivate

Pointer to service locator service.

Definition at line 245 of file Auditor.h.


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