Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PsEventListener Class Reference

The base class for event listener, wich enable automatic reaction on registred events. More...

#include <PsEventListener.h>

Inheritance diagram for PsEventListener:

Inheritance graph
[legend]
Collaboration diagram for PsEventListener:

Collaboration graph
[legend]
List of all members.

Public Methods

 PsEventListener (PsSimulatedObject &owner)
 constructor

virtual ~PsEventListener ()
 destructor

virtual void registerEvents ()
 member function used to register the events the event listener has to react to

virtual bool processEvent (PsEvent *event)=0
 process an event :

virtual void prepareEventProcessing (const list< PsEvent * > &, list< PsEvent * >::const_iterator)
 called before processEvent, in case the event listener has to take more than one event into account

void addToListenedEventIds (const PsEventIdentifier &)
 remember this event listener is listening to (called by the objectHandle)

const list< PsEventIdentifier > & getListenedEventIds () const
 get the list of listened events Ids


Protected Attributes

PsSimulatedObject_owner
 the simulated object the event listener is acting in hehalf of

list< PsEventIdentifier_listenedEventIds
 the list of event Ids the event listener is listening to


Detailed Description

The base class for event listener, wich enable automatic reaction on registred events.

Definition at line 29 of file PsEventListener.h.


Constructor & Destructor Documentation

PsEventListener::PsEventListener PsSimulatedObject   owner
 

constructor

Parameters:
owner : the simulated object this event listener is reacting in behalf of

Definition at line 20 of file PsEventListener.cxx.

00020                                                             :
00021    _owner ( owner ) 
00022 {
00023 }

PsEventListener::~PsEventListener   [virtual]
 

destructor

Definition at line 26 of file PsEventListener.cxx.

00027 {
00028 }


Member Function Documentation

void PsEventListener::addToListenedEventIds const PsEventIdentifier  
 

remember this event listener is listening to (called by the objectHandle)

Definition at line 42 of file PsEventListener.cxx.

References _listenedEventIds, and list< PsEventIdentifier >::push_back().

Referenced by PsSimulatedObject::registerEventListenerForEvent().

00043 {
00044    _listenedEventIds.push_back( eventId ) ;
00045 }

const list< PsEventIdentifier > & PsEventListener::getListenedEventIds   const
 

get the list of listened events Ids

Definition at line 36 of file PsEventListener.cxx.

References _listenedEventIds.

00037 {
00038    return _listenedEventIds ;
00039 }

void PsEventListener::prepareEventProcessing const list< PsEvent * > &   ,
list< PsEvent * >::const_iterator   
[virtual]
 

called before processEvent, in case the event listener has to take more than one event into account

Definition at line 30 of file PsEventListener.cxx.

00031                                                                                    {
00032 
00033 }

virtual bool PsEventListener::processEvent PsEvent   event [pure virtual]
 

process an event :

Returns:
returning true will 1 - stop the event from being processed by any other eventlistener or by the object 2 - tell the system to destroy the event
if you want to prevent the event from being seen by the other eventListeners but want it seen by the object, call owner.processEvent and return true. Warning, if owner.processEvent returns false, you have a problem because the event will be destoyed whilst the owner is thinking he can still use it safely

Implemented in PsChangedControlParameterEventListener< Type >, and PsInputConnectionEventListener< Type >.

void PsEventListener::registerEvents   [virtual]
 

member function used to register the events the event listener has to react to

Reimplemented in PsChangedControlParameterEventListener< Type >, and PsInputConnectionEventListener< Type >.

Definition at line 47 of file PsEventListener.cxx.

00048 {
00049    //don't do anything, as we don't know to which event we will be associated to
00050 }


Member Data Documentation

list<PsEventIdentifier> PsEventListener::_listenedEventIds [protected]
 

the list of event Ids the event listener is listening to

Definition at line 68 of file PsEventListener.h.

Referenced by addToListenedEventIds(), and getListenedEventIds().

PsSimulatedObject& PsEventListener::_owner [protected]
 

the simulated object the event listener is acting in hehalf of

Definition at line 65 of file PsEventListener.h.

Referenced by PsInputConnectionEventListener< Type >::registerEvents(), and PsChangedControlParameterEventListener< Type >::registerEvents().


The documentation for this class was generated from the following files:
logo OpenMask

Documentation generated on Mon Nov 25 15:26:00 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001