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>
94 std::set<ObserverInterface<Event>*> observers_;
99 template <
class Event,
class... Tags>
107 : notifier_(const_cast<N*>(¬ifier))
109 notifier_->attach(
this);
114 Observer(N
const& notifier)
116 warning(
"Ignoring Notifier. Use AdaptiveGrid wrapper.");
124 notifier_->detach(
this);
129 : notifier_(other.notifier_)
131 notifier_->attach(
this);
137 if (&other !=
this) {
138 notifier_->detach(
this);
139 notifier_ = other.notifier_;
156 updateImpl(e, Tags{}...);
163 virtual void updateImpl(Event e, Tags...) = 0;
172 template <
class Event,
class Tags>
173 class ObserverSequenceImpl;
176 template <
class Event, std::size_t... Is>
177 class ObserverSequenceImpl<Event, std::index_sequence<Is...>>
178 :
private Observer<Event,index_t<Is>>...
181 template <
class... Notifiers,
182 REQUIRES(
sizeof...(Notifiers) ==
sizeof...(Is))>
183 ObserverSequenceImpl(Notifiers&&... notifiers)
190 template <
class Event, std::
size_t N>
191 using ObserverSequence = Impl::ObserverSequenceImpl<Event, std::make_index_sequence<N>>;
Definition: Observer.hpp:35
void attach(ObserverInterface< Event > *o)
Attach a new observer that gets called on notify.
Definition: Observer.hpp:82
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
Implementation of the ObserverInterface.
Definition: Observer.hpp:100
Observer & operator=(Observer const &other)
Copy-assignment operator, copies the notifier and attaches this.
Definition: Observer.hpp:135
Definition: Observer.hpp:64
virtual ~Observer()
Destructor, detaches from the notifier.
Definition: Observer.hpp:121
Definition: Observer.hpp:25
Definition: Observer.hpp:30
Mixin for signaling of certain events.
Definition: Observer.hpp:54
void update(Event e) final
Definition: Observer.hpp:154
void detach(ObserverInterface< Event > *o)
Detaches the passed observer from the list, if stored.
Definition: Observer.hpp:88
Observer(Observer const &other)
Copy constructor. Attaches this to the copied notifier.
Definition: Observer.hpp:128
void notify(Event const &e)
Call the update method on all attached observers.
Definition: Observer.hpp:75
Definition: Observer.hpp:19
void unset() final
Definition: Observer.hpp:147