diff options
author | HampusM <hampus@hampusmat.com> | 2022-02-28 21:30:30 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:54 +0200 |
commit | ede689d23e57c9b701ab19aa9112a0b2368865c9 (patch) | |
tree | e8c7afc7b2e5caf43b1b0c52356c0596021f25cb /src/interfaces/observable.hpp | |
parent | f0883534b3303cf2b74f3ab51efe16615d2561a9 (diff) |
feat: add input handler & quitting with 'q'
Diffstat (limited to 'src/interfaces/observable.hpp')
-rw-r--r-- | src/interfaces/observable.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/interfaces/observable.hpp b/src/interfaces/observable.hpp new file mode 100644 index 0000000..ca8ffda --- /dev/null +++ b/src/interfaces/observable.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include <functional> + +using Callback = std::function<void()>; + +template <typename Event> +class IObservable +{ +public: + virtual void listen() const = 0; + + virtual void attach(const Event &event, Callback callback) = 0; + + virtual void notify(const Event &event) const = 0; +}; |