aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/observable.hpp
blob: 1777b7da189dde910dc7047187495f212bff289c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once

#include <functional>

using Callback = std::function<void()>;

template <typename Event>
class IObservable
{
public:
	virtual ~IObservable() noexcept = default;

	virtual void listen() const noexcept = 0;

	virtual void attach(const Event &event, Callback callback) noexcept = 0;

	virtual void notify(const Event &event) const noexcept = 0;
};