From eabae24ea592420de46e36f0b1af5d39eee5b8a4 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Thu, 14 Sep 2017 19:31:42 +0200 Subject: Attach and recursion check working Change-Id: I2f9509d4b6aa63a16df8db2187810337fd802ef4 Signed-off-by: Romain Forlot --- signal-composer-binding/signal.hpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'signal-composer-binding/signal.hpp') diff --git a/signal-composer-binding/signal.hpp b/signal-composer-binding/signal.hpp index ad944aa..cb50c67 100644 --- a/signal-composer-binding/signal.hpp +++ b/signal-composer-binding/signal.hpp @@ -19,40 +19,43 @@ #include #include -#include #include #include -#include "observer.hpp" +class bindingApp; -class Signal; - -//TODO: claneys: define observer and observable interface then inherit -class Signal: public Observer, public Subject +class Signal { private: std::string id_; - std::vector sources_; - std::map history_; ///< history_ - Hold signal value history in map with + std::vector sourcesSig_; + long long int timestamp_; + double value_; + std::map history_; ///< history_ - Hold signal value history in map with double frequency_; std::string unit_; CtlActionT* onReceived_; + std::vector Observers_; - std::vector> observers_; - + void attach(Signal *obs); int recursionCheck(const std::string& origId); + public: - Signal(); Signal(const std::string& id, std::vector& sources, const std::string& unit, double frequency, CtlActionT* onReceived); explicit operator bool() const; + bool operator==(const Signal& other) const; + bool operator==(const std::string& aName) const; std::string id() const; - int recursionCheck(); - /* virtual */ void update(double timestamp, double value); + void update(long long int timestamp, double value); + int onReceivedCB(json_object *queryJ); + void attachToSources(bindingApp& bApp); + void notify(); - virtual double average() const; - virtual double min() const; - virtual double max() const; - double lastValue() const; + //virtual double average() const; + //virtual double min() const; + //virtual double max() const; + //double lastValue() const; + int recursionCheck(); }; -- cgit 1.2.3-korg