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> UTILSLIB::Subject::ConstSPtr |
Const shared pointer type for Subject.
Definition at line 103 of file observerpattern.h.
| typedef QSharedPointer<Subject> UTILSLIB::Subject::SPtr |
Shared pointer type for Subject.
Definition at line 102 of file observerpattern.h.
| typedef QSet<IObserver*> UTILSLIB::Subject::t_Observers |
Defines a new IObserver set type.
Definition at line 105 of file observerpattern.h.
|
virtual |
Destroys the Subject.
Definition at line 48 of file observerpattern.cpp.
|
inlineprotected |
Constructs a Subject.
Definition at line 172 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 54 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 61 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 69 of file observerpattern.cpp.
|
inline |
Returns attached observers.
Definition at line 165 of file observerpattern.h.
|
inline |
Returns attached observers.
Definition at line 183 of file observerpattern.h.
|
static |
Holds the status whether notification is enabled. Used to block notify() and prevent re-entrant notification loops.
Definition at line 141 of file observerpattern.h.