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

PsnEventAssociationList Class Reference

the class used to implement pointer correpondance between associated events More...

#include <PsnEventAssociationList.h>

Collaboration diagram for PsnEventAssociationList:

Collaboration graph
[legend]
List of all members.

Public Methods

 PsnEventAssociationList ()
 constructor

virtual ~PsnEventAssociationList ()
 destructor

virtual PsEventremove (PsEvent *)
 remove event from the list of assocations

virtual void associate (PsEvent *,PsEvent *)
 add an association to the list


Protected Attributes

list< pair< PsEvent *, PsEvent * > > _associatedEventList

Detailed Description

the class used to implement pointer correpondance between associated events

Author:
David Margery
Version:
1.0 : functional but not optimised

Definition at line 30 of file PsnEventAssociationList.h.


Constructor & Destructor Documentation

PsnEventAssociationList::PsnEventAssociationList  
 

constructor

Definition at line 20 of file PsnEventAssociationList.cxx.

00021 {
00022 
00023 }

PsnEventAssociationList::~PsnEventAssociationList   [virtual]
 

destructor

Definition at line 25 of file PsnEventAssociationList.cxx.

00026 {
00027 
00028 }


Member Function Documentation

void PsnEventAssociationList::associate PsEvent  ,
PsEvent  
[virtual]
 

add an association to the list

Definition at line 59 of file PsnEventAssociationList.cxx.

References _associatedEventList, and list< pair< PsEvent *, PsEvent * > >::push_front().

00060 {
00061    //push_front because it will probably be the next removed element and that removal starts at the beginning of the list
00062    _associatedEventList.push_front( pair<PsEvent *,PsEvent * > (evt1, evt2) ) ;
00063 }

PsEvent * PsnEventAssociationList::remove PsEvent   [virtual]
 

remove event from the list of assocations

Returns:
the eventual associated event

Definition at line 30 of file PsnEventAssociationList.cxx.

References _associatedEventList, list< pair< PsEvent *, PsEvent * > >::begin(), list< pair< PsEvent *, PsEvent * > >::end(), and list< pair< PsEvent *, PsEvent * > >::erase().

00031 {
00032    PsEvent * result = NULL ;
00033    list<pair<PsEvent *,PsEvent * > >::iterator i = _associatedEventList.begin() ;
00034    list<pair<PsEvent *,PsEvent * > >::iterator toRemove ;
00035    while (i != _associatedEventList.end() )
00036       {
00037          if ( i->first = event) 
00038             {
00039                result = i->second ;
00040                toRemove = i ;
00041                i = _associatedEventList.end() ;
00042                _associatedEventList.erase (toRemove) ;
00043             }
00044          else if ( i->second = event )
00045             {
00046                result = i->first ;
00047                toRemove = i ;
00048                i = _associatedEventList.end() ;
00049                _associatedEventList.erase (toRemove) ;
00050             }
00051          else 
00052             {
00053                i++ ;
00054             }
00055       }
00056    return result ;
00057 }


Member Data Documentation

list<pair<PsEvent *,PsEvent * > > PsnEventAssociationList::_associatedEventList [protected]
 

Definition at line 46 of file PsnEventAssociationList.h.

Referenced by associate(), and remove().


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

Documentation generated on Mon Nov 25 15:25:59 2002

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