|
Gaudi Framework, version v21r8 |
| Home | Generated: 17 Mar 2010 |
#include <AuditorSvc.h>


Public Types | |
| typedef std::list< IAuditor * > | ListAudits |
| typedef std::vector< std::string > | VectorName |
Public Member Functions | |
| virtual StatusCode | initialize () |
| virtual StatusCode | finalize () |
| virtual void | before (StandardEventType, INamedInterface *) |
| The following methods are meant to be implemented by the child class... | |
| virtual void | before (StandardEventType, const std::string &) |
| Audit the start of a standard "event" for callers that do not implement INamedInterface. | |
| virtual void | before (CustomEventTypeRef, INamedInterface *) |
| Audit the start of a custom "event". | |
| virtual void | before (CustomEventTypeRef, const std::string &) |
| Audit the start of a custom "event" for callers that do not implement INamedInterface. | |
| virtual void | after (StandardEventType, INamedInterface *, const StatusCode &) |
| Audit the end of a standard "event". | |
| virtual void | after (StandardEventType, const std::string &, const StatusCode &) |
| Audit the end of a standard "event" for callers that do not implement INamedInterface. | |
| virtual void | after (CustomEventTypeRef, INamedInterface *, const StatusCode &) |
| Audit the end of a custom "event". | |
| virtual void | after (CustomEventTypeRef, const std::string &, const StatusCode &) |
| Audit the end of a custom "event" for callers that do not implement INamedInterface. | |
| 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. | |
| virtual StatusCode | sysInitialize () |
| Initialize Service. | |
| virtual StatusCode | sysFinalize () |
| Finalize Service. | |
| virtual IAuditor * | getAuditor (const std::string &name) |
| management functionality: retrieve an Auditor | |
| AuditorSvc (const std::string &name, ISvcLocator *svc) | |
| virtual | ~AuditorSvc () |
Private Member Functions | |
| IAuditor * | newAuditor_ (MsgStream &, const std::string &) |
| IAuditor * | findAuditor_ (const std::string &) |
| StatusCode | syncAuditors_ () |
Private Attributes | |
| VectorName | m_audNameList |
| ListAudits | m_pAudList |
| bool | m_isEnabled |
Definition at line 19 of file AuditorSvc.h.
| 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.
| AuditorSvc::AuditorSvc | ( | const std::string & | name, | |
| ISvcLocator * | svc | |||
| ) |
Definition at line 99 of file AuditorSvc.cpp.
00100 : base_class(name, svc) { 00101 declareProperty("Auditors", m_audNameList ); 00102 declareProperty("Enable", m_isEnabled = true); 00103 m_pAudList.clear(); 00104 }
| AuditorSvc::~AuditorSvc | ( | ) | [virtual] |
| StatusCode AuditorSvc::initialize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 113 of file AuditorSvc.cpp.
00113 { 00114 StatusCode sc = Service::initialize(); 00115 if ( sc.isFailure() ) 00116 return sc; 00117 00118 // create auditor objects for all named auditors 00119 sc = syncAuditors_(); 00120 00121 return sc; 00122 }
| StatusCode AuditorSvc::finalize | ( | void | ) | [virtual] |
Reimplemented from Service.
Definition at line 125 of file AuditorSvc.cpp.
00125 { 00126 00127 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00128 if((*it)->isEnabled()) { 00129 (*it)->sysFinalize().ignore(); 00130 } 00131 (*it)->release(); 00132 } 00133 m_pAudList.clear(); 00134 00135 // Finalize this specific service 00136 return Service::finalize(); 00137 }
| 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 140 of file AuditorSvc.cpp.
00140 { 00141 if (!isEnabled()) return; 00142 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00143 if((*it)->isEnabled()) { 00144 (*it)->before(evt,obj); 00145 } 00146 } 00147 }
| 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 149 of file AuditorSvc.cpp.
00149 { 00150 if (!isEnabled()) return; 00151 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00152 if((*it)->isEnabled()) { 00153 (*it)->before(evt,name); 00154 } 00155 } 00156 }
| void AuditorSvc::before | ( | CustomEventTypeRef | , | |
| INamedInterface * | ||||
| ) | [virtual] |
Audit the start of a custom "event".
Implements IAuditor.
Definition at line 158 of file AuditorSvc.cpp.
00158 { 00159 if (!isEnabled()) return; 00160 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00161 if((*it)->isEnabled()) { 00162 (*it)->before(evt,obj); 00163 } 00164 } 00165 }
| 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 167 of file AuditorSvc.cpp.
00167 { 00168 if (!isEnabled()) return; 00169 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00170 if((*it)->isEnabled()) { 00171 (*it)->before(evt,name); 00172 } 00173 } 00174 }
| void AuditorSvc::after | ( | StandardEventType | , | |
| INamedInterface * | , | |||
| const StatusCode & | sc | |||
| ) | [virtual] |
Audit the end of a standard "event".
Implements IAuditor.
Definition at line 177 of file AuditorSvc.cpp.
00177 { 00178 if (!isEnabled()) return; 00179 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00180 if((*it)->isEnabled()) { 00181 (*it)->after(evt,obj,sc); 00182 } 00183 } 00184 }
| 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 186 of file AuditorSvc.cpp.
00186 { 00187 if (!isEnabled()) return; 00188 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00189 if((*it)->isEnabled()) { 00190 (*it)->after(evt,name,sc); 00191 } 00192 } 00193 }
| void AuditorSvc::after | ( | CustomEventTypeRef | , | |
| INamedInterface * | , | |||
| const StatusCode & | sc | |||
| ) | [virtual] |
Audit the end of a custom "event".
Implements IAuditor.
Definition at line 195 of file AuditorSvc.cpp.
00195 { 00196 if (!isEnabled()) return; 00197 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00198 if((*it)->isEnabled()) { 00199 (*it)->after(evt,obj,sc); 00200 } 00201 } 00202 }
| 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 204 of file AuditorSvc.cpp.
00204 { 00205 if (!isEnabled()) return; 00206 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00207 if((*it)->isEnabled()) { 00208 (*it)->after(evt,name,sc); 00209 } 00210 } 00211 }
| virtual void AuditorSvc::beforeInitialize | ( | INamedInterface * | ) | [virtual] |
| virtual void AuditorSvc::afterInitialize | ( | INamedInterface * | ) | [virtual] |
| virtual void AuditorSvc::beforeReinitialize | ( | INamedInterface * | ) | [virtual] |
| virtual void AuditorSvc::afterReinitialize | ( | INamedInterface * | ) | [virtual] |
| virtual void AuditorSvc::beforeExecute | ( | INamedInterface * | ) | [virtual] |
| void AuditorSvc::afterExecute | ( | INamedInterface * | , | |
| const StatusCode & | ||||
| ) | [virtual] |
Implements IAuditor.
Definition at line 227 of file AuditorSvc.cpp.
00227 { 00228 throw GaudiException("The method afterExecute is obsolete do not call it.", 00229 "AuditorSvc::afterExecute" , StatusCode::FAILURE); 00230 }
| virtual void AuditorSvc::beforeBeginRun | ( | INamedInterface * | ) | [virtual] |
| virtual void AuditorSvc::afterBeginRun | ( | INamedInterface * | ) | [virtual] |
| virtual void AuditorSvc::beforeEndRun | ( | INamedInterface * | ) | [virtual] |
| virtual void AuditorSvc::afterEndRun | ( | INamedInterface * | ) | [virtual] |
| virtual void AuditorSvc::beforeFinalize | ( | INamedInterface * | ) | [virtual] |
| virtual void AuditorSvc::afterFinalize | ( | INamedInterface * | ) | [virtual] |
| bool AuditorSvc::isEnabled | ( | ) | const [virtual] |
Tell if the auditor is enabled or not.
Implements IAuditor.
Definition at line 242 of file AuditorSvc.cpp.
00242 { 00243 return m_isEnabled; 00244 }
| StatusCode AuditorSvc::sysInitialize | ( | ) | [virtual] |
Initialize Service.
Reimplemented from Service.
Definition at line 246 of file AuditorSvc.cpp.
00246 { 00247 return Service::sysInitialize(); 00248 }
| StatusCode AuditorSvc::sysFinalize | ( | ) | [virtual] |
Finalize Service.
Reimplemented from Service.
Definition at line 249 of file AuditorSvc.cpp.
00249 { 00250 return Service::sysFinalize(); 00251 }
| IAuditor * AuditorSvc::getAuditor | ( | const std::string & | name | ) | [virtual] |
management functionality: retrieve an Auditor
Implements IAuditorSvc.
Definition at line 254 of file AuditorSvc.cpp.
00254 { 00255 // by interactively setting properties, auditors might be out of sync 00256 if ( !syncAuditors_().isSuccess() ) { 00257 // as we didn't manage to sync auditors, the safest bet is to assume the 00258 // worse... 00259 // So don't let clients play with an AuditorSvc in an inconsistent state 00260 return 0; 00261 } 00262 00263 // search available auditors, returns 0 on error 00264 return findAuditor_( name ); 00265 }
| IAuditor * AuditorSvc::newAuditor_ | ( | MsgStream & | log, | |
| const std::string & | name | |||
| ) | [private] |
Definition at line 25 of file AuditorSvc.cpp.
00025 { 00026 // locate the auditor factory, instantiate a new auditor, initialize it 00027 IAuditor* aud = 0; 00028 StatusCode sc; 00029 Gaudi::Utils::TypeNameString item(name) ; 00030 aud = PluginService::Create<IAuditor*>( item.type(), item.name(), serviceLocator().get() ); 00031 if ( aud ) { 00032 aud->addRef(); 00033 if ( m_targetState >= Gaudi::StateMachine::INITIALIZED ) { 00034 sc = aud->sysInitialize(); 00035 if ( sc.isFailure() ) { 00036 log << MSG::WARNING << "Failed to initialize Auditor " << name << endmsg; 00037 aud->release(); 00038 aud = 0; 00039 } 00040 } 00041 } 00042 else { 00043 log << MSG::WARNING << "Unable to retrieve factory for Auditor " << name << endmsg; 00044 } 00045 00046 return aud; 00047 }
| IAuditor * AuditorSvc::findAuditor_ | ( | const std::string & | name | ) | [private] |
Definition at line 49 of file AuditorSvc.cpp.
00049 { 00050 // find an auditor by name, return 0 on error 00051 IAuditor* aud = 0; 00052 const std::string item_name = Gaudi::Utils::TypeNameString(name).name(); 00053 for ( ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); ++it ) { 00054 if ( (*it)->name() == item_name ) { 00055 (*it)->addRef(); 00056 aud = *it; 00057 break; 00058 } 00059 } 00060 00061 return aud; 00062 }
| StatusCode AuditorSvc::syncAuditors_ | ( | ) | [private] |
Definition at line 64 of file AuditorSvc.cpp.
00064 { 00065 if ( m_audNameList.size() == m_pAudList.size() ) 00066 return StatusCode::SUCCESS; 00067 00068 MsgStream log( msgSvc(), name() ); 00069 StatusCode sc; 00070 00071 // if ( sc.isFailure() ) { 00072 // log << MSG::ERROR << "Unable to locate ObjectManager Service" << endmsg; 00073 // return sc; 00074 // } 00075 00076 // create all declared Auditors that do not yet exist 00077 for ( VectorName::iterator it = m_audNameList.begin(); it != m_audNameList.end(); it++ ) { 00078 00079 // this is clumsy, but the PropertyMgr won't tell us when my property changes right 00080 // under my nose, so I'll have to figure this out the hard way 00081 if ( !findAuditor_( *it ) ) { // if auditor does not yet exist 00082 IAuditor* aud = newAuditor_( log, *it ); 00083 00084 if ( aud != 0 ) { 00085 m_pAudList.push_back( aud ); 00086 } 00087 else { 00088 log << MSG::ERROR << "Error constructing Auditor " << *it << endmsg; 00089 sc = StatusCode::FAILURE; 00090 } 00091 } 00092 } 00093 return sc; 00094 }
VectorName AuditorSvc::m_audNameList [private] |
Definition at line 104 of file AuditorSvc.h.
ListAudits AuditorSvc::m_pAudList [private] |
Definition at line 107 of file AuditorSvc.h.
bool AuditorSvc::m_isEnabled [private] |
Definition at line 110 of file AuditorSvc.h.