![]() |
|
|
Generated: 18 Jul 2008 |
#include <MinimalEventLoopMgr.h>
Inheritance diagram for MinimalEventLoopMgr:


This object handles the minimal requirements needed by the application manager. It also is capable of handling a bunch of algorithms and output streams. However, they list may as well be empty.
Definition at line 28 of file MinimalEventLoopMgr.h.
Public Types | |
| typedef std::list< IAlgorithm * > | ListAlg |
| Creator friend class. | |
| typedef std::list< std::string > | ListName |
| typedef std::vector< std::string > | VectorName |
Public Member Functions | |
| MinimalEventLoopMgr (const std::string &nam, ISvcLocator *svcLoc) | |
| Standard Constructor. | |
| virtual | ~MinimalEventLoopMgr () |
| Standard Destructor. | |
| virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
| implementation of IInterface: queryInterface | |
| virtual StatusCode | initialize () |
| implementation of IService::initalize | |
| virtual StatusCode | start () |
| implementation of IService::start | |
| virtual StatusCode | stop () |
| implementation of IService::stop | |
| virtual StatusCode | finalize () |
| implementation of IService::finalize | |
| virtual StatusCode | reinitialize () |
| implementation of IService::reinitialize | |
| virtual StatusCode | restart () |
| implementation of IService::restart | |
| virtual StatusCode | nextEvent (int maxevt) |
| implementation of IEventProcessor::nextEvent | |
| virtual StatusCode | executeEvent (void *par) |
| implementation of IEventProcessor::executeEvent(void* par) | |
| virtual StatusCode | executeRun (int maxevt) |
| implementation of IEventProcessor::executeRun( ) | |
| virtual StatusCode | stopRun () |
| implementation of IEventProcessor::stopRun( ) | |
| void | topAlgHandler (Property &p) |
| Top algorithm List handler. | |
| StatusCode | decodeTopAlgs () |
| decodeTopAlgNameList & topAlgNameListHandler | |
| void | outStreamHandler (Property &p) |
| Output stream List handler. | |
| StatusCode | decodeOutStreams () |
| decodeOutStreamNameList & outStreamNameListHandler | |
Protected Types | |
| enum | State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED } |
Protected Member Functions | |
| template<class T> | |
| T * | releaseInterface (T *iface) |
| Helper to release interface pointer. | |
Protected Attributes | |
| IAppMgrUI * | m_appMgrUI |
| Reference to the IAppMgrUI interface of the application manager. | |
| IIncidentSvc * | m_incidentSvc |
| Reference to the indicent service. | |
| ListAlg | m_topAlgList |
| List of top level algorithms. | |
| ListAlg | m_outStreamList |
| List of output streams. | |
| std::string | m_outStreamType |
| Out Stream type. | |
| StringArrayProperty | m_topAlgNames |
| List of top level algorithms names. | |
| StringArrayProperty | m_outStreamNames |
| List of output stream names. | |
| State | m_state |
| State of the object. | |
| bool | m_scheduledStop |
| Scheduled stop of event processing. | |
| IIncidentListener * | m_abortEventListener |
| Instance of the incident listener waiting for AbortEvent. | |
| bool | m_abortEvent |
| Flag signalling that the event being processedhas to be aborted (skip all following top algs). | |
| std::string | m_abortEventSource |
| Source of the AbortEvent incident. | |
| typedef std::list<IAlgorithm*> MinimalEventLoopMgr::ListAlg |
Definition at line 34 of file MinimalEventLoopMgr.h.
Definition at line 35 of file MinimalEventLoopMgr.h.
enum MinimalEventLoopMgr::State [protected] |
Definition at line 39 of file MinimalEventLoopMgr.h.
00039 { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED };
| MinimalEventLoopMgr::MinimalEventLoopMgr | ( | const std::string & | nam, | |
| ISvcLocator * | svcLoc | |||
| ) |
Standard Constructor.
Definition at line 81 of file MinimalEventLoopMgr.cpp.
References Service::declareProperty(), Property::declareUpdateHandler(), StatusCode::ignore(), IID_IAppMgrUI, m_abortEvent, m_abortEventListener, m_appMgrUI, m_incidentSvc, m_outStreamNames, m_outStreamType, m_scheduledStop, m_state, m_topAlgNames, OFFLINE, outStreamHandler(), IInterface::queryInterface(), and topAlgHandler().
00082 : Service(nam, svcLoc) 00083 { 00084 declareProperty("TopAlg", m_topAlgNames ); 00085 declareProperty("OutStream", m_outStreamNames ); 00086 declareProperty("OutStreamType", m_outStreamType = "OutputStream"); 00087 m_topAlgNames.declareUpdateHandler ( &MinimalEventLoopMgr::topAlgHandler, this ); 00088 m_outStreamNames.declareUpdateHandler( &MinimalEventLoopMgr::outStreamHandler, this ); 00089 svcLoc->queryInterface(IID_IAppMgrUI, pp_cast<void>(&m_appMgrUI)).ignore(); 00090 m_incidentSvc = 0; 00091 m_state = OFFLINE; 00092 m_scheduledStop = false; 00093 m_abortEventListener = 0; 00094 m_abortEvent = false; 00095 }
| MinimalEventLoopMgr::~MinimalEventLoopMgr | ( | ) | [virtual] |
Standard Destructor.
Definition at line 100 of file MinimalEventLoopMgr.cpp.
References m_appMgrUI, m_incidentSvc, m_state, OFFLINE, and IInterface::release().
00100 { 00101 if( m_incidentSvc ) m_incidentSvc->release(); 00102 if( m_appMgrUI ) m_appMgrUI->release(); 00103 m_state = OFFLINE; 00104 }
| T* MinimalEventLoopMgr::releaseInterface | ( | T * | iface | ) | [inline, protected] |
Helper to release interface pointer.
Definition at line 75 of file MinimalEventLoopMgr.h.
Referenced by EventLoopMgr::finalize(), and finalize().
| StatusCode MinimalEventLoopMgr::queryInterface | ( | const InterfaceID & | riid, | |
| void ** | ppvInterface | |||
| ) | [virtual] |
implementation of IInterface: queryInterface
Reimplemented from Service.
Definition at line 109 of file MinimalEventLoopMgr.cpp.
References Service::addRef(), IID_IAppMgrUI, IID_IEventProcessor, Service::queryInterface(), and StatusCode::SUCCESS.
00109 { 00110 if ( riid == IID_IAppMgrUI ) { 00111 *ppvInterface = (IAppMgrUI*)this; 00112 } 00113 else if ( riid == IID_IEventProcessor ) { 00114 *ppvInterface = (IEventProcessor*)this; 00115 } 00116 else { 00117 return Service::queryInterface(riid, ppvInterface); 00118 } 00119 addRef(); 00120 return StatusCode::SUCCESS; 00121 }
| StatusCode MinimalEventLoopMgr::initialize | ( | ) | [virtual] |
implementation of IService::initalize
Reimplemented from Service.
Reimplemented in EventLoopMgr.
Definition at line 127 of file MinimalEventLoopMgr.cpp.
References IncidentType::AbortEvent, IIncidentSvc::addListener(), std::list< _Tp, _Alloc >::begin(), CONFIGURED, decodeOutStreams(), decodeTopAlgs(), std::list< _Tp, _Alloc >::end(), endreq(), MSG::ERROR, StatusCode::FAILURE, MSG::FATAL, IID_IProperty, Service::initialize(), INITIALIZED, StatusCode::isSuccess(), SmartIFBase< TYPE >::isValid(), m_abortEvent, m_abortEventListener, m_abortEventSource, m_appMgrUI, m_incidentSvc, m_outStreamList, m_outStreamNames, m_state, m_topAlgList, m_topAlgNames, Service::msgSvc(), Service::name(), ISvcLocator::service(), Service::serviceLocator(), Service::setProperty(), StatusCode::SUCCESS, and PropertyWithValue< TYPE >::value().
Referenced by EventLoopMgr::initialize().
00127 { 00128 00129 MsgStream log(msgSvc(), name()); 00130 00131 if ( 0 == m_appMgrUI ) { 00132 return StatusCode::FAILURE; 00133 } 00134 00135 StatusCode sc = Service::initialize(); 00136 if ( !sc.isSuccess() ) { 00137 log << MSG::ERROR << "Failed to initialize Service Base class." << endreq; 00138 return StatusCode::FAILURE; 00139 } 00140 00141 SmartIF<IProperty> prpMgr(IID_IProperty, serviceLocator()); 00142 if ( ! prpMgr.isValid() ) { 00143 log << MSG::ERROR << "Error retrieving AppMgr interface IProperty." << endreq; 00144 return StatusCode::FAILURE; 00145 } 00146 else { 00147 if ( m_topAlgNames.value().size() == 0 ) { 00148 setProperty(prpMgr->getProperty("TopAlg")).ignore(); 00149 } 00150 if ( m_outStreamNames.value().size() == 0 ) { 00151 setProperty(prpMgr->getProperty("OutStream")).ignore(); 00152 } 00153 } 00154 00155 // Get the references to the services that are needed by the ApplicationMgr itself 00156 sc = serviceLocator()->service("IncidentSvc", m_incidentSvc, true); 00157 if( !sc.isSuccess() ) { 00158 log << MSG::FATAL << "Error retrieving IncidentSvc." << endreq; 00159 return sc; 00160 } 00161 00162 m_abortEventListener = new AbortEventListener(m_abortEvent,m_abortEventSource); 00163 m_incidentSvc->addListener(m_abortEventListener,IncidentType::AbortEvent); 00164 00165 // The state is changed at this moment to allow decodeXXXX() to do something 00166 m_state = INITIALIZED; 00167 00168 //-------------------------------------------------------------------------------------------- 00169 // Create output streams. Do not initialize them yet. 00170 // The state is updated temporarily in order to enable the handler, which 00171 // is also triggered by a change to the "OutputStream" Property. 00172 //-------------------------------------------------------------------------------------------- 00173 sc = decodeOutStreams(); 00174 if ( !sc.isSuccess() ) { 00175 log << MSG::ERROR << "Failed to initialize Output streams." << endreq; 00176 m_state = CONFIGURED; 00177 return sc; 00178 } 00179 //-------------------------------------------------------------------------------------------- 00180 // Create all needed Top Algorithms. Do not initialize them yet. 00181 // The state is updated temporarily in order to enable the handler, which 00182 // is also triggered by a change to the "TopAlg" Property. 00183 //-------------------------------------------------------------------------------------------- 00184 sc = decodeTopAlgs(); 00185 if ( !sc.isSuccess() ) { 00186 log << MSG::ERROR << "Failed to initialize Top Algorithms streams." << endreq; 00187 m_state = CONFIGURED; 00188 return sc; 00189 } 00190 00191 ListAlg::iterator ita; 00192 // Initialize all the new TopAlgs. In fact Algorithms are protected against getting 00193 // initialized twice. 00194 for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00195 sc = (*ita)->sysInitialize(); 00196 if( !sc.isSuccess() ) { 00197 log << MSG::ERROR << "Unable to initialize Algorithm: " << (*ita)->name() << endreq; 00198 return sc; 00199 } 00200 } 00201 for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) { 00202 sc = (*ita)->sysInitialize(); 00203 if( !sc.isSuccess() ) { 00204 log << MSG::ERROR << "Unable to initialize Output Stream: " << (*ita)->name() << endreq; 00205 return sc; 00206 } 00207 } 00208 00209 return StatusCode::SUCCESS; 00210 }
| StatusCode MinimalEventLoopMgr::start | ( | ) | [virtual] |
implementation of IService::start
Reimplemented from Service.
Definition at line 214 of file MinimalEventLoopMgr.cpp.
References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::end(), endreq(), MSG::ERROR, StatusCode::isSuccess(), m_outStreamList, m_topAlgList, Service::msgSvc(), Service::name(), Service::start(), and StatusCode::SUCCESS.
00214 { 00215 00216 StatusCode sc = Service::start(); 00217 if ( ! sc.isSuccess() ) return sc; 00218 00219 MsgStream log(msgSvc(), name()); 00220 00221 ListAlg::iterator ita; 00222 // Start all the new TopAlgs. In fact Algorithms are protected against getting 00223 // started twice. 00224 for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00225 sc = (*ita)->sysStart(); 00226 if( !sc.isSuccess() ) { 00227 log << MSG::ERROR << "Unable to initialize Algorithm: " << (*ita)->name() << endreq; 00228 return sc; 00229 } 00230 } 00231 for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) { 00232 sc = (*ita)->sysStart(); 00233 if( !sc.isSuccess() ) { 00234 log << MSG::ERROR << "Unable to initialize Output Stream: " << (*ita)->name() << endreq; 00235 return sc; 00236 } 00237 } 00238 return StatusCode::SUCCESS; 00239 }
| StatusCode MinimalEventLoopMgr::stop | ( | ) | [virtual] |
implementation of IService::stop
Reimplemented from Service.
Reimplemented in EventLoopMgr.
Definition at line 243 of file MinimalEventLoopMgr.cpp.
References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::end(), endreq(), MSG::ERROR, StatusCode::isSuccess(), m_outStreamList, m_topAlgList, Service::msgSvc(), Service::name(), Service::stop(), and StatusCode::SUCCESS.
Referenced by EventLoopMgr::stop().
00243 { 00244 00245 StatusCode sc = StatusCode::SUCCESS; 00246 00247 MsgStream log(msgSvc(), name()); 00248 00249 ListAlg::iterator ita; 00250 // Start all the new TopAlgs. In fact Algorithms are protected against getting 00251 // started twice. 00252 for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00253 sc = (*ita)->sysStop(); 00254 if( !sc.isSuccess() ) { 00255 log << MSG::ERROR << "Unable to initialize Algorithm: " << (*ita)->name() << endreq; 00256 return sc; 00257 } 00258 } 00259 for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) { 00260 sc = (*ita)->sysStop(); 00261 if( !sc.isSuccess() ) { 00262 log << MSG::ERROR << "Unable to initialize Output Stream: " << (*ita)->name() << endreq; 00263 return sc; 00264 } 00265 } 00266 00267 return Service::stop(); 00268 }
| StatusCode MinimalEventLoopMgr::finalize | ( | ) | [virtual] |
implementation of IService::finalize
Reimplemented from Service.
Reimplemented in EventLoopMgr.
Definition at line 326 of file MinimalEventLoopMgr.cpp.
References IncidentType::AbortEvent, std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::end(), endreq(), std::list< _Tp, _Alloc >::erase(), MSG::ERROR, Service::finalize(), FINALIZED, IID_IAlgManager, StatusCode::isSuccess(), m_abortEventListener, m_appMgrUI, m_incidentSvc, m_outStreamList, m_state, m_topAlgList, Service::msgSvc(), Service::name(), releaseInterface(), IIncidentSvc::removeListener(), Service::serviceLocator(), StatusCode::SUCCESS, and MSG::WARNING.
Referenced by EventLoopMgr::finalize().
00326 { 00327 MsgStream log( msgSvc(), name() ); 00328 StatusCode sc = StatusCode::SUCCESS; 00329 // Call the finalize() method of all top algorithms 00330 ListAlg::iterator ita; 00331 for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00332 sc = (*ita)->sysFinalize(); 00333 if( !sc.isSuccess() ) { 00334 log << MSG::WARNING << "Finalization of algorithm " << (*ita)->name() << " failed" << endreq; 00335 } 00336 } 00337 // Call the finalize() method of all Output streams 00338 for ( ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) { 00339 sc = (*ita)->sysFinalize(); 00340 if( !sc.isSuccess() ) { 00341 log << MSG::WARNING << "Finalization of algorithm " << (*ita)->name() << " failed" << endreq; 00342 } 00343 } 00344 // release all top algorithms 00345 SmartIF<IAlgManager> algMan(IID_IAlgManager, serviceLocator()); 00346 for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00347 if (algMan->removeAlgorithm(*ita).isFailure()) { 00348 log << MSG::ERROR << "Problems removing Algorithm " << (*ita)->name() 00349 << endreq; 00350 } 00351 (*ita)->release(); 00352 } 00353 m_topAlgList.erase(m_topAlgList.begin(), m_topAlgList.end() ); 00354 00355 // release all output streams 00356 for ( ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) { 00357 (*ita)->release(); 00358 } 00359 m_outStreamList.erase(m_outStreamList.begin(), m_outStreamList.end() ); 00360 if ( sc.isSuccess() ) m_state = FINALIZED; 00361 00362 m_incidentSvc->removeListener(m_abortEventListener,IncidentType::AbortEvent); 00363 m_abortEventListener = releaseInterface(m_abortEventListener); 00364 00365 m_incidentSvc = releaseInterface(m_incidentSvc); 00366 m_appMgrUI = releaseInterface(m_appMgrUI); 00367 00368 return Service::finalize(); 00369 }
| StatusCode MinimalEventLoopMgr::reinitialize | ( | ) | [virtual] |
implementation of IService::reinitialize
Reimplemented from Service.
Reimplemented in EventLoopMgr.
Definition at line 273 of file MinimalEventLoopMgr.cpp.
References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::end(), endreq(), MSG::ERROR, StatusCode::isSuccess(), m_outStreamList, m_topAlgList, Service::msgSvc(), Service::name(), and StatusCode::SUCCESS.
Referenced by EventLoopMgr::reinitialize().
00273 { 00274 MsgStream log( msgSvc(), name() ); 00275 StatusCode sc = StatusCode::SUCCESS; 00276 ListAlg::iterator ita; 00277 00278 // Renitialize all the TopAlgs. 00279 for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00280 sc = (*ita)->sysReinitialize(); 00281 if( !sc.isSuccess() ) { 00282 log << MSG::ERROR << "Unable to reinitialize Algorithm: " << (*ita)->name() << endreq; 00283 return sc; 00284 } 00285 } 00286 for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) { 00287 sc = (*ita)->sysReinitialize(); 00288 if( !sc.isSuccess() ) { 00289 log << MSG::ERROR << "Unable to reinitialize Output Stream: " << (*ita)->name() << endreq; 00290 return sc; 00291 } 00292 } 00293 00294 return sc; 00295 }
| StatusCode MinimalEventLoopMgr::restart | ( | ) | [virtual] |
implementation of IService::restart
Reimplemented from Service.
Definition at line 299 of file MinimalEventLoopMgr.cpp.
References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::end(), endreq(), MSG::ERROR, StatusCode::isSuccess(), m_outStreamList, m_topAlgList, Service::msgSvc(), Service::name(), and StatusCode::SUCCESS.
00299 { 00300 MsgStream log( msgSvc(), name() ); 00301 StatusCode sc = StatusCode::SUCCESS; 00302 ListAlg::iterator ita; 00303 00304 // Restart all the TopAlgs. 00305 for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00306 sc = (*ita)->sysRestart(); 00307 if( !sc.isSuccess() ) { 00308 log << MSG::ERROR << "Unable to restart Algorithm: " << (*ita)->name() << endreq; 00309 return sc; 00310 } 00311 } 00312 for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) { 00313 sc = (*ita)->sysRestart(); 00314 if( !sc.isSuccess() ) { 00315 log << MSG::ERROR << "Unable to restart Output Stream: " << (*ita)->name() << endreq; 00316 return sc; 00317 } 00318 } 00319 00320 return sc; 00321 }
| StatusCode MinimalEventLoopMgr::nextEvent | ( | int | maxevt | ) | [virtual] |
implementation of IEventProcessor::nextEvent
Implements IEventProcessor.
Reimplemented in EventLoopMgr.
Definition at line 374 of file MinimalEventLoopMgr.cpp.
References endreq(), MSG::ERROR, StatusCode::FAILURE, Service::msgSvc(), Service::name(), and System::typeinfoName().
Referenced by executeRun().
00374 { 00375 MsgStream log(msgSvc(), name()); 00376 log << MSG::ERROR << "This method cannot be called on an object of type " 00377 << System::typeinfoName(typeid(*this)) << endreq; 00378 return StatusCode::FAILURE; 00379 }
| StatusCode MinimalEventLoopMgr::executeEvent | ( | void * | par | ) | [virtual] |
implementation of IEventProcessor::executeEvent(void* par)
Implements IEventProcessor.
Reimplemented in EventLoopMgr.
Definition at line 425 of file MinimalEventLoopMgr.cpp.
References std::list< _Tp, _Alloc >::begin(), MSG::DEBUG, std::list< _Tp, _Alloc >::end(), endreq(), MSG::ERROR, StatusCode::FAILURE, MSG::FATAL, IID_IAlgManager, StatusCode::isSuccess(), SmartIFBase< TYPE >::isValid(), m_abortEvent, m_abortEventSource, m_outStreamList, m_topAlgList, Service::msgSvc(), Service::name(), Service::serviceLocator(), StatusCode::SUCCESS, GaudiException::tag(), MSG::WARNING, and std::exception::what().
Referenced by EventLoopMgr::executeEvent().
00425 { 00426 bool eventfailed = false; 00427 00428 // Call the resetExecuted() method of ALL "known" algorithms 00429 // (before we were reseting only the topalgs) 00430 SmartIF<IAlgManager> algMan(IID_IAlgManager, serviceLocator()); 00431 if ( algMan.isValid() ) { 00432 const ListAlg& allAlgs = algMan->getAlgorithms() ; 00433 for( ListAlg::const_iterator ialg = allAlgs.begin() ; allAlgs.end() != ialg ; ++ialg ) { 00434 if ( 0 != *ialg ) (*ialg)->resetExecuted(); 00435 } 00436 } 00437 00438 // Call the execute() method of all top algorithms 00439 for (ListAlg::const_iterator ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00440 StatusCode sc(StatusCode::FAILURE); 00441 try { 00442 if (m_abortEvent){ 00443 MsgStream log ( msgSvc() , name() ); 00444 log << MSG::DEBUG << "AbortEvent incident fired by " 00445 << m_abortEventSource << endreq; 00446 m_abortEvent = false; 00447 sc.ignore(); 00448 break; 00449 } 00450 sc = (*ita)->sysExecute(); 00451 } catch ( const GaudiException& Exception ) { 00452 MsgStream log ( msgSvc() , "MinimalEventLoopMgr.executeEvent()" ); 00453 log << MSG::FATAL << " Exception with tag=" << Exception.tag() 00454 << " thrown by " << (*ita)->name() << endreq; 00455 log << MSG::ERROR << Exception << endreq; 00456 } catch ( const std::exception& Exception ) { 00457 MsgStream log ( msgSvc() , "MinimalEventLoopMgr.executeEvent()" ); 00458 log << MSG::FATAL << " Standard std::exception thrown by " 00459 << (*ita)->name() << endreq; 00460 log << MSG::ERROR << Exception.what() << endreq; 00461 } catch(...) { 00462 MsgStream log ( msgSvc() , "MinimalEventLoopMgr.executeEvent()" ); 00463 log << MSG::FATAL << "UNKNOWN Exception thrown by " 00464 << (*ita)->name() << endreq; 00465 } 00466 00467 if( !sc.isSuccess() ) { 00468 MsgStream log( msgSvc(), name() ); 00469 log << MSG::WARNING << "Execution of algorithm " << (*ita)->name() << " failed" << endreq; 00470 eventfailed = true; 00471 } 00472 } 00473 00474 // Call the execute() method of all output streams 00475 for (ListAlg::const_iterator ito = m_outStreamList.begin(); ito != m_outStreamList.end(); ito++ ) { 00476 (*ito)->resetExecuted(); 00477 StatusCode sc; 00478 sc = (*ito)->sysExecute(); 00479 if( !sc.isSuccess() ) { 00480 MsgStream log( msgSvc(), name() ); 00481 log << MSG::WARNING << "Execution of output stream " << (*ito)->name() << " failed" << endreq; 00482 eventfailed = true; 00483 } 00484 } 00485 00486 // Check if there was an error processing current event 00487 if( eventfailed ){ 00488 MsgStream log( msgSvc(), name() ); 00489 log << MSG::ERROR << "Error processing event loop." << endreq; 00490 return StatusCode(StatusCode::FAILURE,true); 00491 } 00492 return StatusCode(StatusCode::SUCCESS,true); 00493 }
| StatusCode MinimalEventLoopMgr::executeRun | ( | int | maxevt | ) | [virtual] |
implementation of IEventProcessor::executeRun( )
Implements IEventProcessor.
Reimplemented in EventLoopMgr.
Definition at line 384 of file MinimalEventLoopMgr.cpp.
References std::list< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::end(), endreq(), StatusCode::FAILURE, StatusCode::isSuccess(), m_topAlgList, Service::msgSvc(), Service::name(), nextEvent(), StatusCode::SUCCESS, and MSG::WARNING.
Referenced by EventLoopMgr::executeRun().
00384 { 00385 StatusCode sc; 00386 MsgStream log( msgSvc(), name() ); 00387 ListAlg::iterator ita; 00388 bool eventfailed = false; 00389 00390 // Call the beginRun() method of all top algorithms 00391 for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00392 sc = (*ita)->sysBeginRun(); 00393 if( !sc.isSuccess() ) { 00394 log << MSG::WARNING << "beginRun() of algorithm " << (*ita)->name() << " failed" << endreq; 00395 eventfailed = true; 00396 } 00397 } 00398 00399 // Call now the nextEvent(...) 00400 sc = nextEvent(maxevt); 00401 if( !sc.isSuccess() ) { 00402 eventfailed = true; 00403 } 00404 00405 // Call the endRun() method of all top algorithms 00406 for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) { 00407 sc = (*ita)->sysEndRun(); 00408 if( !sc.isSuccess() ) { 00409 log << MSG::WARNING << "endRun() of algorithm " << (*ita)->name() << " failed" << endreq; 00410 eventfailed = true; 00411 } 00412 } 00413 00414 if( eventfailed ){ 00415 return StatusCode::FAILURE; 00416 } 00417 else { 00418 return StatusCode::SUCCESS; 00419 } 00420 }
| StatusCode MinimalEventLoopMgr::stopRun | ( | ) | [virtual] |
implementation of IEventProcessor::stopRun( )
Implements IEventProcessor.
Definition at line 497 of file MinimalEventLoopMgr.cpp.
References m_scheduledStop, and StatusCode::SUCCESS.
00497 { 00498 m_scheduledStop = true; 00499 return StatusCode::SUCCESS; 00500 }
| void MinimalEventLoopMgr::topAlgHandler | ( | Property & | p | ) |
Top algorithm List handler.
Definition at line 505 of file MinimalEventLoopMgr.cpp.
References decodeTopAlgs(), and StatusCode::FAILURE.
Referenced by MinimalEventLoopMgr().
00505 { 00506 if ( !(decodeTopAlgs( )).isSuccess() ) { 00507 throw GaudiException("Failed to initialize Top Algorithms streams.", 00508 "MinimalEventLoopMgr::topAlgHandler", 00509 StatusCode::FAILURE); 00510 } 00511 }
| StatusCode MinimalEventLoopMgr::decodeTopAlgs | ( | ) |
decodeTopAlgNameList & topAlgNameListHandler
Definition at line 516 of file MinimalEventLoopMgr.cpp.
References IInterface::addRef(), std::vector< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::clear(), CONFIGURED, MSG::DEBUG, std::vector< _Tp, _Alloc >::end(), endreq(), MSG::ERROR, StatusCode::FAILURE, getGaudiThreadIDfromName(), IID_IAlgManager, INITIALIZED, StatusCode::isSuccess(), SmartIFBase< TYPE >::isValid(), m_state, m_topAlgList, m_topAlgNames, Service::msgSvc(), Service::name(), std::list< _Tp, _Alloc >::push_back(), Service::serviceLocator(), StatusCode::SUCCESS, and PropertyWithValue< TYPE >::value().
Referenced by initialize(), and topAlgHandler().
00516 { 00517 StatusCode sc = StatusCode::SUCCESS; 00518 if ( CONFIGURED == m_state || INITIALIZED == m_state ) { 00519 SmartIF<IAlgManager> algMan(IID_IAlgManager, serviceLocator()); 00520 MsgStream log(msgSvc(), name()); 00521 if ( algMan.isValid() ) { 00522 // Reset the existing Top Algorithm List 00523 m_topAlgList.clear( ); 00524 const std::vector<std::string>& algNames = m_topAlgNames.value( ); 00525 for (VectorName::const_iterator it = algNames.begin(); it != algNames.end(); it++) { 00526 ListItem item(*it); 00527 // Got the type and name. Now creating the algorithm, avoiding duplicate creation. 00528 IAlgorithm* ialg; 00529 std::string item_name = item.name() + getGaudiThreadIDfromName(name()) ; 00530 sc = algMan->getAlgorithm( item_name, ialg ); 00531 if ( sc.isSuccess( ) ) { 00532 log << MSG::DEBUG << "Top Algorithm " << item_name << " already exists" << endreq; 00533 ialg->addRef(); // increment reference count 00534 } 00535 else { 00536 log << MSG::DEBUG << "Creating Top Algorithm " << item.type() << " with name " << item_name << endreq; 00537 sc = algMan->createAlgorithm( item.type(), item_name, ialg ); 00538 if( !sc.isSuccess() ) { 00539 log << MSG::ERROR << "Unable to create Top Algorithm " << item.type() << " with name " << item_name << endreq; 00540 return sc; 00541 } 00542 } 00543 m_topAlgList.push_back(ialg); 00544 } 00545 return sc; 00546 } 00547 sc = StatusCode::FAILURE; 00548 } 00549 return sc; 00550 }
| void MinimalEventLoopMgr::outStreamHandler | ( | Property & | p | ) |
Output stream List handler.
Definition at line 555 of file MinimalEventLoopMgr.cpp.
References decodeOutStreams(), and StatusCode::FAILURE.
Referenced by MinimalEventLoopMgr().
00555 { 00556 if ( !(decodeOutStreams( )).isSuccess() ) { 00557 throw GaudiException("Failed to initialize output streams.", 00558 "MinimalEventLoopMgr::outStreamHandler", 00559 StatusCode::FAILURE); 00560 } 00561 }
| StatusCode MinimalEventLoopMgr::decodeOutStreams | ( | ) |
decodeOutStreamNameList & outStreamNameListHandler
Definition at line 566 of file MinimalEventLoopMgr.cpp.
References std::vector< _Tp, _Alloc >::begin(), std::list< _Tp, _Alloc >::clear(), CONFIGURED, MSG::DEBUG, std::vector< _Tp, _Alloc >::end(), endreq(), MSG::ERROR, StatusCode::FAILURE, IID_IAlgManager, INITIALIZED, StatusCode::isSuccess(), SmartIFBase< TYPE >::isValid(), m_outStreamList, m_outStreamNames, m_outStreamType, m_state, Service::msgSvc(), Service::name(), std::list< _Tp, _Alloc >::push_back(), Service::serviceLocator(), StatusCode::SUCCESS, and PropertyWithValue< TYPE >::value().
Referenced by initialize(), and outStreamHandler().
00566 { 00567 StatusCode sc = StatusCode::SUCCESS; 00568 if ( CONFIGURED == m_state || INITIALIZED == m_state ) { 00569 MsgStream log(msgSvc(), name()); 00570 SmartIF<IAlgManager> algMan(IID_IAlgManager, serviceLocator()); 00571 if ( algMan.isValid() ) { 00572 // Reset the existing Top Algorithm List 00573 m_outStreamList.clear(); 00574 const std::vector<std::string>& algNames = m_outStreamNames.value( ); 00575 for (VectorName::const_iterator it = algNames.begin(); it != algNames.end(); it++) { 00576 ListItem item(*it, m_outStreamType); 00577 IAlgorithm* ios; 00578 log << MSG::DEBUG << "Creating " << m_outStreamType << (*it) << endreq; 00579 sc = algMan->getAlgorithm( item.name(), ios ); 00580 if ( sc.isSuccess( ) ) { 00581 log << MSG::DEBUG << "Output Stream " << item.name() << " already exists" << endreq; 00582 } 00583 else { 00584 log << MSG::DEBUG << "Creating Output Stream " << (*it) << endreq; 00585 sc = algMan->createAlgorithm( item.type(), item.name(), ios ); 00586 if( !sc.isSuccess() ) { 00587 log << MSG::ERROR << "Unable to create Output Stream " << (*it) << endreq; 00588 return sc; 00589 } 00590 } 00591 m_outStreamList.push_back( ios ); 00592 } 00593 return sc; 00594 } 00595 sc = StatusCode::FAILURE; 00596 } 00597 return sc; 00598 }
IAppMgrUI* MinimalEventLoopMgr::m_appMgrUI [protected] |
Reference to the IAppMgrUI interface of the application manager.
Definition at line 41 of file MinimalEventLoopMgr.h.
Referenced by finalize(), initialize(), MinimalEventLoopMgr(), and ~MinimalEventLoopMgr().
IIncidentSvc* MinimalEventLoopMgr::m_incidentSvc [protected] |
Reference to the indicent service.
Definition at line 43 of file MinimalEventLoopMgr.h.
Referenced by EventLoopMgr::executeEvent(), finalize(), initialize(), MinimalEventLoopMgr(), EventLoopMgr::nextEvent(), EventLoopMgr::stop(), and ~MinimalEventLoopMgr().
ListAlg MinimalEventLoopMgr::m_topAlgList [protected] |
List of top level algorithms.
Definition at line 45 of file MinimalEventLoopMgr.h.
Referenced by decodeTopAlgs(), executeEvent(), executeRun(), finalize(), initialize(), reinitialize(), restart(), start(), and stop().
ListAlg MinimalEventLoopMgr::m_outStreamList [protected] |
List of output streams.
Definition at line 47 of file MinimalEventLoopMgr.h.
Referenced by decodeOutStreams(), executeEvent(), finalize(), initialize(), reinitialize(), restart(), start(), and stop().
std::string MinimalEventLoopMgr::m_outStreamType [protected] |
Out Stream type.
Definition at line 49 of file MinimalEventLoopMgr.h.
Referenced by decodeOutStreams(), and MinimalEventLoopMgr().
List of top level algorithms names.
Definition at line 51 of file MinimalEventLoopMgr.h.
Referenced by decodeTopAlgs(), initialize(), and MinimalEventLoopMgr().
List of output stream names.
Definition at line 53 of file MinimalEventLoopMgr.h.
Referenced by decodeOutStreams(), initialize(), and MinimalEventLoopMgr().
State MinimalEventLoopMgr::m_state [protected] |
State of the object.
Reimplemented from Service.
Definition at line 55 of file MinimalEventLoopMgr.h.
Referenced by decodeOutStreams(), decodeTopAlgs(), finalize(), initialize(), MinimalEventLoopMgr(), and ~MinimalEventLoopMgr().
bool MinimalEventLoopMgr::m_scheduledStop [protected] |
Scheduled stop of event processing.
Definition at line 57 of file MinimalEventLoopMgr.h.
Referenced by EventLoopMgr::executeEvent(), MinimalEventLoopMgr(), EventLoopMgr::nextEvent(), and stopRun().
Instance of the incident listener waiting for AbortEvent.
Definition at line 59 of file MinimalEventLoopMgr.h.
Referenced by finalize(), initialize(), and MinimalEventLoopMgr().
bool MinimalEventLoopMgr::m_abortEvent [protected] |
Flag signalling that the event being processedhas to be aborted (skip all following top algs).
Definition at line 62 of file MinimalEventLoopMgr.h.
Referenced by executeEvent(), initialize(), and MinimalEventLoopMgr().
std::string MinimalEventLoopMgr::m_abortEventSource [protected] |
Source of the AbortEvent incident.
Definition at line 64 of file MinimalEventLoopMgr.h.
Referenced by executeEvent(), and initialize().