![]() |
|
|
Generated: 8 Jan 2009 |
#include <AuditorSvc.h>


Definition at line 21 of file AuditorSvc.h.
Public Types | |
| typedef std::list< IAuditor * > | ListAudits |
| typedef std::vector< std::string > | VectorName |
Public Member Functions | |
| virtual StatusCode | initialize () |
| Initialization (from CONFIGURED to INITIALIZED). | |
| virtual StatusCode | finalize () |
| Finalize (from INITIALIZED to CONFIGURED). | |
| virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
| Query interfaces of Interface. | |
| 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 () |
| Initilize 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 |
| typedef std::list<IAuditor*> AuditorSvc::ListAudits |
Definition at line 26 of file AuditorSvc.h.
| typedef std::vector<std::string> AuditorSvc::VectorName |
Definition at line 27 of file AuditorSvc.h.
| AuditorSvc::AuditorSvc | ( | const std::string & | name, | |
| ISvcLocator * | svc | |||
| ) |
Definition at line 99 of file AuditorSvc.cpp.
00100 : Service(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] |
Initialization (from CONFIGURED to INITIALIZED).
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 | ( | ) | [virtual] |
Finalize (from INITIALIZED to CONFIGURED).
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 }
| StatusCode AuditorSvc::queryInterface | ( | const InterfaceID & | riid, | |
| void ** | ppvUnknown | |||
| ) | [virtual] |
Query interfaces of Interface.
| riid | ID of Interface to be retrieved | |
| ppvUnknown | Pointer to Location for interface pointer |
Reimplemented from Service.
Definition at line 144 of file AuditorSvc.cpp.
00144 { 00145 if ( IID_IAuditorSvc == riid ) { 00146 *ppvInterface = (IAuditorSvc*)this; 00147 } 00148 else if ( IID_IAuditor == riid ) { 00149 *ppvInterface = (IAuditor*)this; 00150 } 00151 else { 00152 // Interface is not directly available: try out a base class 00153 return Service::queryInterface(riid, ppvInterface); 00154 } 00155 addRef(); 00156 return StatusCode::SUCCESS; 00157 }
| 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 160 of file AuditorSvc.cpp.
00160 { 00161 if (!isEnabled()) return; 00162 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00163 if((*it)->isEnabled()) { 00164 (*it)->before(evt,obj); 00165 } 00166 } 00167 }
| 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 169 of file AuditorSvc.cpp.
00169 { 00170 if (!isEnabled()) return; 00171 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00172 if((*it)->isEnabled()) { 00173 (*it)->before(evt,name); 00174 } 00175 } 00176 }
| void AuditorSvc::before | ( | CustomEventTypeRef | , | |
| INamedInterface * | ||||
| ) | [virtual] |
Audit the start of a custom "event".
Implements IAuditor.
Definition at line 178 of file AuditorSvc.cpp.
00178 { 00179 if (!isEnabled()) return; 00180 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00181 if((*it)->isEnabled()) { 00182 (*it)->before(evt,obj); 00183 } 00184 } 00185 }
| 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 187 of file AuditorSvc.cpp.
00187 { 00188 if (!isEnabled()) return; 00189 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00190 if((*it)->isEnabled()) { 00191 (*it)->before(evt,name); 00192 } 00193 } 00194 }
| void AuditorSvc::after | ( | StandardEventType | , | |
| INamedInterface * | , | |||
| const StatusCode & | sc | |||
| ) | [virtual] |
Audit the end of a standard "event".
Implements IAuditor.
Definition at line 197 of file AuditorSvc.cpp.
00197 { 00198 if (!isEnabled()) return; 00199 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00200 if((*it)->isEnabled()) { 00201 (*it)->after(evt,obj,sc); 00202 } 00203 } 00204 }
| 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 206 of file AuditorSvc.cpp.
00206 { 00207 if (!isEnabled()) return; 00208 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00209 if((*it)->isEnabled()) { 00210 (*it)->after(evt,name,sc); 00211 } 00212 } 00213 }
| void AuditorSvc::after | ( | CustomEventTypeRef | , | |
| INamedInterface * | , | |||
| const StatusCode & | sc | |||
| ) | [virtual] |
Audit the end of a custom "event".
Implements IAuditor.
Definition at line 215 of file AuditorSvc.cpp.
00215 { 00216 if (!isEnabled()) return; 00217 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00218 if((*it)->isEnabled()) { 00219 (*it)->after(evt,obj,sc); 00220 } 00221 } 00222 }
| 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 224 of file AuditorSvc.cpp.
00224 { 00225 if (!isEnabled()) return; 00226 for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) { 00227 if((*it)->isEnabled()) { 00228 (*it)->after(evt,name,sc); 00229 } 00230 } 00231 }
| 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 247 of file AuditorSvc.cpp.
00247 { 00248 throw GaudiException("The method afterExecute is obsolete do not call it.", 00249 "AuditorSvc::afterExecute" , StatusCode::FAILURE); 00250 }
| 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 262 of file AuditorSvc.cpp.
00262 { 00263 return m_isEnabled; 00264 }
| StatusCode AuditorSvc::sysInitialize | ( | ) | [virtual] |
Initilize Service.
Reimplemented from Service.
Definition at line 266 of file AuditorSvc.cpp.
00266 { 00267 return Service::sysInitialize(); 00268 }
| StatusCode AuditorSvc::sysFinalize | ( | ) | [virtual] |
Finalize Service.
Reimplemented from Service.
Definition at line 269 of file AuditorSvc.cpp.
00269 { 00270 return Service::sysFinalize(); 00271 }
| IAuditor * AuditorSvc::getAuditor | ( | const std::string & | name | ) | [virtual] |
management functionality: retrieve an Auditor
Implements IAuditorSvc.
Definition at line 274 of file AuditorSvc.cpp.
00274 { 00275 // by interactively setting properties, auditors might be out of sync 00276 if ( !syncAuditors_().isSuccess() ) { 00277 // as we didn't manage to sync auditors, the safest bet is to assume the 00278 // worse... 00279 // So don't let clients play with an AuditorSvc in an inconsistent state 00280 return 0; 00281 } 00282 00283 // search available auditors, returns 0 on error 00284 return findAuditor_( name ); 00285 }
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 ListItem item(name) ; 00030 aud = PluginService::Create<IAuditor*>( item.type(), item.name(), serviceLocator() ); 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 << endreq; 00037 aud->release(); 00038 aud = 0; 00039 } 00040 } 00041 } 00042 else { 00043 log << MSG::WARNING << "Unable to retrieve factory for Auditor " << name << endreq; 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 = ListItem(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" << endreq; 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 << endreq; 00089 sc = StatusCode::FAILURE; 00090 } 00091 } 00092 } 00093 return sc; 00094 }
VectorName AuditorSvc::m_audNameList [private] |
Definition at line 113 of file AuditorSvc.h.
ListAudits AuditorSvc::m_pAudList [private] |
Definition at line 116 of file AuditorSvc.h.
bool AuditorSvc::m_isEnabled [private] |
Definition at line 119 of file AuditorSvc.h.