EventAnalysis  1.0.0
Algorithm.h
Go to the documentation of this file.
1 /*
2  * Algorithm.h
3  *
4  * Created on: 23 Apr 2013
5  * Author: Nicola Mori
6  */
7 
10 #ifndef ALGORITHM_H_
11 #define ALGORITHM_H_
12 
14 #include "core/Configurable.h"
15 #include "core/Filter.h"
16 #include "core/Info.h"
17 #include "data/DataStoreUser.h"
18 #include "data/ObjectConsumer.h"
19 #include "data/ObjectProducer.h"
20 
21 namespace EA {
22 
29 class Algorithm : public Filter,
30  public Info,
31  public Configurable,
32  public DataStoreUser,
33  public ObjectProducer,
34  public ObjectConsumer {
35 public:
37  Algorithm(const std::string &name);
38 
44  virtual bool SetEventLoopProxy(observer_ptr<EventLoopProxy> loopProxy);
45 
52  virtual bool Initialize();
53 
60  virtual bool Process();
61 
68  virtual bool Finalize();
69 
70  enum class IterateRequest { YES, NO, WHATEVER, ERROR };
71 
91  virtual IterateRequest Iterate();
92 
98 
99 protected:
101  friend class Algorithm;
103  };
104 
105  Algorithm(const std::shared_ptr<Filter::Representation> &filterRepr,
106  const std::shared_ptr<Info::Representation> &infoRepr,
107  const std::shared_ptr<Configurable::Representation> &confRepr,
108  const std::shared_ptr<DataStoreUser::Representation> &dsuRepr,
109  const std::shared_ptr<ObjectProducer::Representation> &opRepr,
110  const std::shared_ptr<ObjectConsumer::Representation> &ocRepr,
111  const std::shared_ptr<Algorithm::Representation> &algoRepr)
112  : Filter{filterRepr}, Info{infoRepr}, Configurable{confRepr}, DataStoreUser{dsuRepr}, ObjectProducer{opRepr},
113  ObjectConsumer{ocRepr}, _repr{algoRepr} {}
114 
115  std::shared_ptr<Representation> &GetRepresentation() { return _repr; }
116 
117 private:
118  std::shared_ptr<Representation> _repr;
119 };
120 
121 } // namespace EA
122 
123 #include "plugin/FactoryMacros.h"
124 #define RegisterAlgorithm(className) RegisterClass(EA::Algorithm, className, const std::string &)
125 
126 #endif /* ALGORITHM_H_ */
virtual bool Process()
Processing method.
Definition: Algorithm.cpp:27
IterateRequest
Definition: Algorithm.h:70
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)
Definition: Algorithm.h:105
observer_ptr< EventLoopProxy > loopProxy
Definition: Algorithm.h:102
virtual bool SetEventLoopProxy(observer_ptr< EventLoopProxy > loopProxy)
Injector for dependency on EventLoopProxy.
Definition: Algorithm.cpp:17
A smart pointer not owning the wrapped object.
Definition: ObserverPtr.h:28
Algorithm(const std::string &name)
Definition: Algorithm.cpp:15
Interface for retrieving informations about an object.
Definition: Info.h:18
IncludeFileExc.h IncludeFileExc class declaration.
Definition: Algorithm.h:21
Filter class.
Definition: Filter.h:32
std::shared_ptr< Representation > _repr
Definition: Algorithm.h:118
Definition: Algorithm.h:100
Interface for classes needing access to the data stores.
Definition: DataStoreUser.h:17
virtual bool Initialize()
Initialization method.
Definition: Algorithm.cpp:25
Interface for a class which produced data objects.
Definition: ObjectProducer.h:28
virtual IterateRequest Iterate()
Request for another iteration of the event loop.
Definition: Algorithm.cpp:31
virtual bool Finalize()
Finalization method.
Definition: Algorithm.cpp:29
Algorithm interface.
Definition: Algorithm.h:29
std::shared_ptr< Representation > & GetRepresentation()
Definition: Algorithm.h:115
Interface for a configurable class.
Definition: Configurable.h:25
observer_ptr< EventLoopProxy > GetEventLoopProxy()
Accessor for the event loop proxy.
Definition: Algorithm.h:97
Interface for a class which consumes data objects.
Definition: ObjectConsumer.h:27