OMK::InputConnectionEventListener< T > Class Template Reference

the base event listener for reacting to proposed connections by objects other than the owner of the concerned input the last suggested connection arriving to the object is enacted More...

#include <OMKInputConnectionEventListener.h>

Inheritance diagram for OMK::InputConnectionEventListener< T >:

Inheritance graph
[legend]
Collaboration diagram for OMK::InputConnectionEventListener< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 InputConnectionEventListener (SimulatedObject &owner, Input< T > *associatedInput)
 constructor
virtual ~InputConnectionEventListener ()
 destructor
virtual void registerEvents ()
 redefine to register the event emitted by the control parameter when new values are suggested
virtual bool processEvent (Event *event)
 process the suggested changes

Protected Attributes

Input< T > * _associatedInput
 the control parameter this event listener is montoring the change of

Detailed Description

template<typename T>
class OMK::InputConnectionEventListener< T >

the base event listener for reacting to proposed connections by objects other than the owner of the concerned input the last suggested connection arriving to the object is enacted

Author:
David Margery (last revision by
Author
chauffau
)
Version:
1.1 (revision
Revision
1.1.1.1
)

Definition at line 36 of file OMKInputConnectionEventListener.h.


Constructor & Destructor Documentation

template<typename T>
OMK::InputConnectionEventListener< T >::InputConnectionEventListener ( SimulatedObject owner,
Input< T > *  associatedInput 
)

constructor

Parameters:
owner owner of the event listener associatedInput input this event listener is listening in behalf of

Definition at line 66 of file OMKInputConnectionEventListener.h.

References OMK::EventListener::_owner, and OMK::SimulatedObject::addEventListener().

00069   : EventListener( owner ),
00070     _associatedInput( associatedInput )
00071 {
00072   _owner.addEventListener( *this ) ;     
00073 }

template<typename T>
OMK::InputConnectionEventListener< T >::~InputConnectionEventListener (  )  [virtual]

destructor

Definition at line 78 of file OMKInputConnectionEventListener.h.

00079 {
00080 }


Member Function Documentation

template<typename T>
void OMK::InputConnectionEventListener< T >::registerEvents (  )  [virtual]

redefine to register the event emitted by the control parameter when new values are suggested

Reimplemented from OMK::EventListener.

Definition at line 85 of file OMKInputConnectionEventListener.h.

References OMK::InputConnectionEventListener< T >::_associatedInput, OMK::EventListener::_owner, and OMK::SimulatedObject::registerEventListenerForEvent().

00086 {
00087   _owner.registerEventListenerForEvent(
00088     *this, _associatedInput->getConnectionEventId() ) ;
00089   _owner.registerEventListenerForEvent(
00090     *this, _associatedInput->getConnectionToControlParameterEventId() ) ;
00091 }

template<typename T>
bool OMK::InputConnectionEventListener< T >::processEvent ( Event event  )  [virtual]

process the suggested changes

Implements OMK::EventListener.

Definition at line 96 of file OMKInputConnectionEventListener.h.

References OMK::InputConnectionEventListener< T >::_associatedInput, OMK::Event::eventId, OMASSERT, OMK::Event::sender, and OMK::ValuedEvent< UserType >::value.

00097 {
00098   ValuedEvent< Name > * realEvent =
00099     dynamic_cast< ValuedEvent< Name > *>( event ) ;
00100   OMASSERT( realEvent != 0 ) ;
00101   if( realEvent->eventId == _associatedInput->getConnectionEventId() )
00102   {
00103     _associatedInput->connect( realEvent->sender, realEvent->value ) ;
00104   }
00105   else
00106   {
00107     _associatedInput->connectToControlParameter( realEvent->sender,
00108                                                  realEvent->value ) ;
00109   }
00110   return true ;
00111 }


Member Data Documentation

template<typename T>
Input< T >* OMK::InputConnectionEventListener< T >::_associatedInput [protected]

the control parameter this event listener is montoring the change of

Definition at line 57 of file OMKInputConnectionEventListener.h.

Referenced by OMK::InputConnectionEventListener< T >::processEvent(), and OMK::InputConnectionEventListener< T >::registerEvents().


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007