00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00028 static SvcFactory<AppMgrRunable> s_AppMgrRunableFactory;
00029 const ISvcFactory& AppMgrRunableSvcFactory = s_AppMgrRunableFactory;
00030
00031
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
00039 AppMgrRunable::~AppMgrRunable()
00040 {
00041 }
00042
00043
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
00056 StatusCode AppMgrRunable::initialize() {
00057 StatusCode sc = Service::initialize();
00058 if ( sc.isSuccess() ) {
00059 sc = serviceLocator()->queryInterface(IID_IAppMgrUI, (void**)&m_appMgrUI);
00060
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
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
00078 StatusCode AppMgrRunable::run() {
00079 if ( 0 != m_appMgrUI ) {
00080
00081 return m_appMgrUI->nextEvent(m_evtMax);
00082 }
00083 return StatusCode::FAILURE;
00084 }