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
 
typedef Gaudi::PluginService::Factory< IAuditor *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from implements< Interfaces >
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
using base_class = implements< Interfaces...>
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces...>
 Typedef to the base of this class. More...
 
using iids = typename extend_interfaces_base::ext_iids
 
- Public Types inherited from extend_interfaces< Interfaces...>
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids...>::type
 take union of the ext_iids of all Interfaces... More...
 

Public Member Functions

 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor. More...
 
 ~Auditor () override=default
 Destructor. More...
 
StatusCode sysInitialize () override
 Initialization method invoked by the framework. More...
 
StatusCode sysFinalize () override
 Finalization method invoked by the framework. More...
 
void before (StandardEventType, INamedInterface *) override
 The following methods are meant to be implemented by the child class... More...
 
void before (StandardEventType, const std::string &) override
 
void before (CustomEventTypeRef, INamedInterface *) override
 
void before (CustomEventTypeRef, const std::string &) override
 
void after (StandardEventType, INamedInterface *, const StatusCode &) override
 
void after (StandardEventType, const std::string &, const StatusCode &) override
 
void after (CustomEventTypeRef, INamedInterface *, const StatusCode &) override
 
void after (CustomEventTypeRef, const std::string &, const StatusCode &) override
 
void beforeInitialize (INamedInterface *) override
 
void afterInitialize (INamedInterface *) override
 
void beforeReinitialize (INamedInterface *) override
 
void afterReinitialize (INamedInterface *) override
 
void beforeExecute (INamedInterface *) override
 
void afterExecute (INamedInterface *, const StatusCode &) override
 
void beforeFinalize (INamedInterface *) override
 
void afterFinalize (INamedInterface *) override
 
void beforeBeginRun (INamedInterface *) override
 
void afterBeginRun (INamedInterface *) override
 
void beforeEndRun (INamedInterface *) override
 
void afterEndRun (INamedInterface *) override
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
const std::string & name () const override
 
bool isEnabled () const override
 
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...
 
template<class T = IService>
SmartIF< T > service (const std::string &name, bool createIf=false) const
 
StatusCode setProperty (const Property &p) override
 Set a value of a property of an auditor. More...
 
StatusCode setProperty (const std::string &s) override
 Implementation of IProperty::setProperty. More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 Implementation of IProperty::setProperty. More...
 
StatusCode getProperty (Property *p) const override
 Get the value of a property. More...
 
const PropertygetProperty (const std::string &name) const override
 Get the property by name. More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 Implementation of IProperty::getProperty. More...
 
const std::vector< Property * > & getProperties () const override
 Get all properties. More...
 
bool hasProperty (const std::string &name) const override
 Implementation of IProperty::hasProperty. 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...
 
 Auditor (const std::string &name, ISvcLocator *svcloc)
 Constructor. More...
 
 ~Auditor () override=default
 Destructor. More...
 
StatusCode sysInitialize () override
 Initialization method invoked by the framework. More...
 
StatusCode sysFinalize () override
 Finalization method invoked by the framework. More...
 
void before (StandardEventType, INamedInterface *) override
 The following methods are meant to be implemented by the child class... More...
 
void before (StandardEventType, const std::string &) override
 
void before (CustomEventTypeRef, INamedInterface *) override
 
void before (CustomEventTypeRef, const std::string &) override
 
void after (StandardEventType, INamedInterface *, const StatusCode &) override
 
void after (StandardEventType, const std::string &, const StatusCode &) override
 
void after (CustomEventTypeRef, INamedInterface *, const StatusCode &) override
 
void after (CustomEventTypeRef, const std::string &, const StatusCode &) override
 
void beforeInitialize (INamedInterface *) override
 
void afterInitialize (INamedInterface *) override
 
void beforeReinitialize (INamedInterface *) override
 
void afterReinitialize (INamedInterface *) override
 
void beforeExecute (INamedInterface *) override
 
void afterExecute (INamedInterface *, const StatusCode &) override
 
void beforeFinalize (INamedInterface *) override
 
void afterFinalize (INamedInterface *) override
 
void beforeBeginRun (INamedInterface *) override
 
void afterBeginRun (INamedInterface *) override
 
void beforeEndRun (INamedInterface *) override
 
void afterEndRun (INamedInterface *) override
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
const std::string & name () const override
 
bool isEnabled () const override
 
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...
 
template<class T = IService>
SmartIF< T > service (const std::string &name, bool createIf=false) const
 
StatusCode setProperty (const Property &p) override
 Set a value of a property of an auditor. More...
 
StatusCode setProperty (const std::string &s) override
 Implementation of IProperty::setProperty. More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 Implementation of IProperty::setProperty. More...
 
StatusCode getProperty (Property *p) const override
 Get the value of a property. More...
 
const PropertygetProperty (const std::string &name) const override
 Get the property by name. More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 Implementation of IProperty::getProperty. More...
 
const std::vector< Property * > & getProperties () const override
 Get all properties. More...
 
bool hasProperty (const std::string &name) const override
 Implementation of IProperty::hasProperty. 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 implements< Interfaces >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::string > getInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 implements ()=default
 Default constructor. More...
 
 implements (const implements &)
 Copy constructor (zero the reference count) More...
 
implementsoperator= (const implements &)
 Assignment operator (do not touch the reference count). More...
 
 ~implements () override=default
 Virtual destructor. More...
 
unsigned long addRef () override
 Reference Interface instance. More...
 
unsigned long release () override
 Release Interface instance. More...
 
unsigned long refCount () const override
 Current reference count. More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces...>
 ~extend_interfaces () override=default
 Virtual destructor. More...
 
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Private Member Functions

 Auditor (const Auditor &a)
 
Auditoroperator= (const Auditor &rhs)
 
 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...
 
SmartIF< 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

- Protected Attributes inherited from implements< Interfaces >
std::atomic_ulong m_refCount = {0}
 Reference counter. 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.

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 12 of file Auditor.cpp.

13 : m_name(name),
14  m_pSvcLocator(pSvcLocator),
15  m_PropertyMgr{ new PropertyMgr() },
16  m_isEnabled(true),
17  m_isInitialized(false),
18  m_isFinalized(false)
19 {
20 
21  // Declare common Auditor properties with their defaults
22  declareProperty( "OutputLevel", m_outputLevel = MSG::NIL);
23  declareProperty( "Enable", m_isEnabled = true);
24 }
bool m_isEnabled
Auditor is enabled flag.
Definition: Auditor.h:254
Property manager helper class.
Definition: PropertyMgr.h:35
std::string m_name
Auditor's name for identification.
Definition: Auditor.h:248
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Auditor.h:241
bool m_isInitialized
Auditor has been initialized flag.
Definition: Auditor.h:255
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
const std::string & name() const override
Definition: Auditor.cpp:212
int m_outputLevel
Auditor output level.
Definition: Auditor.h:253
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:251
bool m_isFinalized
Auditor has been finalized flag.
Definition: Auditor.h:256
Auditor::~Auditor ( )
overridedefault

Destructor.

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

Constructor.

Parameters
nameThe algorithm object's name
svclocA pointer to a service location service
Auditor::~Auditor ( )
overridedefault

Destructor.

Auditor::Auditor ( const Auditor a)
private

Member Function Documentation

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

Definition at line 116 of file Auditor.cpp.

116  {
117  switch (evt) {
118  case Initialize: afterInitialize(obj); break;
119  case ReInitialize: afterReinitialize(obj); break;
120  case Execute: afterExecute(obj, sc); break;
121  case BeginRun: afterBeginRun(obj); break;
122  case EndRun: afterEndRun(obj); break;
123  case Finalize: afterFinalize(obj); break;
124  case Start: break;
125  case Stop: break;
126  case ReStart: break;
127  default: break ;// do nothing
128  }
129 }
void afterEndRun(INamedInterface *) override
Definition: Auditor.cpp:153
void afterBeginRun(INamedInterface *) override
Definition: Auditor.cpp:149
void afterExecute(INamedInterface *, const StatusCode &) override
Definition: Auditor.cpp:145
void afterInitialize(INamedInterface *) override
Definition: Auditor.cpp:137
void afterFinalize(INamedInterface *) override
Definition: Auditor.cpp:157
void afterReinitialize(INamedInterface *) override
Definition: Auditor.cpp:141
void Auditor::after ( StandardEventType  ,
INamedInterface ,
const StatusCode  
)
override
void Auditor::after ( StandardEventType  ,
const std::string &  ,
const StatusCode  
)
override

Definition at line 130 of file Auditor.cpp.

130 {}
void Auditor::after ( StandardEventType  ,
const std::string &  ,
const StatusCode  
)
override
void Auditor::after ( CustomEventTypeRef  ,
INamedInterface ,
const StatusCode  
)
override

Definition at line 132 of file Auditor.cpp.

132 {}
void Auditor::after ( CustomEventTypeRef  ,
INamedInterface ,
const StatusCode  
)
override
void Auditor::after ( CustomEventTypeRef  ,
const std::string &  ,
const StatusCode  
)
override

Definition at line 133 of file Auditor.cpp.

133 {}
void Auditor::after ( CustomEventTypeRef  ,
const std::string &  ,
const StatusCode  
)
override
void Auditor::afterBeginRun ( INamedInterface )
override
void Auditor::afterBeginRun ( INamedInterface )
override

Definition at line 149 of file Auditor.cpp.

149 {}
void Auditor::afterEndRun ( INamedInterface )
override
void Auditor::afterEndRun ( INamedInterface )
override

Definition at line 153 of file Auditor.cpp.

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

Definition at line 145 of file Auditor.cpp.

145 {}
void Auditor::afterExecute ( INamedInterface ,
const StatusCode  
)
override
void Auditor::afterFinalize ( INamedInterface )
override

Definition at line 157 of file Auditor.cpp.

157 {}
void Auditor::afterFinalize ( INamedInterface )
override
void Auditor::afterInitialize ( INamedInterface )
override

Definition at line 137 of file Auditor.cpp.

137 {}
void Auditor::afterInitialize ( INamedInterface )
override
void Auditor::afterReinitialize ( INamedInterface )
override

Definition at line 141 of file Auditor.cpp.

141 {}
void Auditor::afterReinitialize ( INamedInterface )
override
void Auditor::before ( StandardEventType  ,
INamedInterface  
)
override

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

void Auditor::before ( StandardEventType  evt,
INamedInterface obj 
)
override

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

Definition at line 96 of file Auditor.cpp.

96  {
97  switch (evt) {
98  case Initialize: beforeInitialize(obj); break;
99  case ReInitialize: beforeReinitialize(obj); break;
100  case Execute: beforeExecute(obj); break;
101  case BeginRun: beforeBeginRun(obj); break;
102  case EndRun: beforeEndRun(obj); break;
103  case Finalize: beforeFinalize(obj); break;
104  case Start: break;
105  case Stop: break;
106  case ReStart: break;
107  default: break ;// do nothing
108  }
109 }
void beforeInitialize(INamedInterface *) override
Definition: Auditor.cpp:135
void beforeBeginRun(INamedInterface *) override
Definition: Auditor.cpp:147
void beforeExecute(INamedInterface *) override
Definition: Auditor.cpp:143
void beforeReinitialize(INamedInterface *) override
Definition: Auditor.cpp:139
void beforeFinalize(INamedInterface *) override
Definition: Auditor.cpp:155
void beforeEndRun(INamedInterface *) override
Definition: Auditor.cpp:151
void Auditor::before ( StandardEventType  ,
const std::string &   
)
override

Definition at line 110 of file Auditor.cpp.

110 {}
void Auditor::before ( StandardEventType  ,
const std::string &   
)
override
void Auditor::before ( CustomEventTypeRef  ,
INamedInterface  
)
override

Definition at line 112 of file Auditor.cpp.

112 {}
void Auditor::before ( CustomEventTypeRef  ,
INamedInterface  
)
override
void Auditor::before ( CustomEventTypeRef  ,
const std::string &   
)
override
void Auditor::before ( CustomEventTypeRef  ,
const std::string &   
)
override

Definition at line 113 of file Auditor.cpp.

113 {}
void Auditor::beforeBeginRun ( INamedInterface )
override

Definition at line 147 of file Auditor.cpp.

147 {}
void Auditor::beforeBeginRun ( INamedInterface )
override
void Auditor::beforeEndRun ( INamedInterface )
override
void Auditor::beforeEndRun ( INamedInterface )
override

Definition at line 151 of file Auditor.cpp.

151 {}
void Auditor::beforeExecute ( INamedInterface )
override
void Auditor::beforeExecute ( INamedInterface )
override

Definition at line 143 of file Auditor.cpp.

143 {}
void Auditor::beforeFinalize ( INamedInterface )
override

Definition at line 155 of file Auditor.cpp.

155 {}
void Auditor::beforeFinalize ( INamedInterface )
override
void Auditor::beforeInitialize ( INamedInterface )
override

Definition at line 135 of file Auditor.cpp.

135 {}
void Auditor::beforeInitialize ( INamedInterface )
override
void Auditor::beforeReinitialize ( INamedInterface )
override

Definition at line 139 of file Auditor.cpp.

139 {}
void Auditor::beforeReinitialize ( INamedInterface )
override
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 241 of file Auditor.h.

242  {
243  return m_PropertyMgr->declareProperty(name, property, doc);
244  }
Property * declareProperty(const std::string &name, TYPE &value, const std::string &doc="none")
Declare a property (templated)
Definition: PropertyMgr.h:188
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
const std::string & name() const override
Definition: Auditor.cpp:212
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 241 of file Auditor.h.

242  {
243  return m_PropertyMgr->declareProperty(name, property, doc);
244  }
Property * declareProperty(const std::string &name, TYPE &value, const std::string &doc="none")
Declare a property (templated)
Definition: PropertyMgr.h:188
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
const std::string & name() const override
Definition: Auditor.cpp:212
virtual StatusCode Auditor::finalize ( )
virtual
StatusCode Auditor::finalize ( )
virtual

Reimplemented in PerfMonAuditor, AlgContextAuditor, and AlgErrorAuditor.

Definition at line 207 of file Auditor.cpp.

207  {
208  m_MS.reset();// release message service
209  return StatusCode::SUCCESS;
210 }
SmartIF< IMessageSvc > m_MS
Message service.
Definition: Auditor.h:250
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
const std::vector< Property * > & Auditor::getProperties ( ) const
override

Get all properties.

Definition at line 264 of file Auditor.cpp.

264  {
265  return m_PropertyMgr->getProperties();
266 }
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
const std::vector< Property * > & getProperties() const override
get all properties
const std::vector<Property*>& Auditor::getProperties ( ) const
override

Get all properties.

StatusCode Auditor::getProperty ( Property p) const
override

Get the value of a property.

Definition at line 255 of file Auditor.cpp.

255  {
256  return m_PropertyMgr->getProperty(p);
257 }
StatusCode getProperty(Property *p) const override
get the property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
StatusCode Auditor::getProperty ( Property p) const
override

Get the value of a property.

const Property & Auditor::getProperty ( const std::string &  name) const
override

Get the property by name.

Definition at line 258 of file Auditor.cpp.

258  {
259  return m_PropertyMgr->getProperty(name);
260 }
StatusCode getProperty(Property *p) const override
get the property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
const std::string & name() const override
Definition: Auditor.cpp:212
const Property& Auditor::getProperty ( const std::string &  name) const
override

Get the property by name.

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

Implementation of IProperty::getProperty.

Definition at line 261 of file Auditor.cpp.

261  {
262  return m_PropertyMgr->getProperty(n,v);
263 }
StatusCode getProperty(Property *p) const override
get the property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
StatusCode Auditor::getProperty ( const std::string &  n,
std::string &  v 
) const
override

Implementation of IProperty::getProperty.

bool Auditor::hasProperty ( const std::string &  name) const
override

Implementation of IProperty::hasProperty.

Definition at line 267 of file Auditor.cpp.

267  {
268  return m_PropertyMgr->hasProperty(name);
269 }
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
const std::string & name() const override
Definition: Auditor.cpp:212
bool hasProperty(const std::string &name) const override
Return true if we have a property with the given name.
bool Auditor::hasProperty ( const std::string &  name) const
override

Implementation of IProperty::hasProperty.

virtual StatusCode Auditor::initialize ( )
virtual
StatusCode Auditor::initialize ( )
virtual
bool Auditor::isEnabled ( ) const
override
bool Auditor::isEnabled ( ) const
override

Definition at line 216 of file Auditor.cpp.

216  {
217  return m_isEnabled;
218 }
bool m_isEnabled
Auditor is enabled flag.
Definition: Auditor.h:254
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 220 of file Auditor.cpp.

220  {
221  return m_MS;
222 }
SmartIF< IMessageSvc > m_MS
Message service.
Definition: Auditor.h:250
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.

const std::string& Auditor::name ( ) const
override
const std::string & Auditor::name ( ) const
override

Definition at line 212 of file Auditor.cpp.

212  {
213  return m_name;
214 }
std::string m_name
Auditor's name for identification.
Definition: Auditor.h:248
Auditor& Auditor::operator= ( const Auditor rhs)
private
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:253
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:253
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  auto ptr = serviceLocator()->service<T>(name, createIf);
121  if (ptr) {
122  svc = ptr.get();
123  svc->addRef();
124  return StatusCode::SUCCESS;
125  }
126  svc = nullptr;
127  return StatusCode::FAILURE;
128  }
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Auditor.cpp:228
const std::string & name() const override
Definition: Auditor.cpp:212
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  auto ptr = serviceLocator()->service<T>(name, createIf);
121  if (ptr) {
122  svc = ptr.get();
123  svc->addRef();
124  return StatusCode::SUCCESS;
125  }
126  svc = nullptr;
127  return StatusCode::FAILURE;
128  }
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Auditor.cpp:228
const std::string & name() const override
Definition: Auditor.cpp:212
template<class T = IService>
SmartIF<T> Auditor::service ( const std::string &  name,
bool  createIf = false 
) const
inline

Definition at line 131 of file Auditor.h.

131  {
132  return serviceLocator()->service<T>(name, createIf);
133  }
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Auditor.cpp:228
const std::string & name() const override
Definition: Auditor.cpp:212
template<class T = IService>
SmartIF<T> Auditor::service ( const std::string &  name,
bool  createIf = false 
) const
inline

Definition at line 131 of file Auditor.h.

131  {
132  return serviceLocator()->service<T>(name, createIf);
133  }
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:78
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Definition: Auditor.cpp:228
const std::string & name() const override
Definition: Auditor.cpp:212
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 228 of file Auditor.cpp.

228  {
229  return m_pSvcLocator;
230 }
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:251
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.

void Auditor::setOutputLevel ( int  level)

Set the output level for current auditor.

void Auditor::setOutputLevel ( int  level)

Set the output level for current auditor.

Definition at line 224 of file Auditor.cpp.

224  {
225  if( m_MS ) m_MS->setOutputLevel( name(), level );
226 }
SmartIF< IMessageSvc > m_MS
Message service.
Definition: Auditor.h:250
const std::string & name() const override
Definition: Auditor.cpp:212
virtual void setOutputLevel(int new_level)=0
Set new global output level threshold.
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.

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 233 of file Auditor.cpp.

233  {
234  if( m_pSvcLocator ) {
235  auto jos = service<IJobOptionsSvc>("JobOptionsSvc");
236  if( jos ) {
237  jos->setMyProperties( name(), this ).ignore();
238  return StatusCode::SUCCESS;
239  }
240  }
241  return StatusCode::FAILURE;
242 }
const std::string & name() const override
Definition: Auditor.cpp:212
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:251
StatusCode Auditor::setProperty ( const Property p)
override

Set a value of a property of an auditor.

StatusCode Auditor::setProperty ( const Property p)
override

Set a value of a property of an auditor.

Definition at line 246 of file Auditor.cpp.

246  {
247  return m_PropertyMgr->setProperty(p);
248 }
StatusCode setProperty(const Property &p) override
set the property form another property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
StatusCode Auditor::setProperty ( const std::string &  s)
override

Implementation of IProperty::setProperty.

StatusCode Auditor::setProperty ( const std::string &  s)
override

Implementation of IProperty::setProperty.

Definition at line 249 of file Auditor.cpp.

249  {
250  return m_PropertyMgr->setProperty(s);
251 }
StatusCode setProperty(const Property &p) override
set the property form another property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
string s
Definition: gaudirun.py:245
StatusCode Auditor::setProperty ( const std::string &  n,
const std::string &  v 
)
override

Implementation of IProperty::setProperty.

Definition at line 252 of file Auditor.cpp.

252  {
253  return m_PropertyMgr->setProperty(n,v);
254 }
StatusCode setProperty(const Property &p) override
set the property form another property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
StatusCode Auditor::setProperty ( const std::string &  n,
const std::string &  v 
)
override

Implementation of IProperty::setProperty.

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 201 of file Auditor.h.

203  { return Gaudi::Utils::setProperty ( m_PropertyMgr.get() , name , value ) ; }
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:1187
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
const std::string & name() const override
Definition: Auditor.cpp:212
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 201 of file Auditor.h.

203  { return Gaudi::Utils::setProperty ( m_PropertyMgr.get() , name , value ) ; }
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:1187
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:76
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:252
const std::string & name() const override
Definition: Auditor.cpp:212
StatusCode Auditor::sysFinalize ( )
override

Finalization method invoked by the framework.

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

StatusCode Auditor::sysFinalize ( )
override

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 159 of file Auditor.cpp.

159  {
161  try{
162  //
163  // Invoke the finalize() method of the derived class if
164  // it has been initialized.
165  if ( m_isInitialized && ! m_isFinalized ) {
166  m_isFinalized = true;
167  sc = finalize();
168  if( !sc.isSuccess() ) return StatusCode::FAILURE;
169  }
170  return sc;
171  //
172  }
173  catch( const GaudiException& Exception )
174  {
176  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
177  log << MSG::FATAL
178  << " Exception with tag=" << Exception.tag() << " is catched " << endmsg;
181  MsgStream logEx ( msgSvc() , Exception.tag() );
182  logEx << MSG::ERROR
183  << Exception << endmsg;
184  }
185  catch( const std::exception& Exception )
186  {
188  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
189  log << MSG::FATAL
190  << " Standard std::exception is caught " << endmsg;
192  MsgStream logEx ( msgSvc() , name() + "*std::exception*" );
193  logEx << MSG::ERROR
194  << Exception.what() << endmsg;
195  }
196  catch( ... )
197  {
199  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
200  log << MSG::FATAL
201  << " UNKNOWN Exception is caught " << endmsg;
202  }
204  return StatusCode::FAILURE ;
205 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode finalize()
Definition: Auditor.cpp:207
Define general base for Gaudi exception.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Auditor.cpp:220
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
bool m_isInitialized
Auditor has been initialized flag.
Definition: Auditor.h:255
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
virtual const std::string & tag() const
name tag for the exception, or exception type
const std::string & name() const override
Definition: Auditor.cpp:212
bool m_isFinalized
Auditor has been finalized flag.
Definition: Auditor.h:256
StatusCode Auditor::sysInitialize ( )
override

Initialization method invoked by the framework.

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

StatusCode Auditor::sysInitialize ( )
override

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 28 of file Auditor.cpp.

28  {
29  StatusCode sc;
30 
31  // Bypass the initialization if the auditor is disabled or
32  // has already been initialized.
33  if ( isEnabled( ) && ! m_isInitialized ) {
34 
35  // Setup the default service ... this should be upgraded so as to be configurable.
36  if( !m_pSvcLocator )
37  return StatusCode::FAILURE;
38 
39  // Set up message service
40  m_MS = serviceLocator(); // get default message service
41  if( !m_MS ) return StatusCode::FAILURE;
42 
43  // Set the Auditor's properties
44  sc = setProperties();
45  if( !sc.isSuccess() ) return StatusCode::FAILURE;
46 
47  // Check current outputLevel to eventually inform the MessagsSvc
48  if( m_outputLevel != MSG::NIL ) {
50  }
51 
52  {
53  try{
54  // Invoke the initialize() method of the derived class
55  sc = initialize();
56  if( !sc.isSuccess() ) return StatusCode::FAILURE;
57  m_isInitialized = true;
58 
59  return sc;
60  }
61  catch ( const GaudiException& Exception )
62  {
64  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
65  log << MSG::FATAL << " Exception with tag=" << Exception.tag() << " is catched " << endmsg;
67  MsgStream logEx ( msgSvc() , Exception.tag() );
68  logEx << MSG::ERROR << Exception << endmsg;
69  }
70  catch( const std::exception& Exception )
71  {
73  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
74  log << MSG::FATAL << " Standard std::exception is catched " << endmsg;
76  MsgStream logEx ( msgSvc() , name() + "*std::exception*" );
77  logEx << MSG::ERROR << Exception.what() << endmsg;
78  }
79  catch(...)
80  {
82  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
83  log << MSG::FATAL << " UNKNOWN Exception is catched " << endmsg;
84  }
85  }
86  }
88  return StatusCode::FAILURE;
89 }
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:224
Define general base for Gaudi exception.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: Auditor.cpp:220
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
StatusCode setProperties()
Set the auditor's properties.
Definition: Auditor.cpp:233
SmartIF< IMessageSvc > m_MS
Message service.
Definition: Auditor.h:250
bool m_isInitialized
Auditor has been initialized flag.
Definition: Auditor.h:255
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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:228
bool isEnabled() const override
Definition: Auditor.cpp:216
const std::string & name() const override
Definition: Auditor.cpp:212
virtual StatusCode initialize()
Definition: Auditor.cpp:91
int m_outputLevel
Auditor output level.
Definition: Auditor.h:253
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:251

Member Data Documentation

bool Auditor::m_isEnabled
private

Auditor is enabled flag.

Definition at line 254 of file Auditor.h.

bool Auditor::m_isFinalized
private

Auditor has been finalized flag.

Definition at line 256 of file Auditor.h.

bool Auditor::m_isInitialized
private

Auditor has been initialized flag.

Definition at line 255 of file Auditor.h.

SmartIF< IMessageSvc > Auditor::m_MS
mutableprivate

Message service.

Definition at line 250 of file Auditor.h.

std::string Auditor::m_name
private

Auditor's name for identification.

Definition at line 248 of file Auditor.h.

int Auditor::m_outputLevel
private

Auditor output level.

Definition at line 253 of file Auditor.h.

SmartIF< PropertyMgr > Auditor::m_PropertyMgr
private

For management of properties.

Definition at line 252 of file Auditor.h.

SmartIF< ISvcLocator > Auditor::m_pSvcLocator
mutableprivate

Pointer to service locator service.

Definition at line 251 of file Auditor.h.


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