EventAnalysis
1.3.0
|
Base class for sequence decorators. More...
#include <AlgoSequenceDecorator.h>
Public Member Functions | |
AlgoSequenceDecorator (std::unique_ptr< AlgoSequence > &&sequence) | |
Constructor. More... | |
bool | Initialize () override |
Initializes the algorithms of the decorated sequence. More... | |
bool | Finalize () override |
Finalizes the algorithms of the decorated sequence. More... | |
![]() | |
AlgoSequence (const std::string &name) | |
Constructor. More... | |
bool | AddAlgorithm (std::unique_ptr< Algorithm > &&algo) |
Adds a new algorithm to the sequence. More... | |
observer_ptr< Algorithm > | GetAlgorithm (const std::string name) |
Get an algorithm. More... | |
const Algorithms & | GetAlgorithms () const |
Get the algorithms. More... | |
Algorithms & | GetAlgorithms () |
Get the algorithms. More... | |
bool | Process () |
Processes all the algorithms. More... | |
IterateRequest | Iterate () |
Forward the iteration request to the contained algorithms. More... | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
size_t | size () |
bool | SetDataStoreManager (observer_ptr< DataStoreManager > dsManager) |
Set the data store manager for the sequence and all the contained algorithms. More... | |
bool | SetEventLoopProxy (observer_ptr< EventLoopProxy > loopProxy) |
Set the event loop proxy for the sequence and all the contained algorithms. More... | |
![]() | |
Algorithm (const std::string &name) | |
observer_ptr< EventLoopProxy > | GetEventLoopProxy () |
Accessor for the event loop proxy. More... | |
![]() | |
Filter () | |
Constructor. More... | |
FilterResult | GetFilterResult () |
Get the result for the filter. More... | |
FilterLogic | GetFilterLogic () |
Get the current filter logic. More... | |
void | SetFilterStatus (FilterStatus status) |
Toggles on and off filtering. More... | |
FilterStatus | GetFilterStatus () |
The filter status. More... | |
void | SetFilterLogic (FilterLogic filterLogic) |
Sets the filter return value logic. More... | |
![]() | |
Info (const std::string &name) | |
Constructor. More... | |
virtual | ~Info () |
Destructor. More... | |
virtual const std::string | GetType () const |
virtual const std::string | GetName () const |
The type (i.e. class) of the object. More... | |
virtual const std::string | GetVersion () const |
The name of the object. 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... | |
![]() | |
DataStoreUser () | |
virtual | ~DataStoreUser () |
Destructor. More... | |
observer_ptr< DataStoreManager > | GetDataStoreManager () |
Getter for the Data store manager. More... | |
![]() | |
ObjectProducer () | |
Constructor. More... | |
virtual | ~ObjectProducer () |
Destructor. More... | |
template<typename C > | |
void | DeclareProducedObject (std::string name, ObjectCategory category, C aliases, std::string store) |
Declare a produced objects. More... | |
const ProducedObjects & | GetProducedObjects () const |
Getter method for produced objects. More... | |
bool | SetDisabled (bool disabled=true) |
Disables/enables the producer. More... | |
virtual std::vector< std::string > | FreeObjects (const std::vector< std::string > &objs, Memory::Status memStatus) |
Free the memory for given objects. More... | |
template<> | |
void | DeclareProducedObject (std::string name, ObjectCategory category, const char *alias, std::string store) |
![]() | |
ObjectConsumer () | |
Constructor. More... | |
void | DeclareConsumedObject (std::string name, ObjectCategory category, std::string store, bool optional=false) |
Declare a consumed objects. More... | |
void | DeclareAlternative (const std::string &name, ObjectCategory category, std::string store, const std::string &alternativeName, ObjectCategory alternativeCategory, std::string alternativeStore) |
Declares two already declared objects as alternatives. More... | |
const ConsumedObjects & | GetConsumedObjects () const |
Getter method for consumed objects. More... | |
Protected Member Functions | |
bool | ProcessAlgo (size_t iAlgo) override |
Hook for calling ProcessAlgo for the contained sequence. More... | |
observer_ptr< AlgoSequence > | GetSequence () |
Getter for the decorated sequence. More... | |
![]() | |
AlgoSequence (const std::shared_ptr< Filter::Representation > &filterRepr, const std::shared_ptr< Info::Representation > &infoRepr, const std::shared_ptr< Configurable::Representation > &confRepr, const std::shared_ptr< DataStoreUser::Representation > &dsuRepr, const std::shared_ptr< ObjectProducer::Representation > &opRepr, const std::shared_ptr< ObjectConsumer::Representation > &ocRepr, const std::shared_ptr< Algorithm::Representation > &algoRepr) | |
std::shared_ptr< Representation > & | GetRepresentation () |
![]() | |
Algorithm (const std::shared_ptr< Filter::Representation > &filterRepr, const std::shared_ptr< Info::Representation > &infoRepr, const std::shared_ptr< Configurable::Representation > &confRepr, const std::shared_ptr< DataStoreUser::Representation > &dsuRepr, const std::shared_ptr< ObjectProducer::Representation > &opRepr, const std::shared_ptr< ObjectConsumer::Representation > &ocRepr, const std::shared_ptr< Algorithm::Representation > &algoRepr) | |
std::shared_ptr< Representation > & | GetRepresentation () |
![]() | |
void | SetFilterResult (FilterResult result) |
Sets the result. More... | |
Filter (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
![]() | |
Info (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
![]() | |
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 () |
![]() | |
DataStoreUser (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
![]() | |
ObjectProducer (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
![]() | |
ObjectConsumer (const std::shared_ptr< Representation > &impl) | |
std::shared_ptr< Representation > & | GetRepresentation () |
Private Attributes | |
std::unique_ptr< AlgoSequence > | _sequence |
Additional Inherited Members | |
![]() | |
using | Algorithms = std::vector< std::unique_ptr< Algorithm > > |
Type of underlying algorithm container. More... | |
using | iterator = Algorithms::iterator |
using | const_iterator = Algorithms::const_iterator |
![]() | |
enum | IterateRequest { IterateRequest::YES, IterateRequest::NO, IterateRequest::WHATEVER, IterateRequest::ERROR } |
![]() | |
using | ProducedObjects = std::vector< ProducedObject > |
Type for container of produced objects. More... | |
![]() | |
using | ConsumedObjects = std::vector< ConsumedObject > |
Type for container of produced objects. More... | |
Base class for sequence decorators.
This class serves as the base for decorator classes for AlgoSequence. It is possible to decorate the methods Initialize, Finalize and ProcessAlgo (protected). The overrides in the derived decorator classes should call the corresponding methods of the base decorator class by means of the scope resolution operator, e.g.:
bool MyDecorator::Initialize(){ AlgoSequenceDecorator::Initialize(); // Decorator-specific code here }
and similarly for other overridden methods.
it is not possible to decorate Process, since it calls ProcessAlgo. Indeed, implementing the forwarding method in the classical way:
bool Process() override { return _sequence->Process(); }
when the wrapped sequence is an AlgoSequence (and not another decorator) it will call AlgoSequence::Process passing this as an AlgoSequence*. Thus inside Process the polymorphic call to this->ProcessAlgo will call AlgoSequence::ProcessAlgo and not AlgoSequenceDecorator::ProcessAlgo. An alternative implementation would be:
bool Process() { if (typeid(AlgoSequence) == typeid(*_sequence)) { return this->AlgoSequence::Process(); } else { return _sequence->Process(); } }
This would call AlgoSequence::Process passing this as an AlgoSequenceDecorator*, and so inside Process all the polymorphic calls would be correctly redirected to AlgoSequenceDecorator methods. However, if more decorators are stacked up then only the ProcessAlgo method of the bottom one (i.e. of the one that wraps the AlgoSequence) will be called.
For this reason Process is considered a template method, thus it cannot be decorated.
|
inline |
Constructor.
sequence | The decorated sequence. |
|
inlineoverridevirtual |
Finalizes the algorithms of the decorated sequence.
Reimplemented from EA::AlgoSequence.
|
inlineprotected |
Getter for the decorated sequence.
|
inlineoverridevirtual |
Initializes the algorithms of the decorated sequence.
Reimplemented from EA::AlgoSequence.
Reimplemented in EA::GarbageCollectorDecorator.
|
inlineoverrideprotectedvirtual |
Hook for calling ProcessAlgo for the contained sequence.
AlgoSequence::ProcessAlgo is protected; AlgoSequenceDecorator can call it since it is a friend of AlgoSequence, but classes derived from algoSequence cannot. Instead, they should call this method in their override of ProcessAlgo.
Reimplemented from EA::AlgoSequence.
Reimplemented in EA::GarbageCollectorDecorator.
|
private |