OMK::EventAssociationList Class Reference

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

#include <OMKEventAssociationList.h>

Collaboration diagram for OMK::EventAssociationList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 EventAssociationList ()
 constructor
virtual ~EventAssociationList ()
 destructor
virtual Eventremove (Event *)
 remove event from the list of assocations
virtual void associate (Event *, Event *)
 add an association to the list

Protected Attributes

std::list< std::pair< Event *,
Event * > > 
_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 32 of file OMKEventAssociationList.h.


Constructor & Destructor Documentation

EventAssociationList::EventAssociationList (  ) 

constructor

Definition at line 23 of file OMKEventAssociationList.cpp.

00024 {
00025 
00026 }

EventAssociationList::~EventAssociationList (  )  [virtual]

destructor

Definition at line 28 of file OMKEventAssociationList.cpp.

00029 {
00030 
00031 }


Member Function Documentation

Event * EventAssociationList::remove ( Event  )  [virtual]

remove event from the list of assocations

Returns:
the eventual associated event

Definition at line 33 of file OMKEventAssociationList.cpp.

References _associatedEventList.

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

void EventAssociationList::associate ( Event ,
Event  
) [virtual]

add an association to the list

Definition at line 62 of file OMKEventAssociationList.cpp.

References _associatedEventList.

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


Member Data Documentation

std::list<std::pair<Event *,Event * > > OMK::EventAssociationList::_associatedEventList [protected]

Definition at line 49 of file OMKEventAssociationList.h.

Referenced by associate(), and remove().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:01 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007