![]() |
|
|
Generated: 8 Jan 2009 |
00001 // $Id: AlgTool.cpp,v 1.25 2008/10/23 15:57:37 marcocle Exp $ 00002 00003 // Include files 00004 #include "GaudiKernel/AlgTool.h" 00005 #include "GaudiKernel/IMessageSvc.h" 00006 #include "GaudiKernel/ISvcLocator.h" 00007 #include "GaudiKernel/IJobOptionsSvc.h" 00008 00009 #include "GaudiKernel/Algorithm.h" 00010 #include "GaudiKernel/Service.h" 00011 #include "GaudiKernel/Auditor.h" 00012 #include "GaudiKernel/System.h" 00013 #include "GaudiKernel/GaudiException.h" 00014 #include "GaudiKernel/ServiceLocatorHelper.h" 00015 #include "GaudiKernel/ThreadGaudi.h" 00016 #include "GaudiKernel/Guards.h" 00017 00018 00019 //------------------------------------------------------------------------------ 00020 unsigned long AlgTool::addRef() 00021 //------------------------------------------------------------------------------ 00022 { 00023 m_refCount++; 00024 return m_refCount; 00025 } 00026 00027 //------------------------------------------------------------------------------ 00028 unsigned long AlgTool::release() 00029 //------------------------------------------------------------------------------ 00030 { 00031 unsigned long count = --m_refCount; 00032 if( count <= 0) { 00033 delete this; 00034 } 00035 return count; 00036 } 00037 00038 //------------------------------------------------------------------------------ 00039 StatusCode AlgTool::queryInterface 00040 ( const InterfaceID& riid , 00041 void** ppvi ) 00042 //------------------------------------------------------------------------------ 00043 { 00044 if ( 0 == ppvi ) { return StatusCode::FAILURE ; } // RETURN 00045 // 00046 if ( IAlgTool ::interfaceID() .versionMatch ( riid ) ) 00047 { *ppvi = static_cast<IAlgTool*> ( this ) ; } 00048 else if ( IProperty ::interfaceID() .versionMatch ( riid ) ) 00049 { *ppvi = static_cast<IProperty*> ( this ) ; } 00050 else if ( IStateful ::interfaceID() . versionMatch ( riid ) ) 00051 { *ppvi = static_cast<IStateful*> ( this ) ; } 00052 else if ( INamedInterface ::interfaceID() .versionMatch ( riid ) ) 00053 { *ppvi = static_cast<INamedInterface*> ( this ) ; } 00054 else if ( IInterface ::interfaceID() .versionMatch ( riid ) ) 00055 { *ppvi = static_cast<IInterface*> ( this ) ; } 00056 else 00057 { 00058 for ( InterfaceList::iterator it = m_interfaceList.begin() ; 00059 m_interfaceList.end() != it ; ++it ) 00060 { 00061 if ( !it->first.versionMatch ( riid ) ) { continue ; } 00062 // OK 00063 *ppvi = it->second ; 00064 addRef() ; 00065 return SUCCESS ; // RETURN 00066 } 00067 *ppvi = 0 ; 00068 return NO_INTERFACE ; // RETURN 00069 } 00070 // increment the reference counter 00071 addRef() ; 00072 // 00073 return SUCCESS; 00074 } 00075 //------------------------------------------------------------------------------ 00076 void AlgTool::declInterface( const InterfaceID& iid, void* ii) 00077 //------------------------------------------------------------------------------ 00078 { 00079 m_interfaceList.push_back(std::make_pair(iid, ii)); 00080 } 00081 00082 00083 //------------------------------------------------------------------------------ 00084 const std::string& AlgTool::name() const 00085 //------------------------------------------------------------------------------ 00086 { 00087 return m_name; 00088 } 00089 00090 //------------------------------------------------------------------------------ 00091 const std::string& AlgTool::type() const 00092 //------------------------------------------------------------------------------ 00093 { 00094 return m_type; 00095 } 00096 00097 //------------------------------------------------------------------------------ 00098 const IInterface* AlgTool::parent() const 00099 //------------------------------------------------------------------------------ 00100 { 00101 return m_parent; 00102 } 00103 00104 //------------------------------------------------------------------------------ 00105 ISvcLocator* AlgTool::serviceLocator() const 00106 //------------------------------------------------------------------------------ 00107 { 00108 return m_svcLocator; 00109 } 00110 00111 //------------------------------------------------------------------------------ 00112 IMessageSvc* AlgTool::msgSvc() const 00113 //------------------------------------------------------------------------------ 00114 { 00115 return m_messageSvc; 00116 } 00117 00118 //------------------------------------------------------------------------------ 00119 IToolSvc* AlgTool::toolSvc() const 00120 //------------------------------------------------------------------------------ 00121 { 00122 if ( 0 == m_ptoolSvc ) { 00123 StatusCode sc = service( "ToolSvc", m_ptoolSvc, true ); 00124 if( sc.isFailure() ) { 00125 throw GaudiException("Service [ToolSvc] not found", name(), sc); 00126 } 00127 } 00128 return m_ptoolSvc; 00129 } 00130 00131 //------------------------------------------------------------------------------ 00132 StatusCode AlgTool::setProperty(const Property& p) 00133 //------------------------------------------------------------------------------ 00134 { 00135 return m_propertyMgr->setProperty(p); 00136 } 00137 00138 //------------------------------------------------------------------------------ 00139 StatusCode AlgTool::setProperty(const std::string& s) 00140 //------------------------------------------------------------------------------ 00141 { 00142 return m_propertyMgr->setProperty(s); 00143 } 00144 00145 //------------------------------------------------------------------------------ 00146 StatusCode AlgTool::setProperty(const std::string& n, const std::string& v) 00147 //------------------------------------------------------------------------------ 00148 { 00149 return m_propertyMgr->setProperty(n,v); 00150 } 00151 00152 //------------------------------------------------------------------------------ 00153 StatusCode AlgTool::getProperty(Property* p) const 00154 //------------------------------------------------------------------------------ 00155 { 00156 return m_propertyMgr->getProperty(p); 00157 } 00158 00159 //------------------------------------------------------------------------------ 00160 const Property& AlgTool::getProperty(const std::string& n) const 00161 { 00162 return m_propertyMgr->getProperty(n); 00163 } 00164 00165 //------------------------------------------------------------------------------ 00166 StatusCode AlgTool::getProperty(const std::string& n, std::string& v ) const 00167 //------------------------------------------------------------------------------ 00168 { 00169 return m_propertyMgr->getProperty(n,v); 00170 } 00171 00172 //------------------------------------------------------------------------------ 00173 const std::vector<Property*>& AlgTool::getProperties() const 00174 //------------------------------------------------------------------------------ 00175 { 00176 return m_propertyMgr->getProperties(); 00177 } 00178 00179 //------------------------------------------------------------------------------ 00180 StatusCode AlgTool::setProperties() 00181 //------------------------------------------------------------------------------ 00182 { 00183 IJobOptionsSvc* jos; 00184 if( m_svcLocator == 0) { 00185 return StatusCode::FAILURE; 00186 } 00187 StatusCode sc = m_svcLocator->service("JobOptionsSvc", jos); 00188 if( !sc.isSuccess() ) return StatusCode::FAILURE; 00189 00190 // set first generic Properties 00191 sc = jos->setMyProperties( getGaudiThreadGenericName(name()), this ); 00192 if( sc.isFailure() ) return StatusCode::FAILURE; 00193 00194 // set specific Properties 00195 if (isGaudiThreaded(name())) { 00196 if(jos->setMyProperties( name(), this ).isFailure()) { 00197 return StatusCode::FAILURE; 00198 } 00199 } 00200 jos->release(); 00201 00202 00203 // Change my own outputlevel 00204 if ( 0 != m_messageSvc ) 00205 { 00206 if ( MSG::NIL != m_outputLevel ) 00207 { m_messageSvc -> setOutputLevel ( name () , m_outputLevel ) ; } 00208 m_outputLevel = m_messageSvc -> outputLevel ( name () ) ; 00209 } 00210 00211 return StatusCode::SUCCESS; 00212 } 00213 00214 //------------------------------------------------------------------------------ 00215 AlgTool::AlgTool( const std::string& type, 00216 const std::string& name, 00217 const IInterface* parent) 00218 //------------------------------------------------------------------------------ 00219 : m_outputLevel ( MSG::NIL ) 00220 , m_type ( type ) 00221 , m_name ( name ) 00222 , m_parent ( parent ) 00223 , m_refCount ( 1 ) 00224 , m_svcLocator ( 0 ) 00225 , m_messageSvc ( 0 ) 00226 , m_ptoolSvc ( 0 ) 00227 , m_pMonitorSvc ( NULL ) 00228 , m_propertyMgr ( new PropertyMgr() ) 00229 , m_interfaceList ( ) 00230 , m_threadID ( ) 00231 , m_pAuditorSvc ( 0 ) 00232 , m_auditInit ( false ) 00233 , m_state ( Gaudi::StateMachine::CONFIGURED ) 00234 , m_targetState ( Gaudi::StateMachine::CONFIGURED ) 00235 { 00236 declareProperty( "MonitorService", m_monitorSvcName = "MonitorSvc" ); 00237 00238 { // get the "OutputLevel" property from parent 00239 const Property* _p = Gaudi::Utils::getProperty ( parent , "OutputLevel") ; 00240 if ( 0 != _p ) { m_outputLevel.assign( *_p ) ; } 00241 declareProperty ( "OutputLevel" , m_outputLevel ) ; 00242 m_outputLevel.declareUpdateHandler(&AlgTool::initOutputLevel, this); 00243 } 00244 00245 IInterface* _p = const_cast<IInterface*> ( parent ) ; 00246 00247 if ( Algorithm* _alg = dynamic_cast<Algorithm*> ( _p ) ) 00248 { 00249 m_svcLocator = _alg -> serviceLocator () ; 00250 m_messageSvc = _alg -> msgSvc () ; 00251 m_threadID = getGaudiThreadIDfromName ( _alg -> name() ) ; 00252 } 00253 else if ( Service* _svc = dynamic_cast<Service*> ( _p ) ) 00254 { 00255 m_svcLocator = _svc -> serviceLocator () ; 00256 m_messageSvc = _svc -> msgSvc () ; 00257 m_threadID = getGaudiThreadIDfromName ( _svc -> name() ) ; 00258 } 00259 else if ( AlgTool* _too = dynamic_cast<AlgTool*> ( _p ) ) 00260 { 00261 m_svcLocator = _too -> m_svcLocator; 00262 m_messageSvc = _too -> m_messageSvc; 00263 m_threadID = getGaudiThreadIDfromName ( _too ->m_threadID ) ; 00264 } 00265 else if ( Auditor* _aud = dynamic_cast<Auditor*> ( _p ) ) 00266 { 00267 m_svcLocator = _aud -> serviceLocator() ; 00268 m_messageSvc = _aud -> msgSvc() ; 00269 m_threadID = getGaudiThreadIDfromName ( _aud -> name() ) ; 00270 } 00271 else 00272 { 00273 throw GaudiException 00274 ( "Failure to create tool '" 00275 + type + "/" + name + "': illegal parent type '" 00276 + System::typeinfoName(typeid(*_p)) + "'", "AlgTool", 0 ); 00277 } 00278 00279 00280 { // audit tools 00281 IProperty *appMgr = 0 ; 00282 StatusCode sc = m_svcLocator->service("ApplicationMgr", appMgr) ; 00283 if (sc.isFailure() || 0 == appMgr ) 00284 { throw GaudiException("Could not locate ApplicationMgr","AlgTool",0); } 00285 const Property* p = Gaudi::Utils::getProperty( appMgr , "AuditTools"); 00286 if ( 0 != p ) { m_auditInit.assign ( *p ) ; } 00287 declareProperty ( "AuditTools", m_auditInit ); 00288 bool audit = m_auditInit.value(); 00289 // Declare common AlgTool properties with their defaults 00290 declareProperty ( "AuditInitialize" , m_auditorInitialize = audit ) ; 00291 declareProperty ( "AuditStart" , m_auditorStart = audit ) ; 00292 declareProperty ( "AuditStop" , m_auditorStop = audit ) ; 00293 declareProperty ( "AuditFinalize" , m_auditorFinalize = audit ) ; 00294 } 00295 00296 // check thread ID and try if tool name indicates thread ID 00297 if ( m_threadID.empty() ) 00298 { m_threadID = getGaudiThreadIDfromName ( AlgTool::name() ) ; } 00299 } 00300 00301 //----------------------------------------------------------------------------- 00302 StatusCode AlgTool::sysInitialize() { 00303 //----------------------------------------------------------------------------- 00304 StatusCode sc; 00305 00306 try { 00307 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::INITIALIZE,m_state); 00308 Gaudi::Guards::AuditorGuard guard(this, 00309 // check if we want to audit the initialize 00310 (m_auditorInitialize) ? auditorSvc() : 0, 00311 IAuditor::Initialize); 00312 sc = initialize(); 00313 if (sc.isSuccess()) 00314 m_state = m_targetState; 00315 return sc; 00316 } 00317 catch( const GaudiException& Exception ) { 00318 MsgStream log ( msgSvc() , name() + ".sysInitialize()" ); 00319 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00320 << " is caught " << endreq; 00321 log << MSG::ERROR << Exception << endreq; 00322 } 00323 catch( const std::exception& Exception ) { 00324 MsgStream log ( msgSvc() , name() + ".sysInitialize()" ); 00325 log << MSG::FATAL << " Standard std::exception is caught " << endreq; 00326 log << MSG::ERROR << Exception.what() << endreq; 00327 } 00328 catch( ... ) { 00329 MsgStream log ( msgSvc() , name() + ".sysInitialize()" ); 00330 log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq; 00331 } 00332 return StatusCode::FAILURE ; 00333 00334 } 00335 00336 //------------------------------------------------------------------------------ 00337 StatusCode AlgTool::initialize() 00338 //------------------------------------------------------------------------------ 00339 { 00340 // For the time being there is nothing to be done here. 00341 // Setting the properties is done by the ToolSvc calling setProperties() 00342 // explicitly. 00343 return StatusCode::SUCCESS; 00344 } 00345 00346 //----------------------------------------------------------------------------- 00347 StatusCode AlgTool::sysStart() { 00348 //----------------------------------------------------------------------------- 00349 StatusCode sc; 00350 00351 try { 00352 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state); 00353 Gaudi::Guards::AuditorGuard guard(this, 00354 // check if we want to audit the initialize 00355 (m_auditorStart) ? auditorSvc() : 0, 00356 IAuditor::Start); 00357 sc = start(); 00358 if (sc.isSuccess()) 00359 m_state = m_targetState; 00360 return sc; 00361 } 00362 catch( const GaudiException& Exception ) { 00363 MsgStream log ( msgSvc() , name() + ".sysStart()" ); 00364 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00365 << " is caught " << endreq; 00366 log << MSG::ERROR << Exception << endreq; 00367 } 00368 catch( const std::exception& Exception ) { 00369 MsgStream log ( msgSvc() , name() + ".sysStart()" ); 00370 log << MSG::FATAL << " Standard std::exception is caught " << endreq; 00371 log << MSG::ERROR << Exception.what() << endreq; 00372 } 00373 catch( ... ) { 00374 MsgStream log ( msgSvc() , name() + ".sysStart()" ); 00375 log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq; 00376 } 00377 return StatusCode::FAILURE ; 00378 00379 } 00380 00381 //------------------------------------------------------------------------------ 00382 StatusCode AlgTool::start() 00383 //------------------------------------------------------------------------------ 00384 { 00385 // For the time being there is nothing to be done here. 00386 return StatusCode::SUCCESS; 00387 } 00388 00389 //----------------------------------------------------------------------------- 00390 StatusCode AlgTool::sysStop() { 00391 //----------------------------------------------------------------------------- 00392 StatusCode sc; 00393 00394 try { 00395 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::STOP,m_state); 00396 Gaudi::Guards::AuditorGuard guard(this, 00397 // check if we want to audit the initialize 00398 (m_auditorStop) ? auditorSvc() : 0, 00399 IAuditor::Stop); 00400 sc = stop(); 00401 if (sc.isSuccess()) 00402 m_state = m_targetState; 00403 return sc; 00404 } 00405 catch( const GaudiException& Exception ) { 00406 MsgStream log ( msgSvc() , name() + ".sysStop()" ); 00407 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00408 << " is caught " << endreq; 00409 log << MSG::ERROR << Exception << endreq; 00410 } 00411 catch( const std::exception& Exception ) { 00412 MsgStream log ( msgSvc() , name() + ".sysStop()" ); 00413 log << MSG::FATAL << " Standard std::exception is caught " << endreq; 00414 log << MSG::ERROR << Exception.what() << endreq; 00415 } 00416 catch( ... ) { 00417 MsgStream log ( msgSvc() , name() + ".sysStop()" ); 00418 log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq; 00419 } 00420 return StatusCode::FAILURE ; 00421 00422 } 00423 00424 //------------------------------------------------------------------------------ 00425 StatusCode AlgTool::stop() 00426 //------------------------------------------------------------------------------ 00427 { 00428 // For the time being there is nothing to be done here. 00429 return StatusCode::SUCCESS; 00430 } 00431 00432 //----------------------------------------------------------------------------- 00433 StatusCode AlgTool::sysFinalize() { 00434 //----------------------------------------------------------------------------- 00435 00436 StatusCode sc; 00437 00438 try { 00439 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::FINALIZE,m_state); 00440 Gaudi::Guards::AuditorGuard guard(this, 00441 // check if we want to audit the initialize 00442 (m_auditorFinalize) ? auditorSvc() : 0, 00443 IAuditor::Finalize); 00444 sc = finalize(); 00445 if (sc.isSuccess()) 00446 m_state = m_targetState; 00447 return sc; 00448 } 00449 catch( const GaudiException& Exception ) { 00450 MsgStream log ( msgSvc() , name() + ".sysFinalize()" ); 00451 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00452 << " is caught " << endreq; 00453 log << MSG::ERROR << Exception << endreq; 00454 } 00455 catch( const std::exception& Exception ) { 00456 MsgStream log ( msgSvc() , name() + ".sysFinalize()" ); 00457 log << MSG::FATAL << " Standard std::exception is caught " << endreq; 00458 log << MSG::ERROR << Exception.what() << endreq; 00459 } 00460 catch( ... ) { 00461 MsgStream log ( msgSvc() , name() + ".sysFinalize()" ); 00462 log << MSG::FATAL << "UNKNOWN Exception is caught " << endreq; 00463 } 00464 return StatusCode::FAILURE; 00465 00466 } 00467 //------------------------------------------------------------------------------ 00468 StatusCode AlgTool::finalize() 00469 //------------------------------------------------------------------------------ 00470 { 00471 // For the time being there is nothing to be done here. 00472 return StatusCode::SUCCESS; 00473 } 00474 00475 //----------------------------------------------------------------------------- 00476 StatusCode AlgTool::sysReinitialize() { 00477 //----------------------------------------------------------------------------- 00478 StatusCode sc; 00479 00480 // Check that the current status is the correct one. 00481 if ( Gaudi::StateMachine::INITIALIZED != FSMState() ) { 00482 MsgStream log ( msgSvc() , name() ); 00483 log << MSG::ERROR 00484 << "sysReinitialize(): cannot reinitialize tool not initialized" 00485 << endreq; 00486 return StatusCode::FAILURE; 00487 } 00488 00489 try { 00490 Gaudi::Guards::AuditorGuard guard(this, 00491 // check if we want to audit the initialize 00492 (m_auditorReinitialize) ? auditorSvc() : 0, 00493 IAuditor::ReInitialize); 00494 sc = reinitialize(); 00495 return sc; 00496 } 00497 catch( const GaudiException& Exception ) { 00498 MsgStream log ( msgSvc() , name() + ".sysReinitialize()" ); 00499 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00500 << " is caught" << endreq; 00501 log << MSG::ERROR << Exception << endreq; 00502 } 00503 catch( const std::exception& Exception ) { 00504 MsgStream log ( msgSvc() , name() + ".sysReinitialize()" ); 00505 log << MSG::FATAL << " Standard std::exception is caught" << endreq; 00506 log << MSG::ERROR << Exception.what() << endreq; 00507 } 00508 catch( ... ) { 00509 MsgStream log ( msgSvc() , name() + ".sysReinitialize()" ); 00510 log << MSG::FATAL << "UNKNOWN Exception is caught" << endreq; 00511 } 00512 return StatusCode::FAILURE ; 00513 00514 } 00515 00516 //------------------------------------------------------------------------------ 00517 StatusCode AlgTool::reinitialize() 00518 //------------------------------------------------------------------------------ 00519 { 00520 /* @TODO 00521 * MCl 2008-10-23: the implementation of reinitialize as finalize+initialize 00522 * is causing too many problems 00523 * 00524 // Default implementation is finalize+initialize 00525 StatusCode sc = finalize(); 00526 if (sc.isFailure()) { 00527 MsgStream log ( msgSvc() , name() ); 00528 log << MSG::ERROR << "reinitialize(): cannot be finalized" << endreq; 00529 return sc; 00530 } 00531 sc = initialize(); 00532 if (sc.isFailure()) { 00533 MsgStream log ( msgSvc() , name() ); 00534 log << MSG::ERROR << "reinitialize(): cannot be initialized" << endreq; 00535 return sc; 00536 } 00537 */ 00538 return StatusCode::SUCCESS; 00539 } 00540 00541 //----------------------------------------------------------------------------- 00542 StatusCode AlgTool::sysRestart() { 00543 //----------------------------------------------------------------------------- 00544 StatusCode sc; 00545 00546 // Check that the current status is the correct one. 00547 if ( Gaudi::StateMachine::RUNNING != FSMState() ) { 00548 MsgStream log ( msgSvc() , name() ); 00549 log << MSG::ERROR 00550 << "sysRestart(): cannot reinitialize tool not started" 00551 << endreq; 00552 return StatusCode::FAILURE; 00553 } 00554 00555 try { 00556 m_targetState = Gaudi::StateMachine::ChangeState(Gaudi::StateMachine::START,m_state); 00557 Gaudi::Guards::AuditorGuard guard(this, 00558 // check if we want to audit the initialize 00559 (m_auditorRestart) ? auditorSvc() : 0, 00560 IAuditor::ReStart); 00561 sc = restart(); 00562 return sc; 00563 } 00564 catch( const GaudiException& Exception ) { 00565 MsgStream log ( msgSvc() , name() + ".sysRestart()" ); 00566 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00567 << " is caught" << endreq; 00568 log << MSG::ERROR << Exception << endreq; 00569 } 00570 catch( const std::exception& Exception ) { 00571 MsgStream log ( msgSvc() , name() + ".sysRestart()" ); 00572 log << MSG::FATAL << " Standard std::exception is caught" << endreq; 00573 log << MSG::ERROR << Exception.what() << endreq; 00574 } 00575 catch( ... ) { 00576 MsgStream log ( msgSvc() , name() + ".sysRestart()" ); 00577 log << MSG::FATAL << "UNKNOWN Exception is caught" << endreq; 00578 } 00579 return StatusCode::FAILURE ; 00580 00581 } 00582 00583 //------------------------------------------------------------------------------ 00584 StatusCode AlgTool::restart() 00585 //------------------------------------------------------------------------------ 00586 { 00587 // Default implementation is stop+start 00588 StatusCode sc = stop(); 00589 if (sc.isFailure()) { 00590 MsgStream log ( msgSvc() , name() ); 00591 log << MSG::ERROR << "restart(): cannot be stopped" << endreq; 00592 return sc; 00593 } 00594 sc = start(); 00595 if (sc.isFailure()) { 00596 MsgStream log ( msgSvc() , name() ); 00597 log << MSG::ERROR << "restart(): cannot be started" << endreq; 00598 return sc; 00599 } 00600 return StatusCode::SUCCESS; 00601 } 00602 00603 //------------------------------------------------------------------------------ 00604 AlgTool::~AlgTool() 00605 //------------------------------------------------------------------------------ 00606 { 00607 delete m_propertyMgr; 00608 if( m_ptoolSvc ) m_ptoolSvc->release(); 00609 if( m_pAuditorSvc ) m_pAuditorSvc->release(); 00610 if ( m_pMonitorSvc ) { m_pMonitorSvc->undeclareAll(this); m_pMonitorSvc->release(); } 00611 } 00612 00613 //------------------------------------------------------------------------------ 00615 StatusCode 00616 AlgTool::service_i(const std::string& svcName, 00617 bool createIf, 00618 const InterfaceID& iid, 00619 void** ppSvc) const { 00620 MsgStream log(msgSvc(), name()); 00621 ServiceLocatorHelper helper(*serviceLocator(), log, name()); 00622 return helper.getService(svcName, createIf, iid, ppSvc); 00623 } 00624 00625 //------------------------------------------------------------------------------ 00626 StatusCode 00627 AlgTool::service_i(const std::string& svcType, 00628 const std::string& svcName, 00629 const InterfaceID& iid, 00630 void** ppSvc) const { 00631 00632 MsgStream log(msgSvc(), name()); 00633 ServiceLocatorHelper helper(*serviceLocator(), log, name()); 00634 return helper.createService(svcType, svcName, iid, ppSvc); 00635 } 00636 00637 //----------------------------------------------------------------------------- 00638 IAuditorSvc* AlgTool::auditorSvc() const { 00639 //--------------------------------------------------------------------------- 00640 if ( 0 == m_pAuditorSvc ) { 00641 StatusCode sc = service( "AuditorSvc", m_pAuditorSvc, true ); 00642 if( sc.isFailure() ) { 00643 throw GaudiException("Service [AuditorSvc] not found", name(), sc); 00644 } 00645 } 00646 return m_pAuditorSvc; 00647 } 00648 00649 00650 //----------------------------------------------------------------------------- 00651 void AlgTool::initOutputLevel(Property& /*prop*/) { 00652 //----------------------------------------------------------------------------- 00653 // do nothing... yet ? 00654 } 00655