EventAnalysis
1.3.0
|
Interface for event loop classes. More...
#include <EventLoop.h>
Public Types | |
enum | IterateRequest { IterateRequest::YES, IterateRequest::NO, IterateRequest::ERROR } |
Public Member Functions | |
EventLoop (unsigned int firstEvent=0, unsigned int nEvents=0) | |
Constructor. More... | |
bool | SetDataProviderManager (observer_ptr< DataProviderManager > dpManager) |
Set the data provider manager. More... | |
bool | SetDataStoreManager (observer_ptr< DataStoreManager > dsManager) |
Set the data store manager. More... | |
bool | SetEventDataCacheManager (observer_ptr< EventDataCacheManager > ecManager) |
Set the event data cache manager. More... | |
bool | SetPersistenceServiceManager (observer_ptr< PersistenceServiceManager > psManager) |
Set the persistence service manager. More... | |
bool | AddAlgorithm (std::unique_ptr< Algorithm > algo) |
Add an algorithm to the loop. More... | |
bool | SetAlgorithms (std::unique_ptr< AlgoSequence > &&algorithms) |
Replaces the loop algorithm sequence with the given one. More... | |
AlgoSequence & | GetAlgorithms () |
Get the algorithm sequence in the loop. More... | |
bool | CacheEventObject (const std::string &objName, const std::string &storeName) |
Caches the given object. More... | |
bool | CleanEventCache (const std::string &objName, const std::string &storeName) |
Cleans the cache for the given object. More... | |
bool | Initialize (unsigned int passNumber, unsigned int iterNumber) |
Initializes the loop. More... | |
bool | Run () |
The actual event loop. More... | |
unsigned int | GetFirstEvent () |
Returns the first event to be processed. More... | |
unsigned int | GetNEvents () |
Returns the number of events to be processed. More... | |
unsigned int | GetNProcessed () |
Returns the number of processed events. More... | |
bool | Finalize () |
Finalizes the loop. More... | |
IterateRequest | Iterate () |
Signals whether the event loop has to be reiterated or not. More... | |
![]() | |
Configurable () | |
Constructor. More... | |
template<typename T > | |
bool | SetParameter (const std::string &name, const T &value) |
Set the value of a parameter. More... | |
bool | SetParameter (const std::string &name, const char *value) |
Set the value of a string parameter using a string literal. More... | |
std::vector< std::string > | GetParameters () |
Get the names of the parameters. More... | |
Private Types | |
using | CachedObjs = std::list< std::pair< std::string, std::string > > |
Private Attributes | |
EventLoopProxy | _loopProxy |
observer_ptr< DataProviderManager > | _dpManager |
observer_ptr< DataStoreManager > | _dsManager |
observer_ptr< EventDataCacheManager > | _ecManager |
observer_ptr< PersistenceServiceManager > | _psManager |
std::unique_ptr< AlgoSequence > | _algorithms |
CachedObjs | _cachedObjs |
CachedObjs | _cachesToBeCleaned |
unsigned int | _passNumber |
unsigned int | _currIter |
unsigned int | _currentEvent |
unsigned int | _firstEvent |
unsigned int | _nEvents |
unsigned int | _nProcessed |
int | _printModulo |
bool | _checkDataAvailability |
std::vector< std::string > | _disabledProviders |
Friends | |
class | EventLoopProxy |
Additional Inherited Members | |
![]() | |
template<typename T > | |
bool | DefineParameter (const std::string &name, T &variable) |
Set a parameter. More... | |
Configurable (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
Interface for event loop classes.
An EventLoop takes care of executing algorithms on a set of events provided by data providers.
The EventLoop owns the algorithms assigned to it.
|
private |
|
strong |
EA::EventLoop::EventLoop | ( | unsigned int | firstEvent = 0 , |
unsigned int | nEvents = 0 |
||
) |
Constructor.
firstEvent | The first event to be processed. |
nEvents | Number of events to be processed. |
bool EA::EventLoop::AddAlgorithm | ( | std::unique_ptr< Algorithm > | algo | ) |
Add an algorithm to the loop.
Each algorithm is evaluated separately on every event in the #DoLoop method. To conditionally evaluate a sequence of algorithms, put them inside an #AlgoSequence and add the sequence to the EventLoop.
algo | The algorithm to add. |
bool EA::EventLoop::CacheEventObject | ( | const std::string & | objName, |
const std::string & | storeName | ||
) |
Caches the given object.
This method will make the object values created during the event loop to be cached. The given object from the given store will be booked for being cached during loop initialization. In case of multiple iterations of the loop the cached values will be updated in subsequent iterations. The booked objects will be unbooked at the end of the loop, so that they won't be automatically cached again by subsequent loops.
objName | The name of the object to be cached. |
storeName | The event store containing the object to be cached. |
bool EA::EventLoop::CleanEventCache | ( | const std::string & | objName, |
const std::string & | storeName | ||
) |
Cleans the cache for the given object.
All the cached values for the given object are deleted.
objName | The name of the object. |
storeName | The event store containing the object. |
bool EA::EventLoop::Finalize | ( | ) |
Finalizes the loop.
This routine must be called after Run. It:
If any exception is thrown by an algorithm during finalization it is caught and a false value is returned.
|
inline |
Get the algorithm sequence in the loop.
unsigned int EA::EventLoop::GetFirstEvent | ( | ) |
Returns the first event to be processed.
unsigned int EA::EventLoop::GetNEvents | ( | ) |
Returns the number of events to be processed.
unsigned int EA::EventLoop::GetNProcessed | ( | ) |
Returns the number of processed events.
This may actually be different from GetNEvents, e.g. when processing has not been started (in this case the returned value will be 0) or when there are less events than desired.
bool EA::EventLoop::Initialize | ( | unsigned int | passNumber, |
unsigned int | iterNumber | ||
) |
Initializes the loop.
This routine must be called before Run. It:
If any exception is thrown by an algorithm during initialization it is caught and a false value is returned.
passNumber | the number of current pass. |
iterNumber | the number of current iteration of current pass. |
EventLoop::IterateRequest EA::EventLoop::Iterate | ( | ) |
Signals whether the event loop has to be reiterated or not.
Some algorithms may require to loop over all the events for an unspecified number of times, e.g. an algorithm based on a convergent procedure. Each algorithm is queried by this method for another iteration by calling Algorithm::Iterate(). If at least one algorithm requires for another iteration by returning #Algorithm::IterateRequest::YES, and all the others return the same value or #Algorithm::IterateRequest::WHATEVER, then this method returns #IterateRequest::YES. If at least one algorithm forbids another iteration by returning #Algorithm::IterateRequest::NO, and all the others return the same value or #Algorithm::IterateRequest::WHATEVER, then this method returns #IterateRequest::NO. In case two algorithms have conflicting iteration requests (e.g. one returns #Algorithm::IterateRequest::YES and another #Algorithm::IterateRequest::NO) then the IterateRequest::ERROR value is returned.
If no algorithm makes a definite iteration request (i.e. if all the algorithms return #Algorithm::IterateRequest::WHATEVER) then #IterateRequest::NO is returned.
bool EA::EventLoop::Run | ( | ) |
The actual event loop.
Runs all the algorithms added by AddAlgorithm. For each event it:
If any exception is thrown by an algorithm during processing it is caught and a false value is returned.
bool EA::EventLoop::SetAlgorithms | ( | std::unique_ptr< AlgoSequence > && | algorithms | ) |
Replaces the loop algorithm sequence with the given one.
algorithms | The new algorithm sequence. |
bool EA::EventLoop::SetDataProviderManager | ( | observer_ptr< DataProviderManager > | dpManager | ) |
Set the data provider manager.
dpManager | The data provider manager |
bool EA::EventLoop::SetDataStoreManager | ( | observer_ptr< DataStoreManager > | dsManager | ) |
Set the data store manager.
dsManager | The data store manager |
bool EA::EventLoop::SetEventDataCacheManager | ( | observer_ptr< EventDataCacheManager > | ecManager | ) |
Set the event data cache manager.
ecManager | The event data cache manager |
bool EA::EventLoop::SetPersistenceServiceManager | ( | observer_ptr< PersistenceServiceManager > | psManager | ) |
Set the persistence service manager.
psManager | The persistence service |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |