MNE-CPP
beta 1.0
|
The Subject class provides the base class of every subject of the observer design pattern. More...
#include <observerpattern.h>
Public Types | |
typedef QSharedPointer< Subject > | SPtr |
typedef QSharedPointer< const Subject > | ConstSPtr |
typedef QSet< IObserver * > | t_Observers |
Public Member Functions | |
virtual | ~Subject () |
void | attach (IObserver *pObserver) |
void | detach (IObserver *pObserver) |
void | notify () |
t_Observers & | observers () |
int | observerNumDebug () |
Static Public Attributes | |
static bool | notifyEnabled = true |
Protected Member Functions | |
Subject () | |
The Subject class provides the base class of every subject of the observer design pattern.
DECLARE BASE CLASS SUBJECT
Definition at line 99 of file observerpattern.h.
typedef QSharedPointer<const Subject> Subject::ConstSPtr |
Const shared pointer type for Subject.
Definition at line 103 of file observerpattern.h.
typedef QSharedPointer<Subject> Subject::SPtr |
Shared pointer type for Subject.
Definition at line 102 of file observerpattern.h.
typedef QSet<IObserver*> Subject::t_Observers |
Defines a new IObserver set type.
Definition at line 105 of file observerpattern.h.
|
virtual |
Destroys the Subject.
Definition at line 49 of file observerpattern.cpp.
|
inlineprotected |
Constructs a Subject.
Definition at line 165 of file observerpattern.h.
void Subject::attach | ( | IObserver * | pObserver | ) |
Attaches an observer to the subject.
[in] | pObserver | pointer to the observer which should be attached to the subject. |
Definition at line 57 of file observerpattern.cpp.
void Subject::detach | ( | IObserver * | pObserver | ) |
Detaches an observer of the subject.
[in] | pObserver | pointer to the observer which should be detached of the subject. |
Definition at line 65 of file observerpattern.cpp.
void Subject::notify | ( | ) |
Notifies all attached servers by calling there update method. Is used when subject has updates to provide. This method is enabled when nothifiedEnabled is true.
Definition at line 74 of file observerpattern.cpp.
|
inline |
Returns number of attached observers. ToDo only for debug purpose -> could be removed
Definition at line 158 of file observerpattern.h.
|
inline |
Returns attached observers.
Definition at line 177 of file observerpattern.h.
|
static |
Holds the status whether notification is enabled. This is used to block notify() to make the observer pattern thread safe. It's working like a mutex. The different is that data aren't stored. -> it's okay when values are queued in their own buffer.
Definition at line 141 of file observerpattern.h.