summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/observer.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-14 19:31:42 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commiteabae24ea592420de46e36f0b1af5d39eee5b8a4 (patch)
tree16cbc39e84eb71d655add40e715f7d87b4b02132 /signal-composer-binding/observer.hpp
parent140fd3d8f76a8cbbde8f6b0bf997808855f3da43 (diff)
Attach and recursion check working
Change-Id: I2f9509d4b6aa63a16df8db2187810337fd802ef4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/observer.hpp')
-rw-r--r--signal-composer-binding/observer.hpp30
1 files changed, 0 insertions, 30 deletions
diff --git a/signal-composer-binding/observer.hpp b/signal-composer-binding/observer.hpp
deleted file mode 100644
index e4129c6..0000000
--- a/signal-composer-binding/observer.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <vector>
-
-class Observer
-{
-public:
- virtual void update(double timestamp, double value) = 0;
-};
-
-class Subject
-{
- double timestamp_;
- double value_;
- std::vector<Observer*> m_views;
-public:
- void attach(Observer *obs)
- {
- m_views.push_back(obs);
- }
- void set_val(double timestamp, double value)
- {
- timestamp_ = timestamp;
- value_ = value;
- notify();
- }
- void notify()
- {
- for (int i = 0; i < m_views.size(); ++i)
- m_views[i]->update(timestamp_, value_);
- }
-};