EventAnalysis  1.3.0
EventLoop.h
Go to the documentation of this file.
1 /*
2  * EventLoop.h
3  *
4  * Created on: 29 May 2017
5  * Author: Nicola Mori
6  */
7 
10 #ifndef EVENTLOOP_H_
11 #define EVENTLOOP_H_
12 
13 #include "algorithm/AlgoSequence.h"
14 #include "algorithm/Algorithm.h"
17 #include "data/DataStoreManager.h"
20 
21 namespace EA {
22 
23 class EventLoopProxy;
24 
32 class EventLoop : public Configurable {
33 public:
39  EventLoop(unsigned int firstEvent = 0, unsigned int nEvents = 0);
40 
47 
54 
61 
68 
78  bool AddAlgorithm(std::unique_ptr<Algorithm> algo);
79 
85  bool SetAlgorithms(std::unique_ptr<AlgoSequence> &&algorithms);
86 
92 
105  bool CacheEventObject(const std::string &objName, const std::string &storeName);
106 
115  bool CleanEventCache(const std::string &objName, const std::string &storeName);
116 
132  bool Initialize(unsigned int passNumber, unsigned int iterNumber);
133 
147  bool Run();
148 
153  unsigned int GetFirstEvent();
154 
160  unsigned int GetNEvents();
161 
170  unsigned int GetNProcessed();
171 
183  bool Finalize();
184 
185  enum class IterateRequest { YES, NO, ERROR };
186 
206 
207 private:
208  friend class EventLoopProxy;
210 
215  std::unique_ptr<AlgoSequence> _algorithms;
216  using CachedObjs = std::list<std::pair<std::string, std::string>>;
219 
220  unsigned int _passNumber;
221  unsigned int _currIter;
222  unsigned int _currentEvent;
223  unsigned int _firstEvent;
224  unsigned int _nEvents;
225  unsigned int _nProcessed;
228  std::vector<std::string> _disabledProviders;
229 };
230 
231 } // namespace EA
232 
233 #endif /* EVENTLOOP_H_ */
bool SetPersistenceServiceManager(observer_ptr< PersistenceServiceManager > psManager)
Set the persistence service manager.
Definition: EventLoop.cpp:59
bool CleanEventCache(const std::string &objName, const std::string &storeName)
Cleans the cache for the given object.
Definition: EventLoop.cpp:92
AlgoSequence & GetAlgorithms()
Get the algorithm sequence in the loop.
Definition: EventLoop.h:91
bool SetDataProviderManager(observer_ptr< DataProviderManager > dpManager)
Set the data provider manager.
Definition: EventLoop.cpp:32
unsigned int _nProcessed
Definition: EventLoop.h:225
observer_ptr< DataStoreManager > _dsManager
Definition: EventLoop.h:212
bool Run()
The actual event loop.
Definition: EventLoop.cpp:243
A smart pointer not owning the wrapped object.
Definition: ObserverPtr.h:28
IterateRequest Iterate()
Signals whether the event loop has to be reiterated or not.
Definition: EventLoop.cpp:380
CachedObjs _cachedObjs
Definition: EventLoop.h:217
bool SetAlgorithms(std::unique_ptr< AlgoSequence > &&algorithms)
Replaces the loop algorithm sequence with the given one.
Definition: EventLoop.cpp:77
EventLoopProxy _loopProxy
Definition: EventLoop.h:209
observer_ptr< PersistenceServiceManager > _psManager
Definition: EventLoop.h:214
unsigned int _nEvents
Definition: EventLoop.h:224
Algorithm made by multiple basic algorithms.
Definition: AlgoSequence.h:37
IncludeFileExc.h IncludeFileExc class declaration.
Definition: Algorithm.h:21
bool CacheEventObject(const std::string &objName, const std::string &storeName)
Caches the given object.
Definition: EventLoop.cpp:85
CachedObjs _cachesToBeCleaned
Definition: EventLoop.h:218
bool _checkDataAvailability
Definition: EventLoop.h:227
bool Initialize(unsigned int passNumber, unsigned int iterNumber)
Initializes the loop.
Definition: EventLoop.cpp:99
bool Finalize()
Finalizes the loop.
Definition: EventLoop.cpp:349
bool SetDataStoreManager(observer_ptr< DataStoreManager > dsManager)
Set the data store manager.
Definition: EventLoop.cpp:41
unsigned int GetNEvents()
Returns the number of events to be processed.
Definition: EventLoop.cpp:345
EventLoop(unsigned int firstEvent=0, unsigned int nEvents=0)
Constructor.
Definition: EventLoop.cpp:23
int _printModulo
Definition: EventLoop.h:226
A proxy class for EventLoop objects.
Definition: EventLoopProxy.h:24
std::vector< std::string > _disabledProviders
Definition: EventLoop.h:228
unsigned int _currIter
Definition: EventLoop.h:221
unsigned int GetFirstEvent()
Returns the first event to be processed.
Definition: EventLoop.cpp:343
observer_ptr< DataProviderManager > _dpManager
Definition: EventLoop.h:211
unsigned int _passNumber
Definition: EventLoop.h:220
bool AddAlgorithm(std::unique_ptr< Algorithm > algo)
Add an algorithm to the loop.
Definition: EventLoop.cpp:67
observer_ptr< EventDataCacheManager > _ecManager
Definition: EventLoop.h:213
std::list< std::pair< std::string, std::string > > CachedObjs
Definition: EventLoop.h:216
bool SetEventDataCacheManager(observer_ptr< EventDataCacheManager > ecManager)
Set the event data cache manager.
Definition: EventLoop.cpp:50
std::unique_ptr< AlgoSequence > _algorithms
Definition: EventLoop.h:215
Interface for a configurable class.
Definition: Configurable.h:25
Interface for event loop classes.
Definition: EventLoop.h:32
unsigned int GetNProcessed()
Returns the number of processed events.
Definition: EventLoop.cpp:347
IterateRequest
Definition: EventLoop.h:185
unsigned int _currentEvent
Definition: EventLoop.h:222
unsigned int _firstEvent
Definition: EventLoop.h:223