| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# AppMgrRunable.cpp

Go to the documentation of this file.

    00001 // $Id: AppMgrRunable.cpp,v 1.8 2008/06/02 14:21:35 marcocle Exp $
    00002 #define  GAUDISVC_APPMGRRUNABLE_CPP
    00003
    00004 #include "GaudiKernel/SmartIF.h"
    00005 #include "GaudiKernel/SvcFactory.h"
    00006 #include "GaudiKernel/IAppMgrUI.h"
    00007 #include "GaudiKernel/ISvcLocator.h"
    00008
    00009 #include "AppMgrRunable.h"
    00010
    00011 // Instantiation of a static factory class used by clients to create instances of this service
    00012
    00013 DECLARE_SERVICE_FACTORY(AppMgrRunable)
    00014
    00015 // Standard Constructor
    00016 AppMgrRunable::AppMgrRunable(const std::string& nam, ISvcLocator* svcLoc)
    00017 : base_class(nam, svcLoc), m_appMgrUI(0)
    00018 {
    00019   declareProperty("EvtMax", m_evtMax=0xFEEDBABE);
    00020 }
    00021
    00022 // Standard Destructor
    00023 AppMgrRunable::~AppMgrRunable()
    00024 {
    00025 }
    00026
    00027 // IService implementation: initialize the service
    00028 StatusCode AppMgrRunable::initialize()   {
    00029   StatusCode sc = Service::initialize();
    00030   if ( sc.isSuccess() )     {
    00031     sc = serviceLocator()->queryInterface(IAppMgrUI::interfaceID(), pp_cast<void>(&m_appMgrUI));
    00032     // get property from application manager
    00033     if ( m_evtMax == (int)0xFEEDBABE )   {
    00034       SmartIF<IProperty> props(serviceLocator());
    00035       setProperty(props->getProperty("EvtMax")).ignore();
    00036     }
    00037   }
    00038   return sc;
    00039 }
    00040
    00041 // IService implementation: initialize the service
    00042 StatusCode AppMgrRunable::start()   {
    00043   StatusCode sc = Service::start();
    00044   return sc;
    00045 }
    00046
    00047 // IService implementation: initialize the service
    00048 StatusCode AppMgrRunable::stop()   {
    00049   StatusCode sc = Service::stop();
    00050   return sc;
    00051 }
    00052
    00053 // IService implementation: finalize the service
    00054 StatusCode AppMgrRunable::finalize()     {
    00055   StatusCode sc = Service::finalize();
    00056   if ( 0 != m_appMgrUI ) m_appMgrUI->release();
    00057   m_appMgrUI = 0;
    00058   return sc;
    00059 }
    00060
    00061 // IRunable implementation : Run the class implementation
    00062 StatusCode AppMgrRunable::run()   {
    00063   if ( 0 != m_appMgrUI )    {
    00064     // loop over the events
    00065     return m_appMgrUI->nextEvent(m_evtMax);
    00066   }
    00067   return StatusCode::FAILURE;
    00068 }