Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::EventSource< T > Class Template Reference

#include <Event.h>

Inheritance diagram for util::EventSource< T >:

util::Object List of all members.

Detailed Description

template<class T>
class util::EventSource< T >

EventSource provides convenient means of adding, removing and notifying event listeners.


Public Methods

void addEventListener (EventListener< T > *listener)
 Add a new event listener.

void removeEventListener (EventListener< T > *listener)
 Remove an event listener.


Protected Methods

void fireEvent (const T &event)
 Notify all registered event listeners.

void fireEvent (const T *event)
 Notify all registered event listeners.


Member Function Documentation

template<class T>
void util::EventSource< T >::addEventListener EventListener< T > *    listener
 

Add a new event listener.

The new listener is added only if it is not in the listener list already. The listener will be notified whenever an event is fired.

Parameters:
listener  a pointer to a class that inherits EventListener

template<class T>
void util::EventSource< T >::fireEvent const T *    event [protected]
 

Notify all registered event listeners.

Parameters:
event  a pointer to the event to be fired. The event is automatically deleted upon the exit of this method.

template<class T>
void util::EventSource< T >::fireEvent const T &    event [protected]
 

Notify all registered event listeners.

Parameters:
event  the event to fire

template<class T>
void util::EventSource< T >::removeEventListener EventListener< T > *    listener
 

Remove an event listener.

The removed listener will get no further notifications of the events happened.

Parameters:
listener  a pointer to a class that inherits EventListener


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.