grinliz::Publisher< LISTENER_CLASS > Class Template Reference

#include <glpublisher.h>

List of all members.


Detailed Description

template<class LISTENER_CLASS>
class grinliz::Publisher< LISTENER_CLASS >

A Publisher communicates to a Listener by calling its methods. If a publisher is deleted, it will clear the pointers to its listener, and if a listener is deleted it will clear the pointes to its publisher. Therefore they can have independent lifespans.

A publisher is aggregated into the class that wants to publish:

	class Switch
	{
		Publisher<SwitchListener> publish; 	
	}
	


Public Types

typedef std::set< LISTENER_CLASS
* >::const_iterator 
const_iterator
 Used to iterate through the listeners.

Public Member Functions

void AddListener (LISTENER_CLASS *add)
 Add a listener.
void RemoveListener (LISTENER_CLASS *remove)
const_iterator begin ()
const_iterator end ()
 An iterator for the publisher to emit messages.


Member Function Documentation

template<class LISTENER_CLASS>
void grinliz::Publisher< LISTENER_CLASS >::RemoveListener ( LISTENER_CLASS *  remove  )  [inline]

Remove a listener. This is safe to call at any time, even during a callback.

template<class LISTENER_CLASS>
const_iterator grinliz::Publisher< LISTENER_CLASS >::begin (  )  [inline]

An iterator for the publisher to emit messages. The code usually looks like:

		for( Publisher<SwitchListener>::const_iterator it = publish.begin();
			 it != publish.end();
			 ++it )
		{
			(*it)->Click();
		}
		


The documentation for this class was generated from the following file:
Generated on Fri Mar 23 19:36:26 2007 for Lilith3D by  doxygen 1.5.1-p1