The Gaudi Framework  master (37c0b60a)
AppMgrRunable.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #define GAUDISVC_APPMGRRUNABLE_CPP
12 
13 #include <GaudiKernel/IAppMgrUI.h>
15 #include <GaudiKernel/SmartIF.h>
16 
17 #include "AppMgrRunable.h"
18 
19 // Instantiation of a static factory class used by clients to create instances of this service
20 
22 
23 // IService implementation: initialize the service
24 StatusCode AppMgrRunable::initialize() {
26  if ( sc.isSuccess() ) {
27  sc = serviceLocator()->queryInterface( IAppMgrUI::interfaceID(), pp_cast<void>( &m_appMgrUI ) );
28  // get property from application manager
29  if ( m_evtMax == (int)0xFEEDBABE ) {
30  auto props = serviceLocator()->as<IProperty>();
31  setProperty( props->getProperty( "EvtMax" ) ).ignore();
32  }
33  }
34  return sc;
35 }
36 
37 // IService implementation: initialize the service
40  return sc;
41 }
42 
43 // IService implementation: initialize the service
46  return sc;
47 }
48 
49 // IService implementation: finalize the service
52  if ( m_appMgrUI ) m_appMgrUI->release();
53  m_appMgrUI = nullptr;
54  return sc;
55 }
56 
57 // IRunable implementation : Run the class implementation
59  if ( m_appMgrUI ) {
60  // loop over the events
61  return m_appMgrUI->nextEvent( m_evtMax );
62  }
63  return StatusCode::FAILURE;
64 }
AppMgrRunable::run
StatusCode run() override
IRunable implementation : Run the class implementation.
Definition: AppMgrRunable.cpp:58
AppMgrRunable::finalize
StatusCode finalize() override
IService implementation: finalize the service.
Definition: AppMgrRunable.cpp:50
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:118
setProperty
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
Definition: Bootstrap.cpp:247
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:314
Service::start
StatusCode start() override
Definition: Service.cpp:187
AppMgrRunable::stop
StatusCode stop() override
IService implementation: stop the service.
Definition: AppMgrRunable.cpp:44
check_ParticleID.props
props
Definition: check_ParticleID.py:21
IAppMgrUI.h
Service::finalize
StatusCode finalize() override
Definition: Service.cpp:222
IProperty
Definition: IProperty.h:33
AppMgrRunable::m_evtMax
Gaudi::Property< int > m_evtMax
Definition: AppMgrRunable.h:42
SmartIF.h
AppMgrRunable::start
StatusCode start() override
IService implementation: start the service.
Definition: AppMgrRunable.cpp:38
StatusCode
Definition: StatusCode.h:65
IInterface::interfaceID
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:248
AppMgrRunable::m_appMgrUI
IAppMgrUI * m_appMgrUI
Reference to application manager UI.
Definition: AppMgrRunable.h:41
AppMgrRunable
Class definition of AppMgrRunable.
Definition: AppMgrRunable.h:38
Service::stop
StatusCode stop() override
Definition: Service.cpp:181
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginServiceV1.h:46
IAppMgrUI::nextEvent
virtual StatusCode nextEvent(int maxevt)=0
Process the next maxevt events.
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
ISvcLocator.h
AppMgrRunable.h