PSCF v1.1
|
Notifier (or subject) in the Observer design pattern. More...
#include <Signal.h>
Public Member Functions | |
Signal () | |
Default constructor. More... | |
~Signal () | |
Destructor. More... | |
template<class Observer > | |
void | addObserver (Observer &observer, void(Observer::*methodPtr)(const T &)) |
Register an observer. More... | |
void | clear () |
Clear all observerse from list. More... | |
int | nObserver () const |
Get number of registered observers. More... | |
void | notify (const T &t) |
Notify all observers. More... | |
Notifier (or subject) in the Observer design pattern.
A Signal manages a list of registered functor objects, and provides a void Signal<T>::notify(const T&) method that calls them all with the same argument.
The explicit specialization Signal<void>, or Signal<>, has a notify method void Signal<>::notify() that takes no parameters, which calls a method of each observer that takes no parameters.
|
inline |
Util::Signal< T >::~Signal |
Destructor.
Definition at line 16 of file Signal.cpp.
void Util::Signal< T >::addObserver | ( | Observer & | observer, |
void(Observer::*)(const T &) | methodPtr | ||
) |
void Util::Signal< T >::clear |
Clear all observerse from list.
Definition at line 36 of file Signal.cpp.
int Util::Signal< T >::nObserver |
Get number of registered observers.
Definition at line 51 of file Signal.cpp.
void Util::Signal< T >::notify | ( | const T & | t | ) |
Notify all observers.
This method notifies all registered observers by calling the appropriate method of each observer, passing each the parameter t as argument. The explicit specialization Signal<>, with T=void, is used for notification methods that take
t | Argument passed to notification methods of all observers. |
Definition at line 22 of file Signal.cpp.