#include <MAP/Broadcaster.h>
A listener adds itself to the list of listeners by calling AddListener( ) on the object it wants to listen to.
To broadcast, loop through all listeners in mListeners and call the appropriate notification function.
Example:
... for ( int i = 0; i < mListeners.size( ); i++ ) m_Listeners[i]->notify( );
Public Member Functions | |
void | addListener (T *listener) |
void | removeListener (T *listener) |
Protected Attributes | |
Vector< T * > | mListeners |
|
Add a listener. Clients should call this to register for notification. |
|
Remove a listener. Clients should call this to unregister for notification. |
|
The list of listeners. Implementer should iterate through list and call the appropriate notify function. |