Torc
0.1
|
TorcObservable will send event notifcations to registered 'listeners'. More...
#include <torcobservable.h>
Public Member Functions | |
TorcObservable () | |
virtual | ~TorcObservable ()=default |
void | AddObserver (QObject *Observer) |
brief Register the given object to receive events. More... | |
void | RemoveObserver (QObject *Observer) |
brief Deregister the given object. More... | |
void | Notify (const TorcEvent &Event) |
Brief Send the given event to each registered listener/observer. More... | |
TorcObservable will send event notifcations to registered 'listeners'.
Classes that inherit from TorcObserval can notify registered listeners of important events via the Notify method.
This should only be used by classes that expect a more complex interaction with dependent objects. For simple use cases (i.e. a small number of events and/or a small number of listeners), direct eventing or the signal/slot mechanism should be used.
Definition at line 10 of file torcobservable.h.
TorcObservable::TorcObservable | ( | ) |
Definition at line 40 of file torcobservable.cpp.
|
virtualdefault |
void TorcObservable::AddObserver | ( | QObject * | Observer | ) |
brief Register the given object to receive events.
Definition at line 47 of file torcobservable.cpp.
void TorcObservable::Notify | ( | const TorcEvent & | Event | ) |
Brief Send the given event to each registered listener/observer.
Definition at line 63 of file torcobservable.cpp.
void TorcObservable::RemoveObserver | ( | QObject * | Observer | ) |
brief Deregister the given object.
Definition at line 56 of file torcobservable.cpp.