AnCH Framework 0.2
Another C++ Hack: C++23 utility libraries
Loading...
Searching...
No Matches
observable.hpp
1/*
2 ANCH Framework: ANother C++ Hack is a C++ framework based on C++23 standard
3 Copyright (C) 2012 Vincent Lachenal
4
5 This file is part of ANCH Framework.
6
7 ANCH Framework is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 ANCH Framework is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with ANCH Framework. If not, see <https://www.gnu.org/licenses/>.
19*/
20#pragma once
21
22#include <map>
23#include <string>
24
25#include "events/observer.hpp"
26#include "events/event.hpp"
27#include "events/observerList.hpp"
28
29
30namespace anch::events {
31
44 template<typename T>
45 class Observable {
46
47 private:
48 // Attributes +
51 // Attributes -
52
53 public:
54 // Constructors +
59 // Constructors -
60
61 // Destructor +
65 virtual ~Observable();
66 // Destructor -
67
68 public:
69 // Methods +
78
86
93 void notifyObservers(const T& event, const std::map<std::string,std::string>& headers = {});
94
101 // Methods -
102
103 };
104
105}
106
107#include "events/impl/observable.hpp"
void removeObserver(anch::events::Observer< T > &observer)
void notifyObservers(const T &event, const std::map< std::string, std::string > &headers={})
bool addObserver(anch::events::Observer< T > &observer)
void notifyObservers(const anch::events::Event< T > &event)
An observer interface of the observers/observable design pattern.
Definition observer.hpp:42
Thread safe observers list (internal usage).
Definition observerList.hpp:54
Events management namespace.
Definition event.hpp:25
Event representation.
Definition event.hpp:37