AppMgrRunable.cpp
Go to the documentation of this file.
1 #define GAUDISVC_APPMGRRUNABLE_CPP
2 
3 #include "GaudiKernel/SmartIF.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() ) {
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:68
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
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:193
Class definition of AppMgrRunable.
Definition: AppMgrRunable.h:28
StatusCode start() override
Definition: Service.cpp:152
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
StatusCode setProperty(const Property &p) override
Definition: Service.cpp:330
STL namespace.
virtual StatusCode nextEvent(int maxevt)=0
Process the next maxevt events.
SmartIF< IFace > as()
Definition: ISvcLocator.h:106
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
StatusCode finalize() override
IService implementation: finalize the service.
int m_evtMax
Number of events to be processed.
Definition: AppMgrRunable.h:34
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
StatusCode run() override
IRunable implementation : Run the class implementation.
StatusCode stop() override
IService implementation: stop the service.
StatusCode stop() override
Definition: Service.cpp:146
StatusCode initialize() override
IService implementation: initialize the service.
virtual unsigned long release()=0
Release Interface instance.
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:32
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.