The Gaudi Framework  v33r0 (d5ea422b)
MinimalEventLoopMgr.h
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 #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<std::string> m_outStreamType{this, "OutStreamType", "OutputStream",
64  "[[deprecated]] default type for OutputStream instances"};
65  Gaudi::Property<bool> m_printCFExp{this, "PrintControlFlowExpression", false,
66  "Print the control flow expression representing the content of TopAlg"};
67 
68  // enums
69  enum State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED };
80  State m_state = OFFLINE;
82  bool m_scheduledStop = false;
85 
86 public:
88  MinimalEventLoopMgr( const std::string& nam, ISvcLocator* svcLoc );
90  MinimalEventLoopMgr( const MinimalEventLoopMgr& ) = delete;
92  MinimalEventLoopMgr& operator=( const MinimalEventLoopMgr& ) = delete;
93 
94 #if defined( GAUDI_V20_COMPAT ) && !defined( G21_NO_DEPRECATED )
95 protected:
97  template <class T>
98  T* releaseInterface( T* iface ) {
99  if ( 0 != iface ) iface->release();
100  return 0;
101  }
102 
103 public:
104 #endif
105 
107  StatusCode initialize() override;
109  StatusCode start() override;
111  StatusCode stop() override;
113  StatusCode finalize() override;
115  StatusCode reinitialize() override;
117  StatusCode restart() override;
119  EventContext createEventContext() override;
121  StatusCode nextEvent( int maxevt ) override;
123  StatusCode executeEvent( EventContext&& ctx ) override;
125  StatusCode executeRun( int maxevt ) override;
127  StatusCode stopRun() override;
128 
130  void topAlgHandler( Gaudi::Details::PropertyBase& p );
132  StatusCode decodeTopAlgs();
134  void outStreamHandler( Gaudi::Details::PropertyBase& p );
136  StatusCode decodeOutStreams();
137 
138 protected:
141 
142  // number of events processed
143  size_t m_nevt{0};
144 };
145 #endif // GAUDIKERNEL_MINIMALEVENTLOOPMGR_H
void topAlgHandler(Gaudi::Details::PropertyBase &p)
Top algorithm List handler.
Base class used to implement the interfaces.
Definition: implements.h:19
executeEvent
Helpers for re-entrant interfaces.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:35
Implementation of property with value of concrete type.
Definition: Property.h:370
const std::string & type() const
Access to the incident type.
Definition: Incident.h:48
SmartIF< IAlgExecStateSvc > m_aess
List of top level algorithms.
void outStreamHandler(Gaudi::Details::PropertyBase &p)
Output stream List handler.
std::string abortEventSource
Source of the AbortEvent incident.
This class represents an entry point to all the event specific data.
Definition: EventContext.h:34
def start
Definition: IOTest.py:108
const std::string & source() const
Access to the source of the incident.
Definition: Incident.h:54
STL class.
std::vector< SmartIF< IAlgorithm > > ListAlg
SmartIF< IHiveWhiteBoard > m_WB
< Event data service (whiteboard)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:42
AbortEventListener m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
STL class.
ListAlg m_outStreamList
List of output streams.
Base class used to extend a class implementing other interfaces.
Definition: extends.h:20
Base class for all Incidents (computing events).
Definition: Incident.h:27
This is the default processing manager of the application manager.
int maxevt
Definition: Bootstrap.cpp:270
return ep &&ep executeRun(maxevt).isSuccess()
#define GAUDI_API
Definition: Kernel.h:81
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
void handle(const Incident &i) override
Inform that a new incident has occurred.