The interface definition for a PureMVC Observer. More...
#include <pmvcpp.h>
Public Member Functions | |
virtual void | setNotifyMethod (void(T::*fptr)(INotification *))=0 |
Set the notification method. | |
virtual void | setNotifyContext (T *notifyContext)=0 |
Set the notification context. | |
virtual void | notifyObserver (INotification *notification)=0 |
A callback. | |
virtual bool | compareNotifyContext (intptr_t memoryAddress)=0 |
Compare an object's memory address to the notification context's memory address. |
The interface definition for a PureMVC Observer.
In PureMVC, IObserver
implementors assume these responsibilities:
PureMVC does not rely upon underlying event models such as the one provided with Flash, and ActionScript 3 does not have an inherent event model.
The Observer Pattern as implemented within PureMVC exists to support event driven communication between the application and the actors of the MVC triad.
An Observer is an object that encapsulates information about an interested object with a notification method that should be called when an INotification is broadcast. The Observer then acts as a proxy for notifying the interested object.
Observers can receive Notification
s by having their notifyObserver
method invoked, passing in an object implementing the INotification
interface, such as a subclass of Notification
.
virtual bool PureMVC::IObserverRestricted::compareNotifyContext | ( | intptr_t | memoryAddress | ) | [pure virtual, inherited] |
Compare an object's memory address to the notification context's memory address.
memoryAddress | the object to compare |
Implemented in PureMVC::Observer< T >.
virtual void PureMVC::IObserverRestricted::notifyObserver | ( | INotification * | notification | ) | [pure virtual, inherited] |
A callback.
Call the Observer's callback function in the context of the Observer.
Implemented in PureMVC::Observer< T >.
virtual void PureMVC::IObserverTemplated< T >::setNotifyContext | ( | T * | notifyContext | ) | [pure virtual] |
Set the notification context.
notifyContext | the notification context (this) of the interested object |
Implemented in PureMVC::Observer< T >.
virtual void PureMVC::IObserverTemplated< T >::setNotifyMethod | ( | void(T::*)(INotification *) | fptr | ) | [pure virtual] |
Set the notification method.
The notification method should take one parameter of type INotification
notifyMethod | the notification (callback) method of the interested object |