The Gaudi Framework  v33r1 (b1225454)
AppMgrRunable.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 }
StatusCode initialize() override
Definition: Service.cpp:70
StatusCode start() override
IService implementation: start the service.
StatusCode finalize() override
Definition: Service.cpp:174
Class definition of AppMgrRunable.
Definition: AppMgrRunable.h:38
StatusCode start() override
Definition: Service.cpp:139
virtual StatusCode nextEvent(int maxevt)=0
Process the next maxevt events.
StatusCode finalize() override
IService implementation: finalize the service.
#define DECLARE_COMPONENT(type)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
bool PyHelper() setProperty(IInterface *p, char *name, char *value)
Definition: Bootstrap.cpp:243
StatusCode run() override
IRunable implementation : Run the class implementation.
StatusCode stop() override
IService implementation: stop the service.
StatusCode stop() override
Definition: Service.cpp:133
bool isSuccess() const
Definition: StatusCode.h:365
virtual unsigned long release()=0
Release Interface instance.
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Gaudi::Property< int > m_evtMax
Definition: AppMgrRunable.h:42
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition: IProperty.h:30
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:263
IAppMgrUI * m_appMgrUI
Reference to application manager UI.
Definition: AppMgrRunable.h:41