Subject Base class for Observer-Design-Pattern within Guiliani. More...
#include <GUISubject.h>
Public Member Functions | |
CGUISubject () | |
Default constructor. | |
virtual | ~CGUISubject () |
Default destructor. | |
void | AddObserver (CGUIObserver *pObserver) |
void | ClearObservers () |
Removes all observers from the internal list. | |
const eC_TListDoubleLinked< CGUIObserver * > & | GetObserverList () const |
void | NotifyObservers () |
void | NotifyObservers (const CGUIObject *const pkUpdatedObject) |
void | NotifyObservers (const CGUIValue &kObservedValue, const CGUIObject *const pkUpdatedObject, const eC_UInt uiX=0, const eC_UInt uiY=0) |
void | NotifyObservers (const eC_String &kMessage) |
void | RemoveObserver (CGUIObserver *pObserver) |
Friends | |
class | CGUIObserver |
Subject Base class for Observer-Design-Pattern within Guiliani.
Use this base class if you wish to follow the observer-design-pattern within your application. Simply derive the class that you want to act as a subject from CGUISubject and whenever you want to inform any potential observers about changes within your object, call NotifyObservers(). The AddObserver() and RemoveObserver() methods are used only to handle the list of objects observing your subject and do not need to be overridden in your derived class.
void CGUISubject::AddObserver | ( | CGUIObserver * | pObserver | ) |
Adds an observer to the internal observer list. The observer will be notified whenever the subject triggers an update.
pObserver | The observer to add. |
|
inline |
void CGUISubject::NotifyObservers | ( | ) |
Triggers notification of all registered observers. CGUIObserver::OnNotification() will be called for each.
void CGUISubject::NotifyObservers | ( | const CGUIObject *const | pkUpdatedObject | ) |
Triggers notification of all registered observers. CGUIObserver::OnNotification(const CGUIObject* const) will be called for each.
pkUpdatedObject | Will be passed to CGUIObserver::OnNotification(const CGUIObject* const) |
void CGUISubject::NotifyObservers | ( | const CGUIValue & | kObservedValue, |
const CGUIObject *const | pkUpdatedObject, | ||
const eC_UInt | uiX = 0 , |
||
const eC_UInt | uiY = 0 |
||
) |
Triggers notification of all registered observers. CGUIObserver::OnNotification(const CGUIValue&, const CGUIObject* const, const eC_UInt, const eC_UInt) will be called for each.
kObservedValue | the updated value |
pkUpdatedObject | the updated object (can be NULL) |
uiX | X-Index of value to be set in case the updated value is part of a multidimensional array |
uiY | Y-Index of value to be set in case the updated value is part of a multidimensional array |
void CGUISubject::NotifyObservers | ( | const eC_String & | kMessage | ) |
Triggers notification of all registered observers. CGUIObserver::OnNotification(const eC_String&) will be called for each.
kMessage | Will be passed to CGUIObserver::OnNotification(const eC_String&) |
void CGUISubject::RemoveObserver | ( | CGUIObserver * | pObserver | ) |
Removes a registered observer from the internal observer list.
pObserver | The observer to remove. |
|
friend |