6#include <amdis/Output.hpp>
7#include <amdis/common/ConceptsBase.hpp>
8#include <amdis/common/Index.hpp>
9#include <amdis/common/TypeTraits.hpp>
25 struct adapt {
bool value =
true; };
34 template <
class Event>
39 virtual void update(Event e) = 0;
40 virtual void unset() = 0;
53 template <
class Event,
class... Events>
63 template <
class Event>
85 if (std::find(observers_.begin(), observers_.end(), o) == observers_.end())
86 observers_.push_back(o);
96 std::list<ObserverInterface<Event>*> observers_;
101 template <
class Event,
class... Tags>
109 : notifier_(
const_cast<N*
>(¬ifier))
118 warning(
"Ignoring Notifier. Use AdaptiveGrid wrapper.");
131 : notifier_(other.notifier_)
139 if (&other !=
this) {
141 notifier_ = other.notifier_;
174 template <
class Event,
class Tags>
175 class ObserverSequenceImpl;
178 template <
class Event, std::size_t... Is>
179 class ObserverSequenceImpl<Event, std::index_sequence<Is...>>
180 :
private Observer<Event,index_t<Is>>...
183 template <
class... Notifiers,
184 REQUIRES(
sizeof...(Notifiers) ==
sizeof...(Is))>
185 ObserverSequenceImpl(Notifiers&&... notifiers)
192 template <
class Event, std::
size_t N>
193 using ObserverSequence = Impl::ObserverSequenceImpl<Event, std::make_index_sequence<N>>;
Definition: Observer.hpp:65
void detach(ObserverInterface< Event > *o)
Detaches the passed observer from the list, if stored.
Definition: Observer.hpp:90
void attach(ObserverInterface< Event > *o)
Attach a new observer that gets called on notify.
Definition: Observer.hpp:82
void notify(Event const &e)
Call the update method on all attached observers.
Definition: Observer.hpp:75
Mixin for signaling of certain events.
Definition: Observer.hpp:57
Definition: Observer.hpp:36
Implementation of the ObserverInterface.
Definition: Observer.hpp:104
virtual ~Observer()
Destructor, detaches from the notifier.
Definition: Observer.hpp:123
virtual void updateImpl(Event e, Tags...)=0
Implementation of the update method in derived class.
void unset() final
Definition: Observer.hpp:149
void update(Event e) final
Definition: Observer.hpp:156
Observer & operator=(Observer const &other)
Copy-assignment operator, copies the notifier and attaches this.
Definition: Observer.hpp:137
Observer(Observer const &other)
Copy constructor. Attaches this to the copied notifier.
Definition: Observer.hpp:130
Definition: Observer.hpp:25
Definition: Observer.hpp:30
Definition: Observer.hpp:19