| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
11 DECLARE_COMPONENT(AppMgrRunable)
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
21 StatusCode AppMgrRunable::initialize() {
22 StatusCode sc = Service::initialize();
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
35 StatusCode AppMgrRunable::start() {
36 StatusCode sc = Service::start();
37 return sc;
38 }
39
40 // IService implementation: initialize the service
41 StatusCode AppMgrRunable::stop() {
42 StatusCode sc = Service::stop();
43 return sc;
44 }
45
46 // IService implementation: finalize the service
47 StatusCode AppMgrRunable::finalize() {
48 StatusCode sc = Service::finalize();
49 if ( m_appMgrUI ) m_appMgrUI->release();
50 m_appMgrUI = nullptr;
51 return sc;
52 }
53
54 // IRunable implementation : Run the class implementation
55 StatusCode AppMgrRunable::run() {
56 if ( m_appMgrUI ) {
57 // loop over the events
58 return m_appMgrUI->nextEvent(m_evtMax);
59 }
60 return StatusCode::FAILURE;
61 }
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:68
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:324
AppMgrRunable::start
StatusCode start() override
IService implementation: start the service.
Definition: AppMgrRunable.cpp:35
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:193
IAppMgrUI.h
AppMgrRunable
Class definition of AppMgrRunable.
Definition: AppMgrRunable.h:28
Service::start
StatusCode start() override
Definition: Service.cpp:152
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:76
Service::setProperty
StatusCode setProperty(const Property &p) override
Definition: Service.cpp:330
std
STL namespace.
IAppMgrUI::nextEvent
virtual StatusCode nextEvent(int maxevt)=0
Process the next maxevt events.
ISvcLocator::as
SmartIF< IFace > as()
Definition: ISvcLocator.h:106
merge_files.sc
int sc
Definition: merge_files.py:167
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:36
AppMgrRunable::finalize
StatusCode finalize() override
IService implementation: finalize the service.
Definition: AppMgrRunable.cpp:47
AppMgrRunable::m_evtMax
int m_evtMax
Number of events to be processed.
Definition: AppMgrRunable.h:34
StatusCode::FAILURE
Definition: StatusCode.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
SmartIF.h
AppMgrRunable.h
AppMgrRunable::run
StatusCode run() override
IRunable implementation : Run the class implementation.
Definition: AppMgrRunable.cpp:55
AppMgrRunable::stop
StatusCode stop() override
IService implementation: stop the service.
Definition: AppMgrRunable.cpp:41
Service::stop
StatusCode stop() override
Definition: Service.cpp:146
AppMgrRunable::initialize
StatusCode initialize() override
IService implementation: initialize the service.
Definition: AppMgrRunable.cpp:21
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
CommonMessaging
Definition: CommonMessaging.h:58
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
IInterface::interfaceID
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:243
ISvcLocator.h
AppMgrRunable::m_appMgrUI
IAppMgrUI * m_appMgrUI
Reference to application manager UI.
Definition: AppMgrRunable.h:32
IInterface::queryInterface
virtual StatusCode queryInterface(const InterfaceID &ti, void **pp)=0
Set the void** to the pointer to the requested interface of the instance.