Torc  0.1
torcobservable.h
Go to the documentation of this file.
1 #ifndef TORCOBSERVABLE_H
2 #define TORCOBSERVABLE_H
3 
4 // Torc
5 #include "torcevent.h"
6 
7 class QObject;
8 class QMutex;
9 
11 {
12  public:
14  virtual ~TorcObservable() = default;
15 
16  void AddObserver (QObject* Observer);
17  void RemoveObserver (QObject* Observer);
18  void Notify (const TorcEvent &Event);
19 
20  private:
21  QMutex m_observerLock;
22  QList<QObject*> m_observers;
23 
24  private:
25  Q_DISABLE_COPY(TorcObservable)
26 };
27 
28 #endif // TORCOBSERVABLE_H
virtual ~TorcObservable()=default
A general purpose event object.
Definition: torcevent.h:9
void AddObserver(QObject *Observer)
brief Register the given object to receive events.
void Notify(const TorcEvent &Event)
Brief Send the given event to each registered listener/observer.
void RemoveObserver(QObject *Observer)
brief Deregister the given object.
TorcObservable will send event notifcations to registered &#39;listeners&#39;.