Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

AppMgrRunable.cpp

Go to the documentation of this file.
00001 //====================================================================
00002 //      AppMgrRunable.cpp
00003 //--------------------------------------------------------------------
00004 //
00005 //      Package    : AppMgrRunable ( The LHCb Offline System)
00006 //
00007 //  Description: implementation of the Application runable service.
00008 //
00009 //      Author     : M.Frank
00010 //  History    :
00011 // +---------+----------------------------------------------+---------
00012 // |    Date |                 Comment                      | Who     
00013 // +---------+----------------------------------------------+---------
00014 // | 29/10/98| Initial version                              | MF
00015 // +---------+----------------------------------------------+---------
00016 //
00017 //====================================================================
00018 #define  GAUDISVC_APPMGRRUNABLE_CPP
00019 
00020 #include "GaudiKernel/SmartIF.h"
00021 #include "GaudiKernel/SvcFactory.h"
00022 #include "GaudiKernel/IAppMgrUI.h"
00023 #include "GaudiKernel/ISvcLocator.h"
00024 
00025 #include "AppMgrRunable.h"
00026 
00027 // Instantiation of a static factory class used by clients to create instances of this service
00028 static SvcFactory<AppMgrRunable> s_AppMgrRunableFactory;
00029 const ISvcFactory& AppMgrRunableSvcFactory = s_AppMgrRunableFactory;
00030 
00031 // Standard Constructor
00032 AppMgrRunable::AppMgrRunable(const std::string& nam, ISvcLocator* svcLoc)   
00033 : Service(nam, svcLoc), m_appMgrUI(0)
00034 {
00035   declareProperty("EvtMax", m_evtMax=0xFEEDBABE);
00036 }
00037 
00038 // Standard Destructor
00039 AppMgrRunable::~AppMgrRunable()   
00040 {
00041 }
00042 
00043 // IInterface implementation : queryInterface
00044 StatusCode AppMgrRunable::queryInterface(const InterfaceID& riid, void** ppvInterface)   {
00045   if ( riid == IID_IRunable )   {
00046     *ppvInterface = (IRunable*)this;
00047   }
00048   else  {
00049     return Service::queryInterface(riid, ppvInterface);
00050   }
00051   addRef();
00052   return StatusCode::SUCCESS;
00053 }
00054 
00055 // IService implementation: initialize the service
00056 StatusCode AppMgrRunable::initialize()   {
00057   StatusCode sc = Service::initialize();
00058   if ( sc.isSuccess() )     {
00059     sc = serviceLocator()->queryInterface(IID_IAppMgrUI, (void**)&m_appMgrUI);
00060     // get property from application manager
00061     if ( m_evtMax == (int)0xFEEDBABE )   {
00062       SmartIF<IProperty> props(IID_IProperty, serviceLocator());
00063       setProperty(props->getProperty("EvtMax"));
00064     }
00065   }
00066   return sc;
00067 }
00068 
00069 // IService implementation: finalize the service
00070 StatusCode AppMgrRunable::finalize()     {
00071   StatusCode sc = Service::finalize();
00072   if ( 0 != m_appMgrUI ) m_appMgrUI->release();
00073   m_appMgrUI = 0;
00074   return sc;
00075 }
00076 
00077 // IRunable implementation : Run the class implementation
00078 StatusCode AppMgrRunable::run()   {
00079   if ( 0 != m_appMgrUI )    {
00080     // loop over the events
00081     return m_appMgrUI->nextEvent(m_evtMax);
00082   }
00083   return StatusCode::FAILURE;
00084 }

Generated at Wed Nov 21 12:22:29 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000