MAPUtil::Broadcaster< T > Class Template Reference

#include <MAP/Broadcaster.h>

List of all members.


Detailed Description

template<class T>
class MAPUtil::Broadcaster< T >

This template class enables typed notification broadcasting to multiple listeners. Listeners must implement class T.

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


Member Function Documentation

template<class T>
void MAPUtil::Broadcaster< T >::addListener T *  listener  )  [inline]
 

Add a listener. Clients should call this to register for notification.

template<class T>
void MAPUtil::Broadcaster< T >::removeListener T *  listener  )  [inline]
 

Remove a listener. Clients should call this to unregister for notification.


Member Data Documentation

template<class T>
Vector<T*> MAPUtil::Broadcaster< T >::mListeners [protected]
 

The list of listeners. Implementer should iterate through list and call the appropriate notify function.


Generated on Sat Feb 13 00:15:38 2010 for MoSync 2 beta 1 by  doxygen 1.4.6-NO