Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

EventSender< EvType >::IllegalSendError Class Reference

#include <IllegalSendError.hh>

List of all members.

Public Methods

 IllegalSendError ()
 Create the exception.


Detailed Description

template<typename EvType>
class EventSender< EvType >::IllegalSendError

An exception that gets thrown when EventSender<EvType>::send() is called recursively at least once. This situation is more likely in complex systems where events cause other events to be generated.

An example scenario is where you create an Type1Event and call EventSender<Type1Event>::send(Type1Event). This call to send() in turn calls the processEvent() method of a listener of Type1Event's. If this listener's method creates another Type1Event and calls EventSender<Type1Event>::send(Type1Event) on it, this will cause that listener's processEvent() to be called once more, and the process repeats. This is likely to trigger an infinite loop of event generation. The only case where this would not happen is if the listener keeps state information that changes between successive calls to processEvent(), such that it does not generate an event during one of those calls (the recursion ends), or if this listener deregister's itself from listening.

Since an infinite recursion is likely to cause a program crash, and since it is quite easy to make that kind of mistake, EventSender<EvType> forbids calling send() while a send() (for that event type) is in progress. It will throw a EventSender<EvType>::IllegalSendError if such a situation occurs.

Author:
Oliver Schoenborn
Since:
Sept 2002

Definition at line 60 of file IllegalSendError.hh.


The documentation for this class was generated from the following file:
Generated on Sun Feb 16 16:56:24 2003 for C++ Event Handling Template Library by doxygen1.2.18