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

PsSensitiveInput< Type > Class Template Reference

concrete class defining a sensitive input. More...

#include <PsSensitiveInput.h>

Inheritance diagram for PsSensitiveInput< Type >:

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

Collaboration graph
[legend]
List of all members.

Public Methods

 PsSensitiveInput (const PsName &inputName, PsSimulatedObject &owner, bool makeConnectable, const int precisionLevel=PsPolatorNT::defaultPrecisionLevel)
 Constructor.

virtual ~PsSensitiveInput (void)
 destructor

virtual void disconnect ()
 disconnect this input

virtual bool valueChanged (bool keepChanged=false)
 test to see if value has changed WARNING : this method isn't const : it only return's true once.

virtual void signalChange ()
 called by the connected output when it's value has changed


Protected Methods

virtual bool internalConnect (PsOutputNT *output)
 the real connecting member function


Detailed Description

template<typename Type>
class PsSensitiveInput< Type >

concrete class defining a sensitive input.

The template parameter must be of a derived type of PsType

See also:
PsType
Author:
David Margery
Version:
1.0

Definition at line 35 of file PsSensitiveInput.h.


Constructor & Destructor Documentation

template<typename Type>
PsSensitiveInput< Type >::PsSensitiveInput const PsName   inputName,
PsSimulatedObject   owner,
bool    makeConnectable,
const int    precisionLevel = PsPolatorNT::defaultPrecisionLevel
 

Constructor.

Parameters:
inputName the input name
owner the input owner
precisionLevel the degre of precision of any polation operation. The scale of this degree is meaningfull only on a polator level. The higher this degre, the more precise calculation should get.

Definition at line 87 of file PsSensitiveInput.h.

References PsnSensitiveInputNT::_changed.

00091    : PsInput<Type>(nom, prop, makeConnectable, requestedPrecisionLevel)
00092 {
00093    _changed = true ; 
00094  
00095 }

template<typename Type>
PsSensitiveInput< Type >::~PsSensitiveInput void    [virtual]
 

destructor

Definition at line 100 of file PsSensitiveInput.h.

References PsSensitiveInput< Type >::disconnect().

00101 {
00102 #ifdef _DEBUGALIAS
00103    cerr<<"destruction"<<endl;
00104 #endif
00105    disconnect ();
00106 }


Member Function Documentation

template<typename Type>
void PsSensitiveInput< Type >::disconnect   [inline, virtual]
 

disconnect this input

Reimplemented from PsInput< Type >.

Definition at line 151 of file PsSensitiveInput.h.

References PsInput< Type >::_connectedOutput, and PsInput< Type >::disconnect().

Referenced by PsSensitiveInput< Type >::~PsSensitiveInput().

00151                                                {
00152 #ifdef _DEBUGALIAS
00153    cerr<<"disconnected output  "<<_connectedOutput<<endl;
00154 #endif
00155    if (_connectedOutput!=NULL) {
00156       _connectedOutput->disconnectedMyself(this);
00157    }
00158 #ifdef _DEBUGALIAS
00159    cerr<<"output disconnected"<<endl;
00160 #endif
00161    PsInput<Type>::disconnect ();
00162 }

template<typename Type>
bool PsSensitiveInput< Type >::internalConnect PsOutputNT   output [inline, protected, virtual]
 

the real connecting member function

Parameters:
output a pointer to the real output to connect to
Returns:
connection was successfull

Definition at line 168 of file PsSensitiveInput.h.

References PsOutputNT::connectedMyself(), and PsInput< Type >::realConnect().

00168                                                                         {
00169    if ( PsInput<Type>::realConnect( output ) )
00170       {
00171          output->connectedMyself (this) ;
00172          return true ;
00173       }
00174    else 
00175       {
00176          return false ;
00177       }
00178 }

template<typename Type>
void PsSensitiveInput< Type >::signalChange   [inline, virtual]
 

called by the connected output when it's value has changed

Implements PsnSensitiveInputNT.

Reimplemented in PsSensitiveNotifyingInput< Type >.

Definition at line 120 of file PsSensitiveInput.h.

References PsnSensitiveInputNT::_changed, PsAbstractInput< Type >::_listOfAliases, list< PsInputAlias< Type > * >::begin(), list< PsInputAlias< Type > * >::end(), and PsnSensitiveInputNT::signalChange().

Referenced by PsSensitiveNotifyingInput< Type >::signalChange().

00121 {
00122 #ifdef _DEBUGALIAS
00123    cerr<<"PsSensitiveInput<Type>::signalChange()"<<endl;
00124 #endif
00125    _changed = true ;
00126 #ifdef _TYPENAMENOTIMPLICIT
00127    typename 
00128 #endif
00129    list<PsInputAlias<Type> *>::iterator i;
00130    for (i = _listOfAliases.begin();
00131         i != _listOfAliases.end();
00132         i++)
00133       { 
00134 #ifdef _DEBUGALIAS
00135          cerr<<"PsSensitiveInput<Type>::signalChange() : alias going to be notified of change "<<(*i)<<endl;
00136 #endif
00137          PsnSensitiveInputNT * sensitiveInput = dynamic_cast<PsnSensitiveInputNT *>(*i) ;
00138          if ( sensitiveInput != NULL ) 
00139             {
00140                sensitiveInput->signalChange();
00141             }
00142 #ifdef _DEBUGALIAS
00143          cerr<<"PsSensitiveInput<Type>::signalChange() : alias notified of change "<<endl;
00144 #endif
00145       }
00146 }

template<typename Type>
bool PsSensitiveInput< Type >::valueChanged bool    keepChanged = false [virtual]
 

test to see if value has changed WARNING : this method isn't const : it only return's true once.

Parameters:
keepChanged if true, next call to valueChanged during the same simualtion step will return the same result
Returns:
true is this is the first call to valueChanged since the connected output has changed

Implements PsnSensitiveInputNT.

Definition at line 109 of file PsSensitiveInput.h.

References PsnSensitiveInputNT::_changed.

00110 {
00111    if (_changed) {
00112       _changed = keepChanged ;
00113       return true;
00114    }
00115    else return false;
00116 }


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

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

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