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 CommonMessaging< implements< IAuditor, IProperty > >
using base_class = CommonMessaging
 

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::stringname () const override
 
bool isEnabled () const override
 
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 CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const __attribute__((deprecated))
 Backward compatibility function for getting the output level. More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream 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< 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 Member Functions inherited from CommonMessaging< implements< IAuditor, IProperty > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. 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 35 of file Auditor.h.

Member Typedef Documentation

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
23  declareProperty( "Enable", m_isEnabled = true);
24 }
bool m_isEnabled
Auditor is enabled flag.
Definition: Auditor.h:244
virtual Property & declareUpdateHandler(std::function< void(Property &)> fun)
set new callback for update
Definition: Property.cpp:72
Property manager helper class.
Definition: PropertyMgr.h:37
std::string m_name
Auditor's name for identification.
Definition: Auditor.h:239
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Auditor.h:232
bool m_isInitialized
Auditor has been initialized flag.
Definition: Auditor.h:245
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:241
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
Property base class allowing Property* collections to be "homogeneous".
Definition: Property.h:38
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:242
int m_outputLevel
Auditor output level.
Definition: Auditor.h:243
bool m_isFinalized
Auditor has been finalized flag.
Definition: Auditor.h:246
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 107 of file Auditor.cpp.

107  {
108  switch (evt) {
109  case Initialize: afterInitialize(obj); break;
110  case ReInitialize: afterReinitialize(obj); break;
111  case Execute: afterExecute(obj, sc); break;
112  case BeginRun: afterBeginRun(obj); break;
113  case EndRun: afterEndRun(obj); break;
114  case Finalize: afterFinalize(obj); break;
115  case Start: break;
116  case Stop: break;
117  case ReStart: break;
118  default: break ;// do nothing
119  }
120 }
void afterEndRun(INamedInterface *) override
Definition: Auditor.cpp:144
void afterBeginRun(INamedInterface *) override
Definition: Auditor.cpp:140
void afterExecute(INamedInterface *, const StatusCode &) override
Definition: Auditor.cpp:136
void afterInitialize(INamedInterface *) override
Definition: Auditor.cpp:128
void afterFinalize(INamedInterface *) override
Definition: Auditor.cpp:148
void afterReinitialize(INamedInterface *) override
Definition: Auditor.cpp:132
void Auditor::after ( StandardEventType  ,
const std::string ,
const StatusCode  
)
override

Definition at line 121 of file Auditor.cpp.

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

Definition at line 123 of file Auditor.cpp.

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

Definition at line 124 of file Auditor.cpp.

124 {}
void Auditor::afterBeginRun ( INamedInterface )
override

Definition at line 140 of file Auditor.cpp.

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

Definition at line 144 of file Auditor.cpp.

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

Definition at line 136 of file Auditor.cpp.

136 {}
void Auditor::afterFinalize ( INamedInterface )
override

Definition at line 148 of file Auditor.cpp.

148 {}
void Auditor::afterInitialize ( INamedInterface )
override

Definition at line 128 of file Auditor.cpp.

128 {}
void Auditor::afterReinitialize ( INamedInterface )
override

Definition at line 132 of file Auditor.cpp.

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

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

Definition at line 87 of file Auditor.cpp.

87  {
88  switch (evt) {
89  case Initialize: beforeInitialize(obj); break;
90  case ReInitialize: beforeReinitialize(obj); break;
91  case Execute: beforeExecute(obj); break;
92  case BeginRun: beforeBeginRun(obj); break;
93  case EndRun: beforeEndRun(obj); break;
94  case Finalize: beforeFinalize(obj); break;
95  case Start: break;
96  case Stop: break;
97  case ReStart: break;
98  default: break ;// do nothing
99  }
100 }
void beforeInitialize(INamedInterface *) override
Definition: Auditor.cpp:126
void beforeBeginRun(INamedInterface *) override
Definition: Auditor.cpp:138
void beforeExecute(INamedInterface *) override
Definition: Auditor.cpp:134
void beforeReinitialize(INamedInterface *) override
Definition: Auditor.cpp:130
void beforeFinalize(INamedInterface *) override
Definition: Auditor.cpp:146
void beforeEndRun(INamedInterface *) override
Definition: Auditor.cpp:142
void Auditor::before ( StandardEventType  ,
const std::string  
)
override

Definition at line 101 of file Auditor.cpp.

101 {}
void Auditor::before ( CustomEventTypeRef  ,
INamedInterface  
)
override

Definition at line 103 of file Auditor.cpp.

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

Definition at line 104 of file Auditor.cpp.

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

Definition at line 138 of file Auditor.cpp.

138 {}
void Auditor::beforeEndRun ( INamedInterface )
override

Definition at line 142 of file Auditor.cpp.

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

Definition at line 134 of file Auditor.cpp.

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

Definition at line 146 of file Auditor.cpp.

146 {}
void Auditor::beforeInitialize ( INamedInterface )
override

Definition at line 126 of file Auditor.cpp.

126 {}
void Auditor::beforeReinitialize ( INamedInterface )
override

Definition at line 130 of file Auditor.cpp.

130 {}
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 232 of file Auditor.h.

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

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

Definition at line 198 of file Auditor.cpp.

198  {
199  return StatusCode::SUCCESS;
200 }
const std::vector< Property * > & Auditor::getProperties ( ) const
override

Get all properties.

Definition at line 245 of file Auditor.cpp.

245  {
246  return m_PropertyMgr->getProperties();
247 }
const std::vector< Property * > & getProperties() const override
get all properties
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:242
StatusCode Auditor::getProperty ( Property p) const
override

Get the value of a property.

Definition at line 236 of file Auditor.cpp.

236  {
237  return m_PropertyMgr->getProperty(p);
238 }
StatusCode getProperty(Property *p) const override
get the property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:242
const Property & Auditor::getProperty ( const std::string name) const
override

Get the property by name.

Definition at line 239 of file Auditor.cpp.

239  {
240  return m_PropertyMgr->getProperty(name);
241 }
StatusCode getProperty(Property *p) const override
get the property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:242
StatusCode Auditor::getProperty ( const std::string n,
std::string v 
) const
override

Implementation of IProperty::getProperty.

Definition at line 242 of file Auditor.cpp.

242  {
243  return m_PropertyMgr->getProperty(n,v);
244 }
StatusCode getProperty(Property *p) const override
get the property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:242
bool Auditor::hasProperty ( const std::string name) const
override

Implementation of IProperty::hasProperty.

Definition at line 248 of file Auditor.cpp.

248  {
249  return m_PropertyMgr->hasProperty(name);
250 }
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:242
bool hasProperty(const std::string &name) const override
Return true if we have a property with the given name.
bool Auditor::isEnabled ( ) const
override

Definition at line 206 of file Auditor.cpp.

206  {
207  return m_isEnabled;
208 }
bool m_isEnabled
Auditor is enabled flag.
Definition: Auditor.h:244
const std::string & Auditor::name ( ) const
override

Definition at line 202 of file Auditor.cpp.

202  {
203  return m_name;
204 }
std::string m_name
Auditor's name for identification.
Definition: Auditor.h:239
Auditor& Auditor::operator= ( const Auditor rhs)
private
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 110 of file Auditor.h.

110  {
111  auto ptr = serviceLocator()->service<T>(name, createIf);
112  if (ptr) {
113  svc = ptr.get();
114  svc->addRef();
115  return StatusCode::SUCCESS;
116  }
117  svc = nullptr;
118  return StatusCode::FAILURE;
119  }
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:211
const std::string & name() const override
Definition: Auditor.cpp:202
template<class T = IService>
SmartIF<T> Auditor::service ( const std::string name,
bool  createIf = false 
) const
inline

Definition at line 122 of file Auditor.h.

122  {
123  return serviceLocator()->service<T>(name, createIf);
124  }
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:211
const std::string & name() const override
Definition: Auditor.cpp:202
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 211 of file Auditor.cpp.

211  {
212  return m_pSvcLocator;
213 }
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:241
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 216 of file Auditor.cpp.

216  {
217  if( !m_pSvcLocator ) return StatusCode::FAILURE;
218  auto jos = service<IJobOptionsSvc>("JobOptionsSvc");
219  if( !jos ) return StatusCode::FAILURE;
220  jos->setMyProperties( name(), this ).ignore();
222  return StatusCode::SUCCESS;
223 }
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:241
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
const std::string & name() const override
Definition: Auditor.cpp:202
int m_outputLevel
Auditor output level.
Definition: Auditor.h:243
StatusCode Auditor::setProperty ( const Property p)
override

Set a value of a property of an auditor.

Definition at line 227 of file Auditor.cpp.

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

Implementation of IProperty::setProperty.

Definition at line 230 of file Auditor.cpp.

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

Implementation of IProperty::setProperty.

Definition at line 233 of file Auditor.cpp.

233  {
234  return m_PropertyMgr->setProperty(n,v);
235 }
StatusCode setProperty(const Property &p) override
set the property form another property
SmartIF< PropertyMgr > m_PropertyMgr
For management of properties.
Definition: Auditor.h:242
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 192 of file Auditor.h.

194  { 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:242
const std::string & name() const override
Definition: Auditor.cpp:202
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 150 of file Auditor.cpp.

150  {
152  try{
153  //
154  // Invoke the finalize() method of the derived class if
155  // it has been initialized.
156  if ( m_isInitialized && ! m_isFinalized ) {
157  m_isFinalized = true;
158  sc = finalize();
159  if( !sc.isSuccess() ) return StatusCode::FAILURE;
160  }
161  return sc;
162  //
163  }
164  catch( const GaudiException& Exception )
165  {
167  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
168  log << MSG::FATAL
169  << " Exception with tag=" << Exception.tag() << " is catched " << endmsg;
172  MsgStream logEx ( msgSvc() , Exception.tag() );
173  logEx << MSG::ERROR
174  << Exception << endmsg;
175  }
176  catch( const std::exception& Exception )
177  {
179  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
180  log << MSG::FATAL
181  << " Standard std::exception is caught " << endmsg;
183  MsgStream logEx ( msgSvc() , name() + "*std::exception*" );
184  logEx << MSG::ERROR
185  << Exception.what() << endmsg;
186  }
187  catch( ... )
188  {
190  MsgStream log ( msgSvc() , name() + ".sysFinalize()" );
191  log << MSG::FATAL
192  << " UNKNOWN Exception is caught " << endmsg;
193  }
195  return StatusCode::FAILURE ;
196 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
virtual StatusCode finalize()
Definition: Auditor.cpp:198
Define general base for Gaudi exception.
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:245
T what(T...args)
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
STL class.
const std::string & name() const override
Definition: Auditor.cpp:202
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
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:246
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 the Auditor's properties
40  sc = setProperties();
41  if( !sc.isSuccess() ) return StatusCode::FAILURE;
42 
43  {
44  try{
45  // Invoke the initialize() method of the derived class
46  sc = initialize();
47  if( !sc.isSuccess() ) return StatusCode::FAILURE;
48  m_isInitialized = true;
49 
50  return sc;
51  }
52  catch ( const GaudiException& Exception )
53  {
55  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
56  log << MSG::FATAL << " Exception with tag=" << Exception.tag() << " is caught " << endmsg;
58  MsgStream logEx ( msgSvc() , Exception.tag() );
59  logEx << MSG::ERROR << Exception << endmsg;
60  }
61  catch( const std::exception& Exception )
62  {
64  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
65  log << MSG::FATAL << " Standard std::exception is caught " << endmsg;
67  MsgStream logEx ( msgSvc() , name() + "*std::exception*" );
68  logEx << MSG::ERROR << Exception.what() << endmsg;
69  }
70  catch(...)
71  {
73  MsgStream log ( msgSvc() , name() + ".sysInitialize()" );
74  log << MSG::FATAL << " UNKNOWN Exception is caught " << endmsg;
75  }
76  }
77  }
79  return StatusCode::FAILURE;
80 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
StatusCode setProperties()
Set the auditor's properties.
Definition: Auditor.cpp:216
bool m_isInitialized
Auditor has been initialized flag.
Definition: Auditor.h:245
SmartIF< ISvcLocator > m_pSvcLocator
Pointer to service locator service.
Definition: Auditor.h:241
T what(T...args)
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
STL class.
bool isEnabled() const override
Definition: Auditor.cpp:206
const std::string & name() const override
Definition: Auditor.cpp:202
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
virtual StatusCode initialize()
Definition: Auditor.cpp:82
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

Member Data Documentation

bool Auditor::m_isEnabled
private

Auditor is enabled flag.

Definition at line 244 of file Auditor.h.

bool Auditor::m_isFinalized
private

Auditor has been finalized flag.

Definition at line 246 of file Auditor.h.

bool Auditor::m_isInitialized
private

Auditor has been initialized flag.

Definition at line 245 of file Auditor.h.

std::string Auditor::m_name
private

Auditor's name for identification.

Definition at line 239 of file Auditor.h.

int Auditor::m_outputLevel
private

Auditor output level.

Definition at line 243 of file Auditor.h.

SmartIF<PropertyMgr> Auditor::m_PropertyMgr
private

For management of properties.

Definition at line 242 of file Auditor.h.

SmartIF<ISvcLocator> Auditor::m_pSvcLocator
mutableprivate

Pointer to service locator service.

Definition at line 241 of file Auditor.h.


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