Sirikata
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
Sirikata::Provider< ListenerPtr > Class Template Reference

This class gives listeners an interface to register themselves and a mechanism to notify listeners Users of this class should remember to notify new listeners. More...

#include <ListenerProvider.hpp>

Inheritance diagram for Sirikata::Provider< ListenerPtr >:
Collaboration diagram for Sirikata::Provider< ListenerPtr >:

List of all members.

Public Member Functions

virtual void addListener (ListenerPtr p)
 This function adds a new listener to listen for notification This may be called during a notify call, but new functions will not be called until the next notification.
virtual void removeListener (ListenerPtr p)
 This function removes a listener from listening for notification This may be called during a notify call on the currently notified listener only.

Protected Types

typedef std::vector< ListenerPtr > ListenerVector
typedef std::map< ListenerPtr,
uint32 > 
ListenerMap

Protected Member Functions

virtual ~Provider ()
virtual void listenerAdded (ListenerPtr)
 This function is called with a new listener just after every listener is added to the callbacks (Override for interesting behavior, such as feeding the initial values to it)
virtual void listenerRemoved (ListenerPtr)
 This function is called with the dated listener just before that listener is removed from the callbacks (Override for interesting behavior)
virtual void firstListenerAdded (ListenerPtr)
 This function is called with a new listener when the first listener signs up (Override to propogate network requests for example)
virtual void lastListenerRemoved (ListenerPtr)
 This function is called with the defunct listener just before the last listener is removed frmo the callbacks. Override for interesting behavior.
template<typename T >
void notify (T func)
 This function notifies all listeners.
template<typename T , typename A >
void notify (T func, A newA)
 This function notifies all listeners.
template<typename T , typename A , typename B >
void notify (T func, A newA, B newB)
 This function notifies all listeners.
template<typename T , typename A , typename B , typename C >
void notify (T func, A newA, B newB, C newC)
 This function notifies all listeners.
template<typename T , typename A , typename B , typename C , typename D >
void notify (T func, A newA, B newB, C newC, D newD)
 This function notifies all listeners.
template<typename T , typename A , typename B , typename C , typename D , typename E >
void notify (T func, A newA, B newB, C newC, D newD, E newE)
 This function notifies all listeners.
template<typename T , typename A , typename B , typename C , typename D , typename E , typename F >
void notify (T func, A newA, B newB, C newC, D newD, E newE, F newF)
 This function notifies all listeners.
template<typename T , typename A , typename B , typename C , typename D , typename E , typename F , typename G >
void notify (T func, A newA, B newB, C newC, D newD, E newE, F newF, G newG)
 This function notifies all listeners.
template<typename T , typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H >
void notify (T func, A newA, B newB, C newC, D newD, E newE, F newF, G newG, H newH)
 This function notifies all listeners.
template<typename T , typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I >
void notify (T func, A newA, B newB, C newC, D newD, E newE, F newF, G newG, H newH, I newI)
 This function notifies all listeners.

Protected Attributes

ListenerVector mListeners
 A list of listeners interested in updates from this class.
ListenerMap mListenerIndex
 A map from listener pointers to indexes in the listeners vector.

Detailed Description

template<typename ListenerPtr>
class Sirikata::Provider< ListenerPtr >

This class gives listeners an interface to register themselves and a mechanism to notify listeners Users of this class should remember to notify new listeners.


Member Typedef Documentation

template<typename ListenerPtr>
typedef std::map<ListenerPtr,uint32> Sirikata::Provider< ListenerPtr >::ListenerMap [protected]
template<typename ListenerPtr>
typedef std::vector<ListenerPtr> Sirikata::Provider< ListenerPtr >::ListenerVector [protected]

Constructor & Destructor Documentation

template<typename ListenerPtr>
virtual Sirikata::Provider< ListenerPtr >::~Provider ( ) [inline, protected, virtual]

Member Function Documentation

template<typename ListenerPtr>
virtual void Sirikata::Provider< ListenerPtr >::addListener ( ListenerPtr  p) [inline, virtual]
template<typename ListenerPtr>
virtual void Sirikata::Provider< ListenerPtr >::firstListenerAdded ( ListenerPtr  ) [inline, protected, virtual]

This function is called with a new listener when the first listener signs up (Override to propogate network requests for example)

Referenced by Sirikata::Provider< EntityListener * >::addListener().

template<typename ListenerPtr>
virtual void Sirikata::Provider< ListenerPtr >::lastListenerRemoved ( ListenerPtr  ) [inline, protected, virtual]

This function is called with the defunct listener just before the last listener is removed frmo the callbacks. Override for interesting behavior.

Referenced by Sirikata::Provider< EntityListener * >::removeListener().

template<typename ListenerPtr>
virtual void Sirikata::Provider< ListenerPtr >::listenerAdded ( ListenerPtr  ) [inline, protected, virtual]

This function is called with a new listener just after every listener is added to the callbacks (Override for interesting behavior, such as feeding the initial values to it)

Referenced by Sirikata::Provider< EntityListener * >::addListener().

template<typename ListenerPtr>
virtual void Sirikata::Provider< ListenerPtr >::listenerRemoved ( ListenerPtr  ) [inline, protected, virtual]

This function is called with the dated listener just before that listener is removed from the callbacks (Override for interesting behavior)

Referenced by Sirikata::Provider< EntityListener * >::removeListener().

template<typename ListenerPtr>
template<typename T , typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H >
void Sirikata::Provider< ListenerPtr >::notify ( func,
newA,
newB,
newC,
newD,
newE,
newF,
newG,
newH 
) [inline, protected]

This function notifies all listeners.

Listeners may add other listeners or remove themselves, though undefined behavior results from removing other listeners during the call.

Parameters:
funcwhich must be a member function of ListenerPtr gets called on all listeners
newAis the first argument passed to func
newBis the second argument passed to func
newCis the third argument passed to func
newDis the fourth argument passed to func
newEis the fifth argument passed to func
newFis the sixth argument passed to func
newGis the seventh argument passed to func
newHis the eighth argument passed to func
template<typename ListenerPtr>
template<typename T , typename A , typename B , typename C , typename D , typename E , typename F >
void Sirikata::Provider< ListenerPtr >::notify ( func,
newA,
newB,
newC,
newD,
newE,
newF 
) [inline, protected]

This function notifies all listeners.

Listeners may add other listeners or remove themselves, though undefined behavior results from removing other listeners during the call.

Parameters:
funcwhich must be a member function of ListenerPtr gets called on all listeners
newAis the first argument passed to func
newBis the second argument passed to func
newCis the third argument passed to func
newDis the fourth argument passed to func
newEis the fifth argument passed to func
newFis the sixth argument passed to func
template<typename ListenerPtr>
template<typename T , typename A , typename B , typename C , typename D , typename E >
void Sirikata::Provider< ListenerPtr >::notify ( func,
newA,
newB,
newC,
newD,
newE 
) [inline, protected]

This function notifies all listeners.

Listeners may add other listeners or remove themselves, though undefined behavior results from removing other listeners during the call.

Parameters:
funcwhich must be a member function of ListenerPtr gets called on all listeners
newAis the first argument passed to func
newBis the second argument passed to func
newCis the third argument passed to func
newDis the fourth argument passed to func
newEis the fifth argument passed to func
template<typename ListenerPtr>
template<typename T , typename A , typename B , typename C , typename D >
void Sirikata::Provider< ListenerPtr >::notify ( func,
newA,
newB,
newC,
newD 
) [inline, protected]

This function notifies all listeners.

Listeners may add other listeners or remove themselves, though undefined behavior results from removing other listeners during the call.

Parameters:
funcwhich must be a member function of ListenerPtr gets called on all listeners
newAis the first argument passed to func
newBis the second argument passed to func
newCis the third argument passed to func
newDis the fourth argument passed to func
template<typename ListenerPtr>
template<typename T , typename A , typename B >
void Sirikata::Provider< ListenerPtr >::notify ( func,
newA,
newB 
) [inline, protected]

This function notifies all listeners.

Listeners may add other listeners or remove themselves, though undefined behavior results from removing other listeners during the call.

Parameters:
funcwhich must be a member function of ListenerPtr gets called on all listeners
newAis the first argument passed to func
newBis the second argument passed to func
template<typename ListenerPtr>
template<typename T , typename A , typename B , typename C , typename D , typename E , typename F , typename G , typename H , typename I >
void Sirikata::Provider< ListenerPtr >::notify ( func,
newA,
newB,
newC,
newD,
newE,
newF,
newG,
newH,
newI 
) [inline, protected]

This function notifies all listeners.

Listeners may add other listeners or remove themselves, though undefined behavior results from removing other listeners during the call.

Parameters:
funcwhich must be a member function of ListenerPtr gets called on all listeners
newAis the first argument passed to func
newBis the second argument passed to func
newCis the third argument passed to func
newDis the fourth argument passed to func
newEis the fifth argument passed to func
newFis the sixth argument passed to func
newGis the seventh argument passed to func
newHis the eighth argument passed to func
newIis the eighth argument passed to func
template<typename ListenerPtr>
template<typename T , typename A , typename B , typename C , typename D , typename E , typename F , typename G >
void Sirikata::Provider< ListenerPtr >::notify ( func,
newA,
newB,
newC,
newD,
newE,
newF,
newG 
) [inline, protected]

This function notifies all listeners.

Listeners may add other listeners or remove themselves, though undefined behavior results from removing other listeners during the call.

Parameters:
funcwhich must be a member function of ListenerPtr gets called on all listeners
newAis the first argument passed to func
newBis the second argument passed to func
newCis the third argument passed to func
newDis the fourth argument passed to func
newEis the fifth argument passed to func
newFis the sixth argument passed to func
newGis the seventh argument passed to func
template<typename ListenerPtr>
template<typename T >
void Sirikata::Provider< ListenerPtr >::notify ( func) [inline, protected]
template<typename ListenerPtr>
template<typename T , typename A , typename B , typename C >
void Sirikata::Provider< ListenerPtr >::notify ( func,
newA,
newB,
newC 
) [inline, protected]

This function notifies all listeners.

Listeners may add other listeners or remove themselves, though undefined behavior results from removing other listeners during the call.

Parameters:
funcwhich must be a member function of ListenerPtr gets called on all listeners
newAis the first argument passed to func
newBis the second argument passed to func
newCis the third argument passed to func
template<typename ListenerPtr>
template<typename T , typename A >
void Sirikata::Provider< ListenerPtr >::notify ( func,
newA 
) [inline, protected]

This function notifies all listeners.

Listeners may add other listeners or remove themselves, though undefined behavior results from removing other listeners during the call.

Parameters:
funcwhich must be a member function of ListenerPtr gets called on all listeners
newAis the singular argument passed to func
template<typename ListenerPtr>
virtual void Sirikata::Provider< ListenerPtr >::removeListener ( ListenerPtr  p) [inline, virtual]

This function removes a listener from listening for notification This may be called during a notify call on the currently notified listener only.

Referenced by Sirikata::Graphics::OgreSystem::stop(), Sirikata::Environment::stop(), Sirikata::Command::HttpCommander::~HttpCommander(), Sirikata::LocationService::~LocationService(), Sirikata::Graphics::OgreSystemInputHandler::~OgreSystemInputHandler(), and Sirikata::Proximity::~Proximity().


Member Data Documentation

template<typename ListenerPtr>
ListenerMap Sirikata::Provider< ListenerPtr >::mListenerIndex [protected]

A map from listener pointers to indexes in the listeners vector.

Referenced by Sirikata::Provider< EntityListener * >::addListener(), and Sirikata::Provider< EntityListener * >::removeListener().

template<typename ListenerPtr>
ListenerVector Sirikata::Provider< ListenerPtr >::mListeners [protected]

The documentation for this class was generated from the following file: