#include <IpObserver.hpp>
This class implements the Subject class of the Observer Design Pattern. An Observer "Attach"es to a Subject, indicating that it would like to be notified of changes in the Subject. Any derived class that is to be observed has to inherit off the Subject base class. If the subject needs to notify the Observer, it calls the Notify method.
Public Member Functions | |
Constructors/Destructors | |
Subject () | |
Default Constructor. | |
virtual | ~Subject () |
Default destructor. | |
Methods to Add and Remove Observers. | |
Currently, the notify_type flags are not used, and Observers are attached in general and will recieve all notifications (of the type requested and possibly of types not requested).
It is up to the observer to ignore the types they are not interested in. The NotifyType in the parameter list is so a more efficient mechanism depending on type could be implemented later if necessary. | |
void | AttachObserver (Observer::NotifyType notify_type, Observer *observer) const |
Attach the specified observer (i.e., begin recieving notifications). | |
void | DetachObserver (Observer::NotifyType notify_type, Observer *observer) const |
Detach the specified observer (i.e., no longer recieve notifications). | |
Protected Member Functions | |
void | Notify (Observer::NotifyType notify_type) const |
Subject | ( | ) | [inline] |
Default Constructor.
~Subject | ( | ) | [inline, virtual] |
void AttachObserver | ( | Observer::NotifyType | notify_type, | |
Observer * | observer | |||
) | const [inline] |
Attach the specified observer (i.e., begin recieving notifications).
References DBG_ASSERT, and DBG_START_METH.
Referenced by Observer::RequestAttach().
void DetachObserver | ( | Observer::NotifyType | notify_type, | |
Observer * | observer | |||
) | const [inline] |
Detach the specified observer (i.e., no longer recieve notifications).
References DBG_ASSERT, and DBG_START_METH.
Referenced by Observer::RequestDetach().
void Notify | ( | Observer::NotifyType | notify_type | ) | const [inline, protected] |