The Gaudi Framework  master (37c0b60a)
MinimalEventLoopMgr.h
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 #ifndef GAUDIKERNEL_MINIMALEVENTLOOPMGR_H
12 #define GAUDIKERNEL_MINIMALEVENTLOOPMGR_H 1
13 
16 #include <GaudiKernel/IAlgorithm.h>
17 #include <GaudiKernel/IAppMgrUI.h>
22 #include <GaudiKernel/Service.h>
23 #include <vector>
24 
34 class GAUDI_API MinimalEventLoopMgr : public extends<Service, IEventProcessor> {
35 private:
36  class AbortEventListener : public implements<IIncidentListener> {
37  public:
39  void handle( const Incident& i ) override {
40  if ( i.type() == IncidentType::AbortEvent ) {
41  abortEvent = true;
42  abortEventSource = i.source();
43  }
44  }
45 
46  public:
49  bool abortEvent = false;
52  };
53 
54 public:
56 
57 protected:
58  // Properties
60  this, "TopAlg", {}, &MinimalEventLoopMgr::topAlgHandler, "list of top level algorithms names" };
62  this, "OutStream", {}, &MinimalEventLoopMgr::outStreamHandler, "list of output stream names" };
63  Gaudi::Property<bool> m_printCFExp{ this, "PrintControlFlowExpression", false,
64  "Print the control flow expression representing the content of TopAlg" };
65 
66  // enums
67  enum State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED };
78  State m_state = OFFLINE;
80  bool m_scheduledStop = false;
83 
84 public:
86  MinimalEventLoopMgr( const std::string& nam, ISvcLocator* svcLoc );
91 
92 #if defined( GAUDI_V20_COMPAT ) && !defined( G21_NO_DEPRECATED )
93 protected:
95  template <class T>
96  [[deprecated]] T* releaseInterface( T* iface ) {
97  if ( 0 != iface ) iface->release();
98  return 0;
99  }
100 
101 public:
102 #endif
103 
105  StatusCode initialize() override;
107  StatusCode start() override;
109  StatusCode stop() override;
111  StatusCode finalize() override;
113  StatusCode reinitialize() override;
115  StatusCode restart() override;
117  EventContext createEventContext() override;
119  StatusCode nextEvent( int maxevt ) override;
121  StatusCode executeEvent( EventContext&& ctx ) override;
123  StatusCode executeRun( int maxevt ) override;
125  StatusCode stopRun() override;
126 
128  void topAlgHandler( Gaudi::Details::PropertyBase& p );
130  StatusCode decodeTopAlgs();
132  void outStreamHandler( Gaudi::Details::PropertyBase& p );
134  StatusCode decodeOutStreams();
135 
136 protected:
139 
140  // number of events processed
141  size_t m_nevt{ 0 };
142 };
143 #endif // GAUDIKERNEL_MINIMALEVENTLOOPMGR_H
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:35
Incident::source
const std::string & source() const
Access to the source of the incident.
Definition: Incident.h:54
std::string
STL class.
MinimalEventLoopMgr::AbortEventListener::abortEventSource
std::string abortEventSource
Source of the AbortEvent incident.
Definition: MinimalEventLoopMgr.h:51
MinimalEventLoopMgr::outStreamHandler
void outStreamHandler(Gaudi::Details::PropertyBase &p)
Output stream List handler.
Definition: MinimalEventLoopMgr.cpp:460
std::vector
STL class.
ISvcLocator
Definition: ISvcLocator.h:46
MinimalEventLoopMgr::ListAlg
std::vector< SmartIF< IAlgorithm > > ListAlg
Definition: MinimalEventLoopMgr.h:55
MinimalEventLoopMgr::topAlgHandler
void topAlgHandler(Gaudi::Details::PropertyBase &p)
Top algorithm List handler.
Definition: MinimalEventLoopMgr.cpp:412
IOTest.start
start
Definition: IOTest.py:110
IAppMgrUI.h
MinimalEventLoopMgr::AbortEventListener
Definition: MinimalEventLoopMgr.h:36
IIncidentSvc.h
MinimalEventLoopMgr::m_aess
SmartIF< IAlgExecStateSvc > m_aess
List of top level algorithms.
Definition: MinimalEventLoopMgr.h:73
MinimalEventLoopMgr::operator=
MinimalEventLoopMgr & operator=(const MinimalEventLoopMgr &)=delete
No copy allowed.
MinimalEventLoopMgr::State
State
Definition: MinimalEventLoopMgr.h:67
Gaudi::StateMachine::CONFIGURED
@ CONFIGURED
Definition: StateMachine.h:24
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
StatusCode
Definition: StatusCode.h:65
MinimalEventLoopMgr::m_outStreamList
ListAlg m_outStreamList
List of output streams.
Definition: MinimalEventLoopMgr.h:76
Gaudi::StateMachine::OFFLINE
@ OFFLINE
Definition: StateMachine.h:23
GaudiPython.Pythonizations.executeEvent
executeEvent
Helpers for re-entrant interfaces.
Definition: Pythonizations.py:574
SmartIF< IAppMgrUI >
IHiveWhiteBoard.h
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
MinimalEventLoopMgr::m_WB
SmartIF< IHiveWhiteBoard > m_WB
< Event data service (whiteboard)
Definition: MinimalEventLoopMgr.h:138
Service.h
MinimalEventLoopMgr::AbortEventListener::handle
void handle(const Incident &i) override
Inform that a new incident has occurred.
Definition: MinimalEventLoopMgr.h:39
implements
Base class used to implement the interfaces.
Definition: implements.h:19
MinimalEventLoopMgr::m_appMgrUI
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
Definition: MinimalEventLoopMgr.h:69
MinimalEventLoopMgr::m_topAlgList
ListAlg m_topAlgList
Definition: MinimalEventLoopMgr.h:74
EventContext.h
IIncidentListener.h
MinimalEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: MinimalEventLoopMgr.h:71
Gaudi::StateMachine::INITIALIZED
@ INITIALIZED
Definition: StateMachine.h:25
EventContext
Definition: EventContext.h:34
Incident::type
const std::string & type() const
Access to the incident type.
Definition: Incident.h:48
MinimalEventLoopMgr::m_abortEventListener
AbortEventListener m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
Definition: MinimalEventLoopMgr.h:82
IAlgorithm.h
IAlgExecStateSvc.h
Incident
Definition: Incident.h:27
MinimalEventLoopMgr
Definition: MinimalEventLoopMgr.h:34
IEventProcessor.h
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:37
MinimalEventLoopMgr::MinimalEventLoopMgr
MinimalEventLoopMgr(const MinimalEventLoopMgr &)=delete
No copy allowed.