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

#include <src/AuditorSvc.h>

Inheritance diagram for AuditorSvc:
Collaboration diagram for AuditorSvc:

Public Types

typedef std::list< IAuditor * > ListAudits
 
typedef std::vector< std::string > VectorName
 
- Public Types inherited from extends1< Service, IAuditorSvc >
typedef extends1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1
< IAuditorSvc
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 Service
typedef
Gaudi::PluginService::Factory
< IService *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IService, IProperty,
IStateful
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_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. 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 Types inherited from extend_interfaces1< IAuditorSvc >
typedef
IAuditorSvc::iid::iids::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from extend_interfaces2< IService, IAuditor >
typedef mpl::fold< typename
IService::iid::iids::type,
typename
IAuditor::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 Member Functions

virtual StatusCode initialize ()
 Initialization (from CONFIGURED to INITIALIZED). More...
 
virtual StatusCode finalize ()
 Finalize (from INITIALIZED to CONFIGURED). 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 *ini)
 
virtual void afterInitialize (INamedInterface *ini)
 
virtual void beforeReinitialize (INamedInterface *ini)
 
virtual void afterReinitialize (INamedInterface *ini)
 
virtual void beforeExecute (INamedInterface *ini)
 
virtual void afterExecute (INamedInterface *ini, const StatusCode &)
 
virtual void beforeBeginRun (INamedInterface *ini)
 
virtual void afterBeginRun (INamedInterface *ini)
 
virtual void beforeEndRun (INamedInterface *ini)
 
virtual void afterEndRun (INamedInterface *ini)
 
virtual void beforeFinalize (INamedInterface *ini)
 
virtual void afterFinalize (INamedInterface *ini)
 
virtual bool isEnabled () const
 Tell if the auditor is enabled or not. More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual IAuditorgetAuditor (const std::string &name)
 management functionality: retrieve an Auditor More...
 
 AuditorSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~AuditorSvc ()
 
- Public Member Functions inherited from extends1< Service, IAuditorSvc >
 extends1 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends1 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends1 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends1 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by 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
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 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...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor 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 unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces1< IAuditorSvc >
virtual ~extend_interfaces1 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAuditorSvc
 DeclareInterfaceIDMultiBase (IAuditorSvc, 3, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from extend_interfaces2< IService, IAuditor >
virtual ~extend_interfaces2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAuditor
 DeclareInterfaceID (IAuditor, 3, 0)
 InterfaceID. More...
 

Private Member Functions

IAuditornewAuditor_ (MsgStream &, const std::string &)
 
IAuditorfindAuditor_ (const std::string &)
 
StatusCode syncAuditors_ ()
 

Private Attributes

VectorName m_audNameList
 
ListAudits m_pAudList
 
bool m_isEnabled
 

Additional Inherited Members

- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Detailed Description

Definition at line 19 of file AuditorSvc.h.

Member Typedef Documentation

typedef std::list<IAuditor*> AuditorSvc::ListAudits

Definition at line 24 of file AuditorSvc.h.

typedef std::vector<std::string> AuditorSvc::VectorName

Definition at line 25 of file AuditorSvc.h.

Constructor & Destructor Documentation

AuditorSvc::AuditorSvc ( const std::string &  name,
ISvcLocator svc 
)

Definition at line 96 of file AuditorSvc.cpp.

97 : base_class(name, svc) {
98  declareProperty("Auditors", m_audNameList );
99  declareProperty("Enable", m_isEnabled = true);
100  m_pAudList.clear();
101 }
extends1 base_class
Typedef to this class.
Definition: extends.h:12
VectorName m_audNameList
Definition: AuditorSvc.h:104
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
bool m_isEnabled
Definition: AuditorSvc.h:110
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:211
ListAudits m_pAudList
Definition: AuditorSvc.h:107
AuditorSvc::~AuditorSvc ( )
virtual

Definition at line 104 of file AuditorSvc.cpp.

104  {
105 }

Member Function Documentation

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

Audit the end of a standard "event".

Implements IAuditor.

Definition at line 174 of file AuditorSvc.cpp.

174  {
175  if (!isEnabled()) return;
176  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
177  if((*it)->isEnabled()) {
178  (*it)->after(evt,obj,sc);
179  }
180  }
181 }
virtual bool isEnabled() const
Tell if the auditor is enabled or not.
Definition: AuditorSvc.cpp:239
ListAudits m_pAudList
Definition: AuditorSvc.h:107
void AuditorSvc::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.

Definition at line 183 of file AuditorSvc.cpp.

183  {
184  if (!isEnabled()) return;
185  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
186  if((*it)->isEnabled()) {
187  (*it)->after(evt,name,sc);
188  }
189  }
190 }
virtual bool isEnabled() const
Tell if the auditor is enabled or not.
Definition: AuditorSvc.cpp:239
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
ListAudits m_pAudList
Definition: AuditorSvc.h:107
void AuditorSvc::after ( CustomEventTypeRef  ,
INamedInterface ,
const StatusCode sc 
)
virtual

Audit the end of a custom "event".

Implements IAuditor.

Definition at line 192 of file AuditorSvc.cpp.

192  {
193  if (!isEnabled()) return;
194  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
195  if((*it)->isEnabled()) {
196  (*it)->after(evt,obj,sc);
197  }
198  }
199 }
virtual bool isEnabled() const
Tell if the auditor is enabled or not.
Definition: AuditorSvc.cpp:239
ListAudits m_pAudList
Definition: AuditorSvc.h:107
void AuditorSvc::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.

Definition at line 201 of file AuditorSvc.cpp.

201  {
202  if (!isEnabled()) return;
203  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
204  if((*it)->isEnabled()) {
205  (*it)->after(evt,name,sc);
206  }
207  }
208 }
virtual bool isEnabled() const
Tell if the auditor is enabled or not.
Definition: AuditorSvc.cpp:239
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
ListAudits m_pAudList
Definition: AuditorSvc.h:107
virtual void AuditorSvc::afterBeginRun ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

virtual void AuditorSvc::afterEndRun ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

void AuditorSvc::afterExecute ( INamedInterface ,
const StatusCode  
)
virtual
Deprecated:
use after

Implements IAuditor.

Definition at line 224 of file AuditorSvc.cpp.

224  {
225  throw GaudiException("The method afterExecute is obsolete do not call it.",
226  "AuditorSvc::afterExecute" , StatusCode::FAILURE);
227 }
Define general base for Gaudi exception.
virtual void AuditorSvc::afterFinalize ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

virtual void AuditorSvc::afterInitialize ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

virtual void AuditorSvc::afterReinitialize ( INamedInterface )
virtual
Deprecated:
use after

Implements IAuditor.

void AuditorSvc::before ( StandardEventType  evt,
INamedInterface obj 
)
virtual

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

Implements IAuditor.

Definition at line 137 of file AuditorSvc.cpp.

137  {
138  if (!isEnabled()) return;
139  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
140  if((*it)->isEnabled()) {
141  (*it)->before(evt,obj);
142  }
143  }
144 }
virtual bool isEnabled() const
Tell if the auditor is enabled or not.
Definition: AuditorSvc.cpp:239
ListAudits m_pAudList
Definition: AuditorSvc.h:107
void AuditorSvc::before ( StandardEventType  ,
const std::string &   
)
virtual

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

Implements IAuditor.

Definition at line 146 of file AuditorSvc.cpp.

146  {
147  if (!isEnabled()) return;
148  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
149  if((*it)->isEnabled()) {
150  (*it)->before(evt,name);
151  }
152  }
153 }
virtual bool isEnabled() const
Tell if the auditor is enabled or not.
Definition: AuditorSvc.cpp:239
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
ListAudits m_pAudList
Definition: AuditorSvc.h:107
void AuditorSvc::before ( CustomEventTypeRef  ,
INamedInterface  
)
virtual

Audit the start of a custom "event".

Implements IAuditor.

Definition at line 155 of file AuditorSvc.cpp.

155  {
156  if (!isEnabled()) return;
157  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
158  if((*it)->isEnabled()) {
159  (*it)->before(evt,obj);
160  }
161  }
162 }
virtual bool isEnabled() const
Tell if the auditor is enabled or not.
Definition: AuditorSvc.cpp:239
ListAudits m_pAudList
Definition: AuditorSvc.h:107
void AuditorSvc::before ( CustomEventTypeRef  ,
const std::string &   
)
virtual

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

Implements IAuditor.

Definition at line 164 of file AuditorSvc.cpp.

164  {
165  if (!isEnabled()) return;
166  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
167  if((*it)->isEnabled()) {
168  (*it)->before(evt,name);
169  }
170  }
171 }
virtual bool isEnabled() const
Tell if the auditor is enabled or not.
Definition: AuditorSvc.cpp:239
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
ListAudits m_pAudList
Definition: AuditorSvc.h:107
virtual void AuditorSvc::beforeBeginRun ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeEndRun ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeExecute ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeFinalize ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeInitialize ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeReinitialize ( INamedInterface )
virtual
Deprecated:
use before

Implements IAuditor.

StatusCode AuditorSvc::finalize ( )
virtual

Finalize (from INITIALIZED to CONFIGURED).

Reimplemented from Service.

Definition at line 122 of file AuditorSvc.cpp.

122  {
123 
124  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
125  if((*it)->isEnabled()) {
126  (*it)->sysFinalize().ignore();
127  }
128  (*it)->release();
129  }
130  m_pAudList.clear();
131 
132  // Finalize this specific service
133  return Service::finalize();
134 }
ListAudits m_pAudList
Definition: AuditorSvc.h:107
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
IAuditor * AuditorSvc::findAuditor_ ( const std::string &  name)
private

Definition at line 46 of file AuditorSvc.cpp.

46  {
47  // find an auditor by name, return 0 on error
48  IAuditor* aud = 0;
49  const std::string item_name = Gaudi::Utils::TypeNameString(name).name();
50  for ( ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); ++it ) {
51  if ( (*it)->name() == item_name ) {
52  (*it)->addRef();
53  aud = *it;
54  break;
55  }
56  }
57 
58  return aud;
59 }
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
const std::string & name() const
ListAudits m_pAudList
Definition: AuditorSvc.h:107
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:18
IAuditor * AuditorSvc::getAuditor ( const std::string &  name)
virtual

management functionality: retrieve an Auditor

Implements IAuditorSvc.

Definition at line 251 of file AuditorSvc.cpp.

251  {
252  // by interactively setting properties, auditors might be out of sync
253  if ( !syncAuditors_().isSuccess() ) {
254  // as we didn't manage to sync auditors, the safest bet is to assume the
255  // worse...
256  // So don't let clients play with an AuditorSvc in an inconsistent state
257  return 0;
258  }
259 
260  // search available auditors, returns 0 on error
261  return findAuditor_( name );
262 }
IAuditor * findAuditor_(const std::string &)
Definition: AuditorSvc.cpp:46
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
StatusCode syncAuditors_()
Definition: AuditorSvc.cpp:61
StatusCode AuditorSvc::initialize ( )
virtual

Initialization (from CONFIGURED to INITIALIZED).

Reimplemented from Service.

Definition at line 110 of file AuditorSvc.cpp.

110  {
112  if ( sc.isFailure() )
113  return sc;
114 
115  // create auditor objects for all named auditors
116  sc = syncAuditors_();
117 
118  return sc;
119 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
StatusCode syncAuditors_()
Definition: AuditorSvc.cpp:61
bool AuditorSvc::isEnabled ( ) const
virtual

Tell if the auditor is enabled or not.

Implements IAuditor.

Definition at line 239 of file AuditorSvc.cpp.

239  {
240  return m_isEnabled;
241 }
bool m_isEnabled
Definition: AuditorSvc.h:110
IAuditor * AuditorSvc::newAuditor_ ( MsgStream log,
const std::string &  name 
)
private

Definition at line 22 of file AuditorSvc.cpp.

22  {
23  // locate the auditor factory, instantiate a new auditor, initialize it
24  IAuditor* aud = 0;
25  StatusCode sc;
27  aud = Auditor::Factory::create( item.type(), item.name(), serviceLocator().get() );
28  if ( aud ) {
29  aud->addRef();
31  sc = aud->sysInitialize();
32  if ( sc.isFailure() ) {
33  log << MSG::WARNING << "Failed to initialize Auditor " << name << endmsg;
34  aud->release();
35  aud = 0;
36  }
37  }
38  }
39  else {
40  log << MSG::WARNING << "Unable to retrieve factory for Auditor " << name << endmsg;
41  }
42 
43  return aud;
44 }
Gaudi::StateMachine::State m_targetState
Service state.
Definition: Service.h:247
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:62
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
virtual unsigned long release()=0
Release Interface instance.
tuple item
print s1,s2
Definition: ana.py:146
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:18
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
virtual StatusCode sysInitialize()=0
Used by AuditorSvc.
StatusCode AuditorSvc::syncAuditors_ ( )
private

Definition at line 61 of file AuditorSvc.cpp.

61  {
62  if ( m_audNameList.size() == m_pAudList.size() )
63  return StatusCode::SUCCESS;
64 
65  MsgStream log( msgSvc(), name() );
66  StatusCode sc;
67 
68 // if ( sc.isFailure() ) {
69 // log << MSG::ERROR << "Unable to locate ObjectManager Service" << endmsg;
70 // return sc;
71 // }
72 
73  // create all declared Auditors that do not yet exist
74  for ( VectorName::iterator it = m_audNameList.begin(); it != m_audNameList.end(); it++ ) {
75 
76  // this is clumsy, but the PropertyMgr won't tell us when my property changes right
77  // under my nose, so I'll have to figure this out the hard way
78  if ( !findAuditor_( *it ) ) { // if auditor does not yet exist
79  IAuditor* aud = newAuditor_( log, *it );
80 
81  if ( aud != 0 ) {
82  m_pAudList.push_back( aud );
83  }
84  else {
85  log << MSG::ERROR << "Error constructing Auditor " << *it << endmsg;
87  }
88  }
89  }
90  return sc;
91 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
VectorName m_audNameList
Definition: AuditorSvc.h:104
IAuditor * newAuditor_(MsgStream &, const std::string &)
Definition: AuditorSvc.cpp:22
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
IAuditor * findAuditor_(const std::string &)
Definition: AuditorSvc.cpp:46
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
ListAudits m_pAudList
Definition: AuditorSvc.h:107
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:18
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode AuditorSvc::sysFinalize ( )
virtual

Finalize Service.

Reimplemented from Service.

Definition at line 246 of file AuditorSvc.cpp.

246  {
247  return Service::sysFinalize();
248 }
virtual StatusCode sysFinalize()
Finalize Service.
Definition: Service.cpp:164
StatusCode AuditorSvc::sysInitialize ( )
virtual

Initialize Service.

Reimplemented from Service.

Definition at line 243 of file AuditorSvc.cpp.

243  {
244  return Service::sysInitialize();
245 }
virtual StatusCode sysInitialize()
Initialize Service.
Definition: Service.cpp:37

Member Data Documentation

VectorName AuditorSvc::m_audNameList
private

Definition at line 104 of file AuditorSvc.h.

bool AuditorSvc::m_isEnabled
private

Definition at line 110 of file AuditorSvc.h.

ListAudits AuditorSvc::m_pAudList
private

Definition at line 107 of file AuditorSvc.h.


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