| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

# MinimalEventLoopMgr.cpp

Go to the documentation of this file.

    00001 #define  GAUDIKERNEL_MINIMALEVENTLOOPMGR_CPP
    00002
    00003 #include "GaudiKernel/SmartIF.h"
    00004 #include "GaudiKernel/MsgStream.h"
    00005 #include "GaudiKernel/IAlgorithm.h"
    00006 #include "GaudiKernel/IAlgManager.h"
    00007 #include "GaudiKernel/TypeNameString.h"
    00008 #include "GaudiKernel/GaudiException.h"
    00009 #include "GaudiKernel/ThreadGaudi.h"
    00010 #include "GaudiKernel/Incident.h"
    00011 #include "GaudiKernel/IIncidentListener.h"
    00012 #include "GaudiKernel/IIncidentSvc.h"
    00013 #include "GaudiKernel/AppReturnCode.h"
    00014
    00015 #include "GaudiKernel/MinimalEventLoopMgr.h"
    00016
    00017 namespace {
    00018   class AbortEventListener: public implements1<IIncidentListener> {
    00019   public:
    00020     AbortEventListener(bool &flag, std::string &source):m_flag(flag),
    00021                                                         m_source(source){
    00022       addRef(); // Initial count set to 1
    00023     }
    00024     virtual ~AbortEventListener() {}
    00026     virtual void handle(const Incident& i) {
    00027       if (i.type() == IncidentType::AbortEvent) {
    00028         m_flag = true;
    00029         m_source = i.source();
    00030       }
    00031     }
    00032
    00033   private:
    00035     bool &m_flag;
    00037     std::string &m_source;
    00038   };
    00039 }
    00040
    00041 #define ON_DEBUG if (UNLIKELY(outputLevel() <= MSG::DEBUG))
    00042 #define ON_VERBOSE if (UNLIKELY(outputLevel() <= MSG::VERBOSE))
    00043
    00044 #define DEBMSG ON_DEBUG debug()
    00045 #define VERMSG ON_VERBOSE verbose()
    00046
    00047 //--------------------------------------------------------------------------------------------
    00048 // Standard Constructor
    00049 //--------------------------------------------------------------------------------------------
    00050 MinimalEventLoopMgr::MinimalEventLoopMgr(const std::string& nam, ISvcLocator* svcLoc)
    00051   : base_class(nam, svcLoc), m_appMgrUI(svcLoc)
    00052 {
    00053   declareProperty("TopAlg",         m_topAlgNames );
    00054   declareProperty("OutStream",      m_outStreamNames );
    00055   declareProperty("OutStreamType",  m_outStreamType = "OutputStream");
    00056   m_topAlgNames.declareUpdateHandler   ( &MinimalEventLoopMgr::topAlgHandler, this );
    00057   m_outStreamNames.declareUpdateHandler( &MinimalEventLoopMgr::outStreamHandler, this );
    00058   m_state = OFFLINE;
    00059   m_scheduledStop = false;
    00060   m_abortEvent = false;
    00061 }
    00062
    00063 //--------------------------------------------------------------------------------------------
    00064 // Standard Destructor
    00065 //--------------------------------------------------------------------------------------------
    00066 MinimalEventLoopMgr::~MinimalEventLoopMgr()   {
    00067   m_state = OFFLINE;
    00068 }
    00069
    00070 //--------------------------------------------------------------------------------------------
    00071 // implementation of IAppMgrUI::initialize
    00072 //--------------------------------------------------------------------------------------------
    00073 StatusCode MinimalEventLoopMgr::initialize()    {
    00074
    00075   if ( !m_appMgrUI.isValid() ) {
    00076     return StatusCode::FAILURE;
    00077   }
    00078
    00079   StatusCode sc = Service::initialize();
    00080   if ( !sc.isSuccess() )   {
    00081     error() << "Failed to initialize Service Base class." << endmsg;
    00082     return StatusCode::FAILURE;
    00083   }
    00084
    00085   SmartIF<IProperty> prpMgr(serviceLocator());
    00086   if ( ! prpMgr.isValid() )   {
    00087     error() << "Error retrieving AppMgr interface IProperty." << endmsg;
    00088     return StatusCode::FAILURE;
    00089   }
    00090   else {
    00091     if ( m_topAlgNames.value().size() == 0 )    {
    00092       setProperty(prpMgr->getProperty("TopAlg")).ignore();
    00093     }
    00094     if ( m_outStreamNames.value().size() == 0 )   {
    00095       setProperty(prpMgr->getProperty("OutStream")).ignore();
    00096     }
    00097   }
    00098
    00099   // Get the references to the services that are needed by the ApplicationMgr itself
    00100   m_incidentSvc = serviceLocator()->service("IncidentSvc");
    00101   if( !m_incidentSvc.isValid() )  {
    00102     fatal() << "Error retrieving IncidentSvc." << endmsg;
    00103     return StatusCode::FAILURE;
    00104   }
    00105
    00106   m_abortEventListener = new AbortEventListener(m_abortEvent,m_abortEventSource);
    00107   m_incidentSvc->addListener(m_abortEventListener,IncidentType::AbortEvent);
    00108
    00109   // The state is changed at this moment to allow decodeXXXX() to do something
    00110   m_state = INITIALIZED;
    00111
    00112   //--------------------------------------------------------------------------------------------
    00113   // Create output streams. Do not initialize them yet.
    00114   // The state is updated temporarily in order to enable the handler, which
    00115   // is also triggered by a change to the "OutputStream" Property.
    00116   //--------------------------------------------------------------------------------------------
    00117   sc = decodeOutStreams();
    00118   if ( !sc.isSuccess() )    {
    00119     error() << "Failed to initialize Output streams." << endmsg;
    00120     m_state = CONFIGURED;
    00121     return sc;
    00122   }
    00123   //--------------------------------------------------------------------------------------------
    00124   // Create all needed Top Algorithms. Do not initialize them yet.
    00125   // The state is updated temporarily in order to enable the handler, which
    00126   // is also triggered by a change to the "TopAlg" Property.
    00127   //--------------------------------------------------------------------------------------------
    00128   sc = decodeTopAlgs();
    00129   if ( !sc.isSuccess() )    {
    00130     error() << "Failed to initialize Top Algorithms streams." << endmsg;
    00131     m_state = CONFIGURED;
    00132     return sc;
    00133   }
    00134
    00135   ListAlg::iterator ita;
    00136   // Initialize all the new TopAlgs. In fact Algorithms are protected against getting
    00137   // initialized twice.
    00138   for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00139     sc = (*ita)->sysInitialize();
    00140     if( !sc.isSuccess() ) {
    00141       error() << "Unable to initialize Algorithm: " << (*ita)->name() << endmsg;
    00142       return sc;
    00143     }
    00144   }
    00145   for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
    00146     sc = (*ita)->sysInitialize();
    00147     if( !sc.isSuccess() ) {
    00148       error() << "Unable to initialize Output Stream: " << (*ita)->name() << endmsg;
    00149       return sc;
    00150     }
    00151   }
    00152
    00153   return StatusCode::SUCCESS;
    00154 }
    00155 //--------------------------------------------------------------------------------------------
    00156 // implementation of IAppMgrUI::start
    00157 //--------------------------------------------------------------------------------------------
    00158 StatusCode MinimalEventLoopMgr::start()    {
    00159
    00160   StatusCode sc = Service::start();
    00161   if ( ! sc.isSuccess() ) return sc;
    00162
    00163   ListAlg::iterator ita;
    00164   // Start all the new TopAlgs. In fact Algorithms are protected against getting
    00165   // started twice.
    00166   for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00167     sc = (*ita)->sysStart();
    00168     if( !sc.isSuccess() ) {
    00169       error() << "Unable to start Algorithm: " << (*ita)->name() << endmsg;
    00170       return sc;
    00171     }
    00172   }
    00173   for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
    00174     sc = (*ita)->sysStart();
    00175     if( !sc.isSuccess() ) {
    00176       error() << "Unable to start Output Stream: " << (*ita)->name() << endmsg;
    00177       return sc;
    00178     }
    00179   }
    00180   return StatusCode::SUCCESS;
    00181 }
    00182 //--------------------------------------------------------------------------------------------
    00183 // implementation of IAppMgrUI::stop
    00184 //--------------------------------------------------------------------------------------------
    00185 StatusCode MinimalEventLoopMgr::stop()    {
    00186
    00187   StatusCode sc = StatusCode::SUCCESS;
    00188
    00189   ListAlg::iterator ita;
    00190   // Stop all the TopAlgs. In fact Algorithms are protected against getting
    00191   // stopped twice.
    00192   for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00193     sc = (*ita)->sysStop();
    00194     if( !sc.isSuccess() ) {
    00195       error() << "Unable to stop Algorithm: " << (*ita)->name() << endmsg;
    00196       return sc;
    00197     }
    00198   }
    00199   for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
    00200     sc = (*ita)->sysStop();
    00201     if( !sc.isSuccess() ) {
    00202       error() << "Unable to stop Output Stream: " << (*ita)->name() << endmsg;
    00203       return sc;
    00204     }
    00205   }
    00206
    00207   return Service::stop();
    00208 }
    00209
    00210 //--------------------------------------------------------------------------------------------
    00211 // implementation of IService::reinitialize
    00212 //--------------------------------------------------------------------------------------------
    00213 StatusCode MinimalEventLoopMgr::reinitialize() {
    00214   StatusCode sc = StatusCode::SUCCESS;
    00215   ListAlg::iterator ita;
    00216
    00217   // Reinitialize all the TopAlgs.
    00218   for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00219     sc = (*ita)->sysReinitialize();
    00220     if( !sc.isSuccess() ) {
    00221       error() << "Unable to reinitialize Algorithm: " << (*ita)->name() << endmsg;
    00222       return sc;
    00223     }
    00224   }
    00225   for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
    00226     sc = (*ita)->sysReinitialize();
    00227     if( !sc.isSuccess() ) {
    00228       error() << "Unable to reinitialize Output Stream: " << (*ita)->name() << endmsg;
    00229       return sc;
    00230     }
    00231   }
    00232
    00233   return sc;
    00234 }
    00235 //--------------------------------------------------------------------------------------------
    00236 // implementation of IService::restart
    00237 //--------------------------------------------------------------------------------------------
    00238 StatusCode MinimalEventLoopMgr::restart() {
    00239   StatusCode sc = StatusCode::SUCCESS;
    00240   ListAlg::iterator ita;
    00241
    00242   // Restart all the TopAlgs.
    00243   for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00244     sc = (*ita)->sysRestart();
    00245     if( !sc.isSuccess() ) {
    00246       error() << "Unable to restart Algorithm: " << (*ita)->name() << endmsg;
    00247       return sc;
    00248     }
    00249   }
    00250   for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
    00251     sc = (*ita)->sysRestart();
    00252     if( !sc.isSuccess() ) {
    00253       error() << "Unable to restart Output Stream: " << (*ita)->name() << endmsg;
    00254       return sc;
    00255     }
    00256   }
    00257
    00258   return sc;
    00259 }
    00260
    00261 //--------------------------------------------------------------------------------------------
    00262 // implementation of IService::finalize
    00263 //--------------------------------------------------------------------------------------------
    00264 StatusCode MinimalEventLoopMgr::finalize() {
    00265   StatusCode sc = StatusCode::SUCCESS;
    00266   StatusCode scRet = StatusCode::SUCCESS;
    00267   // Call the finalize() method of all top algorithms
    00268   ListAlg::iterator ita;
    00269   for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00270     sc = (*ita)->sysFinalize();
    00271     if( !sc.isSuccess() ) {
    00272       scRet = StatusCode::FAILURE;
    00273       warning() << "Finalization of algorithm " << (*ita)->name() << " failed" << endmsg;
    00274     }
    00275   }
    00276   // Call the finalize() method of all Output streams
    00277   for ( ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
    00278     sc = (*ita)->sysFinalize();
    00279     if( !sc.isSuccess() ) {
    00280       scRet = StatusCode::FAILURE;
    00281       warning() << "Finalization of algorithm " << (*ita)->name() << " failed" << endmsg;
    00282     }
    00283   }
    00284   // release all top algorithms
    00285   SmartIF<IAlgManager> algMan(serviceLocator());
    00286   for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00287     if (algMan->removeAlgorithm(*ita).isFailure()) {
    00288       scRet = StatusCode::FAILURE;
    00289       warning() << "Problems removing Algorithm " << (*ita)->name() << endmsg;
    00290     }
    00291   }
    00292   m_topAlgList.clear();
    00293
    00294   // release all output streams
    00295   for ( ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ita++ ) {
    00296     (*ita)->release();
    00297   }
    00298   m_outStreamList.clear();
    00299   if ( sc.isSuccess() ) m_state = FINALIZED;
    00300
    00301   m_incidentSvc->removeListener(m_abortEventListener, IncidentType::AbortEvent);
    00302   m_abortEventListener = 0; // release
    00303
    00304   m_incidentSvc = 0; // release
    00305   m_appMgrUI = 0; // release
    00306
    00307   sc = Service::finalize();
    00308
    00309   if (sc.isFailure()) {
    00310     scRet = StatusCode::FAILURE;
    00311     error() << "Problems finalizing Service base class" << endmsg;
    00312   }
    00313
    00314   return scRet;
    00315 }
    00316
    00317 //--------------------------------------------------------------------------------------------
    00318 // implementation of IAppMgrUI::nextEvent
    00319 //--------------------------------------------------------------------------------------------
    00320 StatusCode MinimalEventLoopMgr::nextEvent(int /* maxevt */)   {
    00321   error() << "This method cannot be called on an object of type "
    00322           << System::typeinfoName(typeid(*this)) << endmsg;
    00323   return StatusCode::FAILURE;
    00324 }
    00325
    00326 //--------------------------------------------------------------------------------------------
    00327 // IEventProcessing::executeRun
    00328 //--------------------------------------------------------------------------------------------
    00329 StatusCode MinimalEventLoopMgr::executeRun( int maxevt ) {
    00330   StatusCode  sc;
    00331   ListAlg::iterator ita;
    00332   bool eventfailed = false;
    00333
    00334   // Call the beginRun() method of all top algorithms
    00335   for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00336     sc = (*ita)->sysBeginRun();
    00337     if (!sc.isSuccess()) {
    00338       warning() << "beginRun() of algorithm " << (*ita)->name() << " failed" << endmsg;
    00339       eventfailed = true;
    00340     }
    00341   }
    00342
    00343   // Call now the nextEvent(...)
    00344   sc = nextEvent(maxevt);
    00345   if (!sc.isSuccess()) {
    00346     eventfailed = true;
    00347   }
    00348
    00349   // Call the endRun() method of all top algorithms
    00350   for (ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00351     sc = (*ita)->sysEndRun();
    00352     if (!sc.isSuccess()) {
    00353       warning() << "endRun() of algorithm " << (*ita)->name() << " failed" << endmsg;
    00354       eventfailed = true;
    00355     }
    00356   }
    00357
    00358   if (eventfailed) {
    00359     return StatusCode::FAILURE;
    00360   }
    00361   else {
    00362     return StatusCode::SUCCESS;
    00363   }
    00364 }
    00365
    00366 namespace {
    00369   class RetCodeGuard {
    00370   public:
    00371     inline RetCodeGuard(const SmartIF<IProperty> &appmgr, int retcode):
    00372       m_appmgr(appmgr), m_retcode(retcode) {}
    00373     inline void ignore() {
    00374       m_retcode = Gaudi::ReturnCode::Success;
    00375     }
    00376     inline ~RetCodeGuard() {
    00377       if (UNLIKELY(Gaudi::ReturnCode::Success != m_retcode)) {
    00378         Gaudi::setAppReturnCode(m_appmgr, m_retcode);
    00379       }
    00380     }
    00381   private:
    00382     SmartIF<IProperty> m_appmgr;
    00383     int m_retcode;
    00384   };
    00385 }
    00386 //--------------------------------------------------------------------------------------------
    00387 // Implementation of IEventProcessor::executeEvent(void* par)
    00388 //--------------------------------------------------------------------------------------------
    00389 StatusCode MinimalEventLoopMgr::executeEvent(void* /* par */)    {
    00390   bool eventfailed = false;
    00391
    00392   // Call the resetExecuted() method of ALL "known" algorithms
    00393   // (before we were reseting only the topalgs)
    00394   SmartIF<IAlgManager> algMan(serviceLocator());
    00395   if (LIKELY(algMan.isValid())) {
    00396     const ListAlgPtrs& allAlgs = algMan->getAlgorithms() ;
    00397     for( ListAlgPtrs::const_iterator ialg = allAlgs.begin() ; allAlgs.end() != ialg ; ++ialg ) {
    00398       if (LIKELY(0 != *ialg)) (*ialg)->resetExecuted();
    00399     }
    00400   }
    00401
    00402   // Get the IProperty interface of the ApplicationMgr to pass it to RetCodeGuard
    00403   const SmartIF<IProperty> appmgr(serviceLocator());
    00404   // Call the execute() method of all top algorithms
    00405   for (ListAlg::iterator ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ita++ ) {
    00406     StatusCode sc(StatusCode::FAILURE);
    00407     try {
    00408       if (UNLIKELY(m_abortEvent)) {
    00409         DEBMSG << "AbortEvent incident fired by "
    00410                << m_abortEventSource << endmsg;
    00411         m_abortEvent = false;
    00412         sc.ignore();
    00413         break;
    00414       }
    00415       RetCodeGuard rcg(appmgr, Gaudi::ReturnCode::UnhandledException);
    00416       sc = (*ita)->sysExecute();
    00417       rcg.ignore(); // disarm the guard
    00418     } catch ( const GaudiException& Exception ) {
    00419       fatal() << ".executeEvent(): Exception with tag=" << Exception.tag()
    00420               << " thrown by " << (*ita)->name() << endmsg;
    00421       error() << Exception << endmsg;
    00422     } catch ( const std::exception& Exception ) {
    00423       fatal() << ".executeEvent(): Standard std::exception thrown by "
    00424               << (*ita)->name() << endmsg;
    00425       error() << Exception.what()  << endmsg;
    00426     } catch(...) {
    00427       fatal() << ".executeEvent(): UNKNOWN Exception thrown by "
    00428               << (*ita)->name() << endmsg;
    00429     }
    00430
    00431     if (UNLIKELY(!sc.isSuccess()))  {
    00432       warning() << "Execution of algorithm " << (*ita)->name() << " failed" << endmsg;
    00433       eventfailed = true;
    00434     }
    00435   }
    00436
    00437   // ensure that the abortEvent flag is cleared before the next event
    00438   if (UNLIKELY(m_abortEvent)) {
    00439     DEBMSG << "AbortEvent incident fired by " << m_abortEventSource << endmsg;
    00440     m_abortEvent = false;
    00441   }
    00442
    00443   // Call the execute() method of all output streams
    00444   for (ListAlg::iterator ito = m_outStreamList.begin(); ito != m_outStreamList.end(); ito++ ) {
    00445     (*ito)->resetExecuted();
    00446       StatusCode sc;
    00447       sc = (*ito)->sysExecute();
    00448     if (UNLIKELY(!sc.isSuccess()))  {
    00449       warning() << "Execution of output stream " << (*ito)->name() << " failed" << endmsg;
    00450       eventfailed = true;
    00451     }
    00452   }
    00453
    00454   // Check if there was an error processing current event
    00455   if (UNLIKELY(eventfailed)){
    00456     error() << "Error processing event loop." << endmsg;
    00457     return StatusCode(StatusCode::FAILURE,true);
    00458   }
    00459   return StatusCode(StatusCode::SUCCESS,true);
    00460 }
    00461 //--------------------------------------------------------------------------------------------
    00462 // Implementation of IEventProcessor::stopRun()
    00463 //--------------------------------------------------------------------------------------------
    00464 StatusCode MinimalEventLoopMgr::stopRun() {
    00465   // Set the application return code
    00466   SmartIF<IProperty> appmgr(serviceLocator());
    00467   if(Gaudi::setAppReturnCode(appmgr, Gaudi::ReturnCode::ScheduledStop).isFailure()) {
    00468     error() << "Could not set return code of the application ("
    00469             << Gaudi::ReturnCode::ScheduledStop << ")" << endmsg;
    00470   }
    00471   m_scheduledStop = true;
    00472   return StatusCode::SUCCESS;
    00473 }
    00474
    00475 //--------------------------------------------------------------------------------------------
    00476 // Top algorithm List handler
    00477 //--------------------------------------------------------------------------------------------
    00478 void MinimalEventLoopMgr::topAlgHandler( Property& /* theProp */ )  {
    00479   if ( !(decodeTopAlgs( )).isSuccess() ) {
    00480     throw GaudiException("Failed to initialize Top Algorithms streams.",
    00481                          "MinimalEventLoopMgr::topAlgHandler",
    00482                          StatusCode::FAILURE);
    00483   }
    00484 }
    00485
    00486 //--------------------------------------------------------------------------------------------
    00487 // decodeTopAlgNameList & topAlgNameListHandler
    00488 //--------------------------------------------------------------------------------------------
    00489 StatusCode MinimalEventLoopMgr::decodeTopAlgs()    {
    00490   StatusCode sc = StatusCode::SUCCESS;
    00491   if ( CONFIGURED == m_state || INITIALIZED == m_state ) {
    00492     SmartIF<IAlgManager> algMan(serviceLocator());
    00493     if ( algMan.isValid())   {
    00494       // Reset the existing Top Algorithm List
    00495       m_topAlgList.clear( );
    00496       const std::vector<std::string>& algNames = m_topAlgNames.value( );
    00497       for (VectorName::const_iterator it = algNames.begin(); it != algNames.end(); it++) {
    00498         Gaudi::Utils::TypeNameString item(*it);
    00499         // Got the type and name. Now creating the algorithm, avoiding duplicate creation.
    00500         std::string item_name = item.name() + getGaudiThreadIDfromName(name());
    00501         const bool CREATE = false;
    00502         SmartIF<IAlgorithm> alg = algMan->algorithm(item_name, CREATE);
    00503         if (alg.isValid()) {
    00504           DEBMSG << "Top Algorithm " << item_name << " already exists" << endmsg;
    00505         }
    00506         else {
    00507           DEBMSG << "Creating Top Algorithm " << item.type() << " with name " << item_name << endmsg;
    00508           IAlgorithm *ialg = 0;
    00509           StatusCode sc1 = algMan->createAlgorithm(item.type(), item_name, ialg);
    00510           if( !sc1.isSuccess() ) {
    00511             error() << "Unable to create Top Algorithm " << item.type() << " with name " << item_name << endmsg;
    00512             return sc1;
    00513           }
    00514           alg = ialg; // manage reference counting
    00515         }
    00516         m_topAlgList.push_back(alg);
    00517       }
    00518       return sc;
    00519     }
    00520     sc = StatusCode::FAILURE;
    00521   }
    00522   return sc;
    00523 }
    00524
    00525 //--------------------------------------------------------------------------------------------
    00526 // Output stream List handler
    00527 //--------------------------------------------------------------------------------------------
    00528 void MinimalEventLoopMgr::outStreamHandler( Property& /* theProp */ )         {
    00529   if ( !(decodeOutStreams( )).isSuccess() ) {
    00530     throw GaudiException("Failed to initialize output streams.",
    00531                          "MinimalEventLoopMgr::outStreamHandler",
    00532                          StatusCode::FAILURE);
    00533   }
    00534 }
    00535
    00536 //--------------------------------------------------------------------------------------------
    00537 // decodeOutStreamNameList & outStreamNameListHandler
    00538 //--------------------------------------------------------------------------------------------
    00539 StatusCode MinimalEventLoopMgr::decodeOutStreams( )    {
    00540   StatusCode sc = StatusCode::SUCCESS;
    00541   if ( CONFIGURED == m_state || INITIALIZED == m_state ) {
    00542     SmartIF<IAlgManager> algMan(serviceLocator());
    00543     if ( algMan.isValid() )   {
    00544       // Reset the existing Top Algorithm List
    00545       m_outStreamList.clear();
    00546       const std::vector<std::string>& algNames = m_outStreamNames.value( );
    00547       for (VectorName::const_iterator it = algNames.begin(); it != algNames.end(); it++) {
    00548         Gaudi::Utils::TypeNameString item(*it, m_outStreamType);
    00549         DEBMSG << "Creating " << m_outStreamType <<  (*it) << endmsg;
    00550         const bool CREATE = false;
    00551         SmartIF<IAlgorithm> os = algMan->algorithm( item, CREATE );
    00552         if (os.isValid()) {
    00553           DEBMSG << "Output Stream " << item.name() << " already exists" << endmsg;
    00554         }
    00555         else {
    00556           DEBMSG << "Creating Output Stream " << (*it) << endmsg;
    00557           IAlgorithm* ios = 0;
    00558           StatusCode sc1 = algMan->createAlgorithm( item.type(), item.name(), ios );
    00559           if( !sc1.isSuccess() ) {
    00560             error() << "Unable to create Output Stream " << (*it) << endmsg;
    00561             return sc1;
    00562           }
    00563           os = ios; // manage reference counting
    00564         }
    00565         m_outStreamList.push_back( os );
    00566       }
    00567      return sc;
    00568     }
    00569     sc = StatusCode::FAILURE;
    00570   }
    00571   return sc;
    00572 }
    00573
    00574

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines