| The Gaudi Framework v32r1 (f65d50dc)

MinimalEventLoopMgr.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_MINIMALEVENTLOOPMGR_H
2 #define GAUDIKERNEL_MINIMALEVENTLOOPMGR_H 1
3
4 #include <Gaudi/Interfaces/IAsyncEventProcessor.h>
5 #include <GaudiKernel/EventContext.h>
6 #include <GaudiKernel/IAlgExecStateSvc.h>
7 #include <GaudiKernel/IAlgorithm.h>
8 #include <GaudiKernel/IAppMgrUI.h>
9 #include <GaudiKernel/IEventProcessor.h>
10 #include <GaudiKernel/IHiveWhiteBoard.h>
11 #include <GaudiKernel/IIncidentListener.h>
12 #include <GaudiKernel/IIncidentSvc.h>
13 #include <GaudiKernel/Service.h>
14 #include <vector>
15
25 class GAUDI_API MinimalEventLoopMgr : public extends<Service, IEventProcessor> {
26 private:
27 class AbortEventListener : public implements<IIncidentListener> {
28 public:
30 void handle( const Incident& i ) override {
31 if ( i.type() == IncidentType::AbortEvent ) {
32 abortEvent = true;
33 abortEventSource = i.source();
34 }
35 }
36
37 public:
40 bool abortEvent = false;
42 std::string abortEventSource;
43 };
44
45 public:
46 typedef std::vector<SmartIF<IAlgorithm>> ListAlg;
47
48 protected:
49 // Properties
50 Gaudi::Property<std::vector<std::string>> m_topAlgNames{
51 this, "TopAlg", {}, &MinimalEventLoopMgr::topAlgHandler, "list of top level algorithms names"};
52 Gaudi::Property<std::vector<std::string>> m_outStreamNames{
53 this, "OutStream", {}, &MinimalEventLoopMgr::outStreamHandler, "list of output stream names"};
54 Gaudi::Property<std::string> m_outStreamType{this, "OutStreamType", "OutputStream",
55 "[[deprecated]] default type for OutputStream instances"};
56 Gaudi::Property<bool> m_printCFExp{this, "PrintControlFlowExpression", false,
57 "Print the control flow expression representing the content of TopAlg"};
58
59 // enums
60 enum State { OFFLINE, CONFIGURED, FINALIZED, INITIALIZED };
62 SmartIF<IAppMgrUI> m_appMgrUI;
64 SmartIF<IIncidentSvc> m_incidentSvc;
66 SmartIF<IAlgExecStateSvc> m_aess;
67 ListAlg m_topAlgList;
69 ListAlg m_outStreamList;
71 State m_state = OFFLINE;
73 bool m_scheduledStop = false;
75 AbortEventListener m_abortEventListener;
76
77 public:
79 MinimalEventLoopMgr( const std::string& nam, ISvcLocator* svcLoc );
81 MinimalEventLoopMgr( const MinimalEventLoopMgr& ) = delete;
83 MinimalEventLoopMgr& operator=( const MinimalEventLoopMgr& ) = delete;
84
85 #if defined( GAUDI_V20_COMPAT ) && !defined( G21_NO_DEPRECATED )
86 protected:
88 template <class T>
89 T* releaseInterface( T* iface ) {
90 if ( 0 != iface ) iface->release();
91 return 0;
92 }
93
94 public:
95 #endif
96
98 StatusCode initialize() override;
100 StatusCode start() override;
102 StatusCode stop() override;
104 StatusCode finalize() override;
106 StatusCode reinitialize() override;
108 StatusCode restart() override;
110 EventContext createEventContext() override;
112 StatusCode nextEvent( int maxevt ) override;
114 StatusCode executeEvent( EventContext&& ctx ) override;
116 StatusCode executeRun( int maxevt ) override;
118 StatusCode stopRun() override;
119
121 void topAlgHandler( Gaudi::Details::PropertyBase& p );
123 StatusCode decodeTopAlgs();
125 void outStreamHandler( Gaudi::Details::PropertyBase& p );
127 StatusCode decodeOutStreams();
128
129 protected:
131 SmartIF<IHiveWhiteBoard> m_WB;
132
133 // number of events processed
134 size_t m_nevt{0};
135 };
136 #endif // GAUDIKERNEL_MINIMALEVENTLOOPMGR_H
IAsyncEventProcessor.h
MinimalEventLoopMgr::topAlgHandler
void topAlgHandler(Gaudi::Details::PropertyBase &p)
Top algorithm List handler.
Definition: MinimalEventLoopMgr.cpp:402
Gaudi::StateMachine::INITIALIZED
Definition: StateMachine.h:15
SmartIF< IAppMgrUI >
implements
Base class used to implement the interfaces.
Definition: implements.h:9
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IEventProcessor.h
Gaudi::StateMachine::CONFIGURED
Definition: StateMachine.h:14
IAlgExecStateSvc.h
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:352
IAppMgrUI.h
Incident::type
const std::string & type() const
Access to the incident type.
Definition: Incident.h:38
MinimalEventLoopMgr::AbortEventListener
Definition: MinimalEventLoopMgr.h:27
MinimalEventLoopMgr::m_aess
SmartIF< IAlgExecStateSvc > m_aess
List of top level algorithms.
Definition: MinimalEventLoopMgr.h:66
IAlgorithm.h
MinimalEventLoopMgr::State
State
Definition: MinimalEventLoopMgr.h:60
EventContext.h
MinimalEventLoopMgr::outStreamHandler
void outStreamHandler(Gaudi::Details::PropertyBase &p)
Output stream List handler.
Definition: MinimalEventLoopMgr.cpp:450
MinimalEventLoopMgr::AbortEventListener::abortEventSource
std::string abortEventSource
Source of the AbortEvent incident.
Definition: MinimalEventLoopMgr.h:42
EventContext
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
IOTest.start
def start
Definition: IOTest.py:97
Incident::source
const std::string & source() const
Access to the source of the incident.
Definition: Incident.h:44
std::string
STL class.
Service.h
MinimalEventLoopMgr::ListAlg
std::vector< SmartIF< IAlgorithm > > ListAlg
Definition: MinimalEventLoopMgr.h:46
MinimalEventLoopMgr::m_WB
SmartIF< IHiveWhiteBoard > m_WB
< Event data service (whiteboard)
Definition: MinimalEventLoopMgr.h:131
IIncidentSvc.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
MinimalEventLoopMgr::m_abortEventListener
AbortEventListener m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
Definition: MinimalEventLoopMgr.h:75
MinimalEventLoopMgr::m_incidentSvc
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
Definition: MinimalEventLoopMgr.h:64
std::vector
STL class.
MinimalEventLoopMgr::m_outStreamList
ListAlg m_outStreamList
List of output streams.
Definition: MinimalEventLoopMgr.h:69
IHiveWhiteBoard.h
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
Incident
Base class for all Incidents (computing events).
Definition: Incident.h:17
IIncidentListener.h
MinimalEventLoopMgr
This is the default processing manager of the application manager.
Definition: MinimalEventLoopMgr.h:25
maxevt
int maxevt
Definition: Bootstrap.cpp:260
executeRun
return ep &&ep executeRun(maxevt).isSuccess()
Gaudi::StateMachine::OFFLINE
Definition: StateMachine.h:13
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:71
MinimalEventLoopMgr::m_appMgrUI
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
Definition: MinimalEventLoopMgr.h:62
MinimalEventLoopMgr::AbortEventListener::handle
void handle(const Incident &i) override
Inform that a new incident has occurred.
Definition: MinimalEventLoopMgr.h:30
MinimalEventLoopMgr::m_topAlgList
ListAlg m_topAlgList
Definition: MinimalEventLoopMgr.h:67