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

PsChangedControlParameterEventListener< Type > Class Template Reference

the base event listener for reacting to proposed changes to a control parameter implementing default behaviour the last suggested change arriving to the object is enacted More...

#include <PsChangedControlParameterEventListener.h>

Inheritance diagram for PsChangedControlParameterEventListener< Type >:

Inheritance graph
[legend]
Collaboration diagram for PsChangedControlParameterEventListener< Type >:

Collaboration graph
[legend]
List of all members.

Public Methods

 PsChangedControlParameterEventListener (PsSimulatedObject &owner, PsControlParameter< Type > &associatedControlParameter)
 constructor

virtual ~PsChangedControlParameterEventListener ()
 destructor

virtual void registerEvents ()
 redefine to register the event emitted by the control parameter when new values are suggested

virtual bool processEvent (PsEvent *event)
 process the suggested changes


Protected Methods

virtual void setControlParameter (const Type &newValue)
 enforce newValue as a value for the associatedControlParameter


Protected Attributes

PsControlParameter< Type > & _associatedControlParameter
 the control parameter this event listener is montoring the change of


Detailed Description

template<typename Type>
class PsChangedControlParameterEventListener< Type >

the base event listener for reacting to proposed changes to a control parameter implementing default behaviour the last suggested change arriving to the object is enacted

Author:
David Margery (last revision by )
Version:
1.0 (revision )

Definition at line 29 of file PsChangedControlParameterEventListener.h.


Constructor & Destructor Documentation

template<typename Type>
PsChangedControlParameterEventListener< Type >::PsChangedControlParameterEventListener PsSimulatedObject   owner,
PsControlParameter< Type > &    associatedControlParameter
 

constructor

Parameters:
owner owner of the event listener associatedControlParameter the control parameter this event listener is listening for

Definition at line 61 of file PsChangedControlParameterEventListener.h.

00063                                                                                               :
00064    PsEventListener ( owner ),
00065    _associatedControlParameter( associatedControlParameter )
00066 {
00067 
}

template<typename Type>
PsChangedControlParameterEventListener< Type >::~PsChangedControlParameterEventListener   [virtual]
 

destructor

Definition at line 73 of file PsChangedControlParameterEventListener.h.

00075 {
00076 


Member Function Documentation

template<typename Type>
bool PsChangedControlParameterEventListener< Type >::processEvent PsEvent   event [virtual]
 

process the suggested changes

Implements PsEventListener.

Definition at line 87 of file PsChangedControlParameterEventListener.h.

References PsChangedControlParameterEventListener< Type >::setControlParameter(), and PsValuedEvent< UserType >::value.

00089 {
00090    PsValuedEvent<Type > * realEvent = dynamic_cast<PsValuedEvent<Type > *>(event) ;
00091    assert ( realEvent != NULL );
00092    setControlParameter ( realEvent->value ) ;
00093    return true ;

template<typename Type>
void PsChangedControlParameterEventListener< Type >::registerEvents   [virtual]
 

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

Reimplemented from PsEventListener.

Definition at line 80 of file PsChangedControlParameterEventListener.h.

References PsChangedControlParameterEventListener< Type >::_associatedControlParameter, PsEventListener::_owner, and PsSimulatedObject::registerEventListenerForEvent().

00082 {
00083    _owner.registerEventListenerForEvent ( *this, _associatedControlParameter.getAssociatedEventId() ) ;

template<typename Type>
void PsChangedControlParameterEventListener< Type >::setControlParameter const Type &    newValue [protected, virtual]
 

enforce newValue as a value for the associatedControlParameter

Definition at line 97 of file PsChangedControlParameterEventListener.h.

References PsChangedControlParameterEventListener< Type >::_associatedControlParameter.

Referenced by PsChangedControlParameterEventListener< Type >::processEvent().

00099 {
00100    _associatedControlParameter.realSet ( value ) ;
00101 


Member Data Documentation

template<typename Type>
PsControlParameter<Type>& PsChangedControlParameterEventListener< Type >::_associatedControlParameter [protected]
 

the control parameter this event listener is montoring the change of

Definition at line 53 of file PsChangedControlParameterEventListener.h.

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


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

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

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