aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/publisher.hpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-03-20 18:49:49 +0100
committerHampusM <hampus@hampusmat.com>2022-06-13 17:56:56 +0200
commite6644d6b235005de9ba1b9884472fa5f5d8d6074 (patch)
treeb6d10d8e3ee8b092933baa55d35480d438bb6328 /src/interfaces/publisher.hpp
parent6f9d9fe1d1904ecc5ca52697ec2319a21008120f (diff)
refactor: update event system terminology & structure
Diffstat (limited to 'src/interfaces/publisher.hpp')
-rw-r--r--src/interfaces/publisher.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/interfaces/publisher.hpp b/src/interfaces/publisher.hpp
new file mode 100644
index 0000000..14766ed
--- /dev/null
+++ b/src/interfaces/publisher.hpp
@@ -0,0 +1,20 @@
+#pragma once
+
+#include "interfaces/subscriber.hpp"
+
+#include <functional>
+#include <memory>
+
+template <typename Event, typename Context>
+class IPublisher
+{
+public:
+ virtual ~IPublisher() noexcept = default;
+
+ virtual void
+ subscribe(const Event &event,
+ const std::shared_ptr<ISubscriber<Context>> &subscriber) noexcept = 0;
+
+ virtual void notify_subscribers(const Event &event,
+ const Context &context) const noexcept = 0;
+};