Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

Dispatcher:

sometimes it is quite handy to bundle a set of interfaces and to forward objects to all of them with a single call. the Dispatcher makes this easy providing means of registering and unregistering the receivers' interface.

 

There are 2 types of Dispatchers. the Dispatchable<T> interface based Dispatcher<T> and the Callback1<const T&> based DispatcherCB<T>. while Dispatcher<T> is probably a bit faster, DispatcherCB<T> is more flexible, because you can use whatever member function of your class to register (as long as it fits the parameter list).

 

Take a look at the diverse Test applications to find out what case best fits for you.

 

template <class T>

class Dispatcher : public EnableOption<> 

a class that can forward T to registered receivers (Dispatchable<T>)

 


 

void DoDispatch(const T & oconst

Entrance point for the Dispatcher, will forward object o.to all registered Dispatchable<T> interfaces

 


 

void Register(Dispatchable<T> & d, unsigned key = 0)

register Dispatchable<T> interface d using key.(if not specified, GetPtrHashValue will be used from d)

 

 


 

void Unregister(Dispatchable<T> & d, unsigned key = 0)

unregisters d using key.(if not specified, GetPtrHashValue will be used from d)

 


 

Dispatchable<T> * GetDispatchable(unsigned keyconst

find the key.respective Dispatchable<T> interface

 


 

const VectorMap<unsigned, Dispatchable<T> * > & GetDests() const

Get all destinations

 


 

void Clear()

Clears the Dispatcher, no destinations present

 

 

Do you want to contribute?