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

Interactions between classes of CEHTL

interactionsBasic.gif

Figure 1

Basic use (Fig. 1):

You have a certain data "packet" that you want to send to interested listeners. In the diagram, it is the YourEvent class. It is typically a struct with a bunch of const data members and a constructor to initialize them.

Listener< EvType > is an abstract base class template. Your class interested in YourEvent events, called YourListener in Fig. 1, derives from this abstract base class (with the template parameter EvType = YourEvent). Listener< EvType > provides a virtual method, processEvent(const EvType&), to be overriden in YourListener, and provides other concrete methods useful to listeners.

EventSender< EvType > is the dispatcher. It accepts registration by classes that inherit from Listener< EvType >, i.e. objects interested in EvType. It also dispatches EvType events to those listeners when EventSender< EvType>::send(const EvType&) is called.

If one of your listeners for EvType events causes another EvType event to be generated as a consequence of a first EvType being generated, a EventSender< EvType>::IllegalSendError exception will be thrown by the EventSender< EvType>::send() method mentioned above.

More "advanced" uses:

interactionsStamp.gif

Figure 2

interactionsPoly.gif

Figure 3


Generated on Sun Feb 16 16:56:24 2003 for C++ Event Handling Template Library by doxygen1.2.18