| The Gaudi Framework v32r1 (f65d50dc)

AppMgrRunable.cpp
Go to the documentation of this file.
1 #define GAUDISVC_APPMGRRUNABLE_CPP
2
3 #include "GaudiKernel/IAppMgrUI.h"
4 #include "GaudiKernel/ISvcLocator.h"
5 #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
11 DECLARE_COMPONENT( AppMgrRunable )
12
13 // IService implementation: initialize the service
14 StatusCode AppMgrRunable::initialize() {
15 StatusCode sc = Service::initialize();
16 if ( sc.isSuccess() ) {
17 sc = serviceLocator()->queryInterface( IAppMgrUI::interfaceID(), pp_cast<void>( &m_appMgrUI ) );
18 // get property from application manager
19 if ( m_evtMax == (int)0xFEEDBABE ) {
20 auto props = serviceLocator()->as<IProperty>();
21 setProperty( props->getProperty( "EvtMax" ) ).ignore();
22 }
23 }
24 return sc;
25 }
26
27 // IService implementation: initialize the service
28 StatusCode AppMgrRunable::start() {
29 StatusCode sc = Service::start();
30 return sc;
31 }
32
33 // IService implementation: initialize the service
34 StatusCode AppMgrRunable::stop() {
35 StatusCode sc = Service::stop();
36 return sc;
37 }
38
39 // IService implementation: finalize the service
40 StatusCode AppMgrRunable::finalize() {
41 StatusCode sc = Service::finalize();
42 if ( m_appMgrUI ) m_appMgrUI->release();
43 m_appMgrUI = nullptr;
44 return sc;
45 }
46
47 // IRunable implementation : Run the class implementation
48 StatusCode AppMgrRunable::run() {
49 if ( m_appMgrUI ) {
50 // loop over the events
51 return m_appMgrUI->nextEvent( m_evtMax );
52 }
53 return StatusCode::FAILURE;
54 }
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:60
AppMgrRunable::start
StatusCode start() override
IService implementation: start the service.
Definition: AppMgrRunable.cpp:28
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:164
IAppMgrUI.h
AppMgrRunable
Class definition of AppMgrRunable.
Definition: AppMgrRunable.h:28
Service::start
StatusCode start() override
Definition: Service.cpp:129
IAppMgrUI::nextEvent
virtual StatusCode nextEvent(int maxevt)=0
Process the next maxevt events.
AppMgrRunable::finalize
StatusCode finalize() override
IService implementation: finalize the service.
Definition: AppMgrRunable.cpp:40
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
SmartIF.h
setProperty
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
Definition: Bootstrap.cpp:233
AppMgrRunable.h
AppMgrRunable::run
StatusCode run() override
IRunable implementation : Run the class implementation.
Definition: AppMgrRunable.cpp:48
AppMgrRunable::stop
StatusCode stop() override
IService implementation: stop the service.
Definition: AppMgrRunable.cpp:34
Service::stop
StatusCode stop() override
Definition: Service.cpp:123
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
AppMgrRunable::m_evtMax
Gaudi::Property< int > m_evtMax
Definition: AppMgrRunable.h:32
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition: IProperty.h:20
IInterface::interfaceID
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:253
ISvcLocator.h
AppMgrRunable::m_appMgrUI
IAppMgrUI * m_appMgrUI
Reference to application manager UI.
Definition: AppMgrRunable.h:31