Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MinimalEventLoopMgr.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 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 #pragma once
12 
15 #include <GaudiKernel/IAlgorithm.h>
16 #include <GaudiKernel/IAppMgrUI.h>
21 #include <GaudiKernel/Service.h>
22 #include <vector>
23 
33 class GAUDI_API MinimalEventLoopMgr : public extends<Service, IEventProcessor> {
34 private:
35  class AbortEventListener : public implements<IIncidentListener> {
36  public:
38  void handle( const Incident& i ) override {
39  if ( i.type() == IncidentType::AbortEvent ) {
40  abortEvent = true;
41  abortEventSource = i.source();
42  }
43  }
44 
45  public:
48  bool abortEvent = false;
50  std::string abortEventSource;
51  };
52 
53 public:
54  typedef std::vector<SmartIF<IAlgorithm>> ListAlg;
55 
56 protected:
57  // Properties
59  this, "TopAlg", {}, &MinimalEventLoopMgr::topAlgHandler, "list of top level algorithms names" };
61  this, "OutStream", {}, &MinimalEventLoopMgr::outStreamHandler, "list of output stream names" };
62  Gaudi::Property<bool> m_printCFExp{ this, "PrintControlFlowExpression", false,
63  "Print the control flow expression representing the content of TopAlg" };
64 
65  // enums
66  enum State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED };
77  State m_state = OFFLINE;
79  bool m_scheduledStop = false;
82 
83 public:
85  MinimalEventLoopMgr( const std::string& nam, ISvcLocator* svcLoc );
90 
92  StatusCode initialize() override;
94  StatusCode start() override;
96  StatusCode stop() override;
98  StatusCode finalize() override;
100  StatusCode reinitialize() override;
102  StatusCode restart() override;
104  EventContext createEventContext() override;
106  StatusCode nextEvent( int maxevt ) override;
108  StatusCode executeEvent( EventContext&& ctx ) override;
110  StatusCode executeRun( int maxevt ) override;
112  StatusCode stopRun() override;
113 
115  void topAlgHandler( Gaudi::Details::PropertyBase& p );
117  StatusCode decodeTopAlgs();
119  void outStreamHandler( Gaudi::Details::PropertyBase& p );
121  StatusCode decodeOutStreams();
122 
123 protected:
126 
127  // number of events processed
128  size_t m_nevt{ 0 };
129 };
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:34
Incident::source
const std::string & source() const
Access to the source of the incident.
Definition: Incident.h:49
MinimalEventLoopMgr::AbortEventListener::abortEventSource
std::string abortEventSource
Source of the AbortEvent incident.
Definition: MinimalEventLoopMgr.h:50
MinimalEventLoopMgr::outStreamHandler
void outStreamHandler(Gaudi::Details::PropertyBase &p)
Output stream List handler.
Definition: MinimalEventLoopMgr.cpp:460
ISvcLocator
Definition: ISvcLocator.h:42
MinimalEventLoopMgr::ListAlg
std::vector< SmartIF< IAlgorithm > > ListAlg
Definition: MinimalEventLoopMgr.h:54
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:35
IIncidentSvc.h
MinimalEventLoopMgr::m_aess
SmartIF< IAlgExecStateSvc > m_aess
List of top level algorithms.
Definition: MinimalEventLoopMgr.h:72
MinimalEventLoopMgr::operator=
MinimalEventLoopMgr & operator=(const MinimalEventLoopMgr &)=delete
No copy allowed.
MinimalEventLoopMgr::State
State
Definition: MinimalEventLoopMgr.h:66
Gaudi::StateMachine::CONFIGURED
@ CONFIGURED
Definition: StateMachine.h:23
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
StatusCode
Definition: StatusCode.h:64
MinimalEventLoopMgr::m_outStreamList
ListAlg m_outStreamList
List of output streams.
Definition: MinimalEventLoopMgr.h:75
Gaudi::StateMachine::OFFLINE
@ OFFLINE
Definition: StateMachine.h:22
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:19
MinimalEventLoopMgr::m_WB
SmartIF< IHiveWhiteBoard > m_WB
< Event data service (whiteboard)
Definition: MinimalEventLoopMgr.h:125
Service.h
MinimalEventLoopMgr::AbortEventListener::handle
void handle(const Incident &i) override
Inform that a new incident has occurred.
Definition: MinimalEventLoopMgr.h:38
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:68
MinimalEventLoopMgr::m_topAlgList
ListAlg m_topAlgList
Definition: MinimalEventLoopMgr.h:73
EventContext.h
IIncidentListener.h
MinimalEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: MinimalEventLoopMgr.h:70
Gaudi::StateMachine::INITIALIZED
@ INITIALIZED
Definition: StateMachine.h:24
EventContext
Definition: EventContext.h:34
Incident::type
const std::string & type() const
Access to the incident type.
Definition: Incident.h:43
MinimalEventLoopMgr::m_abortEventListener
AbortEventListener m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
Definition: MinimalEventLoopMgr.h:81
IAlgorithm.h
IAlgExecStateSvc.h
Incident
Definition: Incident.h:24
MinimalEventLoopMgr
Definition: MinimalEventLoopMgr.h:33
IEventProcessor.h
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:35
MinimalEventLoopMgr::MinimalEventLoopMgr
MinimalEventLoopMgr(const MinimalEventLoopMgr &)=delete
No copy allowed.