AppMgrRunable.cpp
Go to the documentation of this file.
1 #define GAUDISVC_APPMGRRUNABLE_CPP
2 
3 #include "GaudiKernel/SmartIF.h"
4 #include "GaudiKernel/IAppMgrUI.h"
5 #include "GaudiKernel/ISvcLocator.h"
6 
7 #include "AppMgrRunable.h"
8 
9 // Instantiation of a static factory class used by clients to create instances of this service
10 
12 
13 // Standard Constructor
14 AppMgrRunable::AppMgrRunable(const std::string& nam, ISvcLocator* svcLoc)
15 : base_class(nam, svcLoc)
16 {
17  declareProperty("EvtMax", m_evtMax=0xFEEDBABE);
18 }
19 
20 // IService implementation: initialize the service
23  if ( sc.isSuccess() ) {
24  sc = serviceLocator()->queryInterface(IAppMgrUI::interfaceID(), pp_cast<void>(&m_appMgrUI));
25  // get property from application manager
26  if ( m_evtMax == (int)0xFEEDBABE ) {
27  auto props = serviceLocator()->as<IProperty>();
28  setProperty(props->getProperty("EvtMax")).ignore();
29  }
30  }
31  return sc;
32 }
33 
34 // IService implementation: initialize the service
37  return sc;
38 }
39 
40 // IService implementation: initialize the service
43  return sc;
44 }
45 
46 // IService implementation: finalize the service
49  if ( m_appMgrUI ) m_appMgrUI->release();
50  m_appMgrUI = nullptr;
51  return sc;
52 }
53 
54 // IRunable implementation : Run the class implementation
56  if ( m_appMgrUI ) {
57  // loop over the events
58  return m_appMgrUI->nextEvent(m_evtMax);
59  }
60  return StatusCode::FAILURE;
61 }
StatusCode initialize() override
Definition: Service.cpp:63
StatusCode start() override
IService implementation: start the service.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
StatusCode finalize() override
Definition: Service.cpp:188
Class definition of AppMgrRunable.
Definition: AppMgrRunable.h:28
StatusCode start() override
Definition: Service.cpp:147
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
STL namespace.
virtual StatusCode nextEvent(int maxevt)=0
Process the next maxevt events.
StatusCode finalize() override
IService implementation: finalize the service.
int m_evtMax
Number of events to be processed.
Definition: AppMgrRunable.h:33
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
Definition: Bootstrap.cpp:254
StatusCode run() override
IRunable implementation : Run the class implementation.
StatusCode stop() override
IService implementation: stop the service.
StatusCode stop() override
Definition: Service.cpp:141
StatusCode initialize() override
IService implementation: initialize the service.
virtual unsigned long release()=0
Release Interface instance.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:243
IAppMgrUI * m_appMgrUI
Reference to application manager UI.
Definition: AppMgrRunable.h:31