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

PsAbstractInput< Type > Class Template Reference

class PsAbstractInput More...

#include <PsAbstractInput.h>

Inheritance diagram for PsAbstractInput< Type >:

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

Collaboration graph
[legend]
List of all members.

Public Methods

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

virtual ~PsAbstractInput (void)
 Destructor.

virtual bool connect (const PsName &objectName, const PsName &outputName)=0
 connect this input to the output of an other simulated object.

virtual bool connect (PsSimulatedObject &object, const PsName &outputName)=0
 connect this input to the output of an other simulated object.

virtual bool connect (PsSimulatedObject *pointerToObject, const PsName &outputName)=0
 connect this input to the output of an other simulated object.

virtual bool connect (const PsName &objectName, const PsName &outputName, const Type &initialValue)=0
 connect this input to the output of an other object, and propose an initial value in case the output hasn't been initialised yet.

virtual bool connect (PsSimulatedObject &object, const PsName &outputName, const Type &initialValue)=0
 connect this input to the output of an other object, and propose an initial value in case the output hasn't been initialised yet.

virtual bool connect (PsSimulatedObject *pointerToObject, const PsName &outputName, const Type &initialValue)=0
 connect this input to the output of an other object, and propose an initial value in case the output hasn't been initialised yet.

virtual bool connectToControlParameter (const PsName &objectName, const PsName &controlParameterName)=0
 connect this input to a control parameter of an other simulated object.

virtual bool connectToControlParameter (PsSimulatedObject &object, const PsName &controlParameterName)=0
 connect this input to the controlParameter of an other simulated object.

virtual bool connectToControlParameter (PsSimulatedObject *pointerToObject, const PsName &controlParameterName)=0
 connect this input to the controlParameter of an other simulated object.

virtual bool connectToControlParameter (const PsName &objectName, const PsName &controlParameterName, const Type &initialValue)=0
 connect this input to a control parameter of an other object, and propose an initial value in case the controlParameter hasn't been initialised yet.

virtual bool connectToControlParameter (PsSimulatedObject &object, const PsName &controlParameterName, const Type &initialValue)=0
 connect this input to a control parameter of an other object, and propose an initial value in case the controlParameter hasn't been initialised yet.

virtual bool connectToControlParameter (PsSimulatedObject *pointerToObject, const PsName &controlParameterName, const Type &initialValue)=0
 connect this input to a control parameter of an other object, and propose an initial value in case the controlParameter hasn't been initialised yet.

virtual bool isConnectable () const
 isConnectable.

virtual void setConnectable (bool nextConnectableState)
 setConnectable.

virtual const PsOutputNTgetConnectedOutput () const=0
 get a pointer to output this input is connected to

const PsEventIdentifiergetConnectionEventId () const
 get the connection event ID

const PsEventIdentifiergetConnectionToControlParameterEventId () const
 get the connection event ID, when the connection request comes from a control parameter

virtual const Type & get (int deltaT=0)=0
 get a value from this input

virtual int getDistanceToExactValue () const=0
 get distance to exact value.

virtual const Type & getLastExactValue () const=0
 get the last exact value.

virtual const PsDategetDateOfLastExactValue () const=0
 get the date of the last exact value.

virtual void printDebuggingInformation (ostream &err) const=0
 print any usefull debugging information for this input

virtual int getPrecisionLevel () const
 get the polation level used by this input

virtual int setPrecisionLevel (const int newValue)
 change the polation level of this input

virtual void notifyAliasing (PsInputAlias< Type > *aliasingInputAlias)
 called when this input is aliased

virtual void notifyUnaliasing (PsInputAlias< Type > *aliasingInputAlias)
 called when this input is no longer aliased


Protected Attributes

list< PsInputAlias< Type > * > _listOfAliases
 list of aliases of this input

int _precisionLevel
 precision level asked for when a value is fetched from the connected output

bool _connectable
 can simulated objects other than the owner change the connection of this input

const PsEventIdentifier _connectionEventId
 the connection event Identifier

const PsEventIdentifier _connectionToControlParameterEventId
 the connection event Identifier


Detailed Description

template<class Type>
class PsAbstractInput< Type >

class PsAbstractInput

Author:
: Olivier Filangi
Version:
: 1.4

Definition at line 36 of file PsAbstractInput.h.


Constructor & Destructor Documentation

template<typename Type>
PsAbstractInput< Type >::PsAbstractInput const PsName   inputName,
PsSimulatedObject   owner,
bool    makeConnectable,
const int    precisionLevel = PsPolatorNT::defaultPrecisionLevel
[inline]
 

Constructor.

Parameters:
inputName the input name
owner the input owner
makeConnectable true is this input must accept connection requests originating from other simulated objects than it's 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 257 of file PsAbstractInput.h.

References PsInputNT::registerMe().

00262    : PsInputNT ( owner, inputName ),
00263      _precisionLevel ( precisionLevel ),
00264      _connectable ( makeConnectable ),
00265      _connectionEventId ( PsString("newConnection ") + inputName ),
00266      _connectionToControlParameterEventId ( PsString("newConnectionToControlParameter ") + inputName )
00267 {
00268 #ifdef _DEBUGTYPEUTIL
00269   cout << "PsAbstractInput<Type>::PsAbstractInput --> constructeur " << endl;
00270 #endif
00271   registerMe () ; 

template<typename Type>
PsAbstractInput< Type >::~PsAbstractInput void    [inline, virtual]
 

Destructor.

Definition at line 276 of file PsAbstractInput.h.

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

00278 {
00279 #ifdef _TYPENAMENOTIMPLICIT
00280    typename 
00281 #endif
00282    list<PsInputAlias<Type> *>::iterator i;
00283    for (i=_listOfAliases.begin();i!=_listOfAliases.end();i++) 
00284       {
00285          (*i)->inputAliasedDeleted();
00286       }


Member Function Documentation

template<typename Type>
bool PsAbstractInput< Type >::connect PsSimulatedObject   pointerToObject,
const PsName   outputName,
const Type &    initialValue
[inline, pure virtual]
 

connect this input to the output of an other object, and propose an initial value in case the output hasn't been initialised yet.

Parameters:
pointerToObject the object owning outputName
outputName the name of the output to be connected to
initialValue the proposed initial value to the output if it isn't initialised
Returns:
bool connecting successfull

Implemented in PsInput< Type >, and PsInputAlias< Type >.

Definition at line 389 of file PsAbstractInput.h.

References PsAbstractInput< Type >::connect(), and PsAbstractInput< Type >::printDebuggingInformation().

00393 {
00394    if ( pointerToObject != NULL )
00395       {
00396          return connect (*pointerToObject, outputName, initialValue) ;
00397       }
00398    else
00399       {
00400          cerr<<"PsAbstractInput<Type>::connect : got NULL pointer"<<endl;
00401          printDebuggingInformation ( cerr ) ;
00402          return false ;
00403       } 

template<class Type>
virtual bool PsAbstractInput< Type >::connect PsSimulatedObject   object,
const PsName   outputName,
const Type &    initialValue
[pure virtual]
 

connect this input to the output of an other object, and propose an initial value in case the output hasn't been initialised yet.

Parameters:
object the object owning outputName
outputName the name of the output to be connected to
initialValue the proposed initial value to the output if it isn't initialised
Returns:
bool connecting successfull

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<class Type>
virtual bool PsAbstractInput< Type >::connect const PsName   objectName,
const PsName   outputName,
const Type &    initialValue
[pure virtual]
 

connect this input to the output of an other object, and propose an initial value in case the output hasn't been initialised yet.

Parameters:
objectName the object owning outputName
outputName the name of the output to be connected to
initialValue the proposed initial value to the output if it isn't initialised
Returns:
bool connecting successfull

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<typename Type>
bool PsAbstractInput< Type >::connect PsSimulatedObject   pointerToObject,
const PsName   outputName
[inline, pure virtual]
 

connect this input to the output of an other simulated object.

Parameters:
pointerToObject the object owning outputName
outputName the name of the output to be connected to
Returns:
bool connection successfull

Implements PsInputNT.

Implemented in PsInput< Type >, and PsInputAlias< Type >.

Definition at line 371 of file PsAbstractInput.h.

References PsAbstractInput< Type >::connect(), and PsAbstractInput< Type >::printDebuggingInformation().

00374 {
00375    if ( pointerToObject != NULL )
00376       {
00377          return connect (*pointerToObject, outputName) ;
00378       }
00379    else
00380       {
00381          cerr<<"PsAbstractInput<Type>::connect : got NULL pointer"<<endl;
00382          printDebuggingInformation ( cerr ) ;
00383          return false ;
00384       } 

template<class Type>
virtual bool PsAbstractInput< Type >::connect PsSimulatedObject   object,
const PsName   outputName
[pure virtual]
 

connect this input to the output of an other simulated object.

Parameters:
pointerToObject the object owning outputName
outputName the name of the output to be connected to
Returns:
bool connection successfull

Implements PsInputNT.

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<class Type>
virtual bool PsAbstractInput< Type >::connect const PsName   objectName,
const PsName   outputName
[pure virtual]
 

connect this input to the output of an other simulated object.

Parameters:
objectName the object owning outputName
outputName the name of the output to be connected to
Returns:
bool connecting successfull

Implements PsInputNT.

Implemented in PsInput< Type >, and PsInputAlias< Type >.

Referenced by PsInputAlias< Type >::connect(), PsInput< Type >::connect(), and PsAbstractInput< Type >::connect().

template<typename Type>
bool PsAbstractInput< Type >::connectToControlParameter PsSimulatedObject   pointerToObject,
const PsName   controlParameterName,
const Type &    initialValue
[inline, pure virtual]
 

connect this input to a control parameter of an other object, and propose an initial value in case the controlParameter hasn't been initialised yet.

Parameters:
pointerToObject the object owning outputName
controlParameterName the name of the control parameter to be connected to
initialValue the proposed initial value to the output if it isn't initialised
Returns:
bool connecting successfull

Implemented in PsInput< Type >, and PsInputAlias< Type >.

Definition at line 426 of file PsAbstractInput.h.

References PsAbstractInput< Type >::connectToControlParameter(), and PsAbstractInput< Type >::printDebuggingInformation().

00430 {
00431    if ( pointerToObject != NULL )
00432       {
00433          return connectToControlParameter (*pointerToObject, outputName, initialValue) ;
00434       }
00435    else
00436       {
00437          cerr<<"PsAbstractInput<Type>::connect : got NULL pointer"<<endl;
00438          printDebuggingInformation ( cerr ) ;
00439          return false ;
00440       } 

template<class Type>
virtual bool PsAbstractInput< Type >::connectToControlParameter PsSimulatedObject   object,
const PsName   controlParameterName,
const Type &    initialValue
[pure virtual]
 

connect this input to a control parameter of an other object, and propose an initial value in case the controlParameter hasn't been initialised yet.

Parameters:
object the object owning outputName
controlParameterName the name of the control parameter to be connected to
initialValue the proposed initial value to the output if it isn't initialised
Returns:
bool connecting successfull

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<class Type>
virtual bool PsAbstractInput< Type >::connectToControlParameter const PsName   objectName,
const PsName   controlParameterName,
const Type &    initialValue
[pure virtual]
 

connect this input to a control parameter of an other object, and propose an initial value in case the controlParameter hasn't been initialised yet.

Parameters:
objectName the object owning outputName
controlParameter the name of the controlParameter to be connected to
initialValue the proposed initial value to the output if it isn't initialised
Returns:
bool connecting successfull

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<typename Type>
bool PsAbstractInput< Type >::connectToControlParameter PsSimulatedObject   pointerToObject,
const PsName   controlParameterName
[inline, pure virtual]
 

connect this input to the controlParameter of an other simulated object.

Parameters:
pointerToObject the object owning controlParameterName
controlParameterName the name of the output to be connected to
Returns:
bool connection successfull

Implemented in PsInput< Type >, and PsInputAlias< Type >.

Definition at line 408 of file PsAbstractInput.h.

References PsAbstractInput< Type >::connectToControlParameter(), and PsAbstractInput< Type >::printDebuggingInformation().

00411 {
00412    if ( pointerToObject != NULL )
00413       {
00414          return connectToControlParameter (*pointerToObject, outputName) ;
00415       }
00416    else
00417       {
00418          cerr<<"PsAbstractInput<Type>::connect : got NULL pointer"<<endl;
00419          printDebuggingInformation ( cerr ) ;
00420          return false ;
00421       } 

template<class Type>
virtual bool PsAbstractInput< Type >::connectToControlParameter PsSimulatedObject   object,
const PsName   controlParameterName
[pure virtual]
 

connect this input to the controlParameter of an other simulated object.

Parameters:
object the object owning controlParameterName
controlParameterName the name of the output to be connected to
Returns:
bool connection successfull

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<class Type>
virtual bool PsAbstractInput< Type >::connectToControlParameter const PsName   objectName,
const PsName   controlParameterName
[pure virtual]
 

connect this input to a control parameter of an other simulated object.

Parameters:
objectName the object owning controlParameterName
controlParameterName the name of the output to be connected to
Returns:
bool connecting successfull

Implemented in PsInput< Type >, and PsInputAlias< Type >.

Referenced by PsInputAlias< Type >::connectToControlParameter(), PsInput< Type >::connectToControlParameter(), and PsAbstractInput< Type >::connectToControlParameter().

template<class Type>
virtual const Type& PsAbstractInput< Type >::get int    deltaT = 0 [pure virtual]
 

get a value from this input

Parameters:
delta the delay between the current date and the date of the value expected. If this delay is negative, a value in the future will be calculated.
Returns:
a reference to the value asked for, wich could be an exact value or an approximation calculated by the plugged output's polator. The status of the value can be querried through the getDistanceToExactValue() member function

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<class Type>
virtual const PsOutputNT* PsAbstractInput< Type >::getConnectedOutput   const [pure virtual]
 

get a pointer to output this input is connected to

Implements PsInputNT.

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<typename Type>
const PsEventIdentifier & PsAbstractInput< Type >::getConnectionEventId   const [inline]
 

get the connection event ID

Definition at line 357 of file PsAbstractInput.h.

References PsAbstractInput< Type >::_connectionEventId.

Referenced by PsInput< Type >::realConnect().

00359 {
00360    return _connectionEventId ;

template<typename Type>
const PsEventIdentifier & PsAbstractInput< Type >::getConnectionToControlParameterEventId   const [inline]
 

get the connection event ID, when the connection request comes from a control parameter

Definition at line 364 of file PsAbstractInput.h.

References PsAbstractInput< Type >::_connectionToControlParameterEventId.

Referenced by PsInput< Type >::realConnect().

00366 {
00367    return _connectionToControlParameterEventId ;

template<class Type>
virtual const PsDate& PsAbstractInput< Type >::getDateOfLastExactValue   const [pure virtual]
 

get the date of the last exact value.

Returns:
the date of the last exact value readable at the moment of call

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<class Type>
virtual int PsAbstractInput< Type >::getDistanceToExactValue   const [pure virtual]
 

get distance to exact value.

Returns:
This member function returns the distance in milli seconds between the last value returned by get and the nearest exact value from which it was calculated. Distance is positive if the returned value is after the last exact value.

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<class Type>
virtual const Type& PsAbstractInput< Type >::getLastExactValue   const [pure virtual]
 

get the last exact value.

Using this member function garanties that a value produced is returned, but it should only be used for specific needs, as it prevents any optimisation by the kernel, and the date of production of the value isn't accessible

Returns:
the last exact value readable at the moment of call

Implemented in PsInput< Type >, and PsInputAlias< Type >.

template<typename Type>
int PsAbstractInput< Type >::getPrecisionLevel   const [inline, virtual]
 

get the polation level used by this input

Definition at line 291 of file PsAbstractInput.h.

References PsAbstractInput< Type >::_precisionLevel.

00293 {
00294   return _precisionLevel ;

template<typename Type>
bool PsAbstractInput< Type >::isConnectable   const [inline, virtual]
 

isConnectable.

find out if this input accepts connection requests from other simulated objects

Definition at line 329 of file PsAbstractInput.h.

References PsAbstractInput< Type >::_connectable.

Referenced by PsInputAlias< Type >::PsInputAlias(), and PsInput< Type >::realConnect().

00331 {
00332    return _connectable ;

template<typename Type>
void PsAbstractInput< Type >::notifyAliasing PsInputAlias< Type > *    aliasingInputAlias [inline, virtual]
 

called when this input is aliased

Parameters:
aliasingInputAlias : the input alias aliasing this input

Definition at line 307 of file PsAbstractInput.h.

References PsAbstractInput< Type >::_listOfAliases, and list< PsInputAlias< Type > * >::push_back().

00309 {
00310    if ( aliasingInputAlias != NULL )
00311       {
00312          _listOfAliases.push_back( aliasingInputAlias );
00313       }

template<typename Type>
void PsAbstractInput< Type >::notifyUnaliasing PsInputAlias< Type > *    aliasingInputAlias [inline, virtual]
 

called when this input is no longer aliased

Parameters:
aliasingInputAlias : the input alias aliasing this input

Definition at line 318 of file PsAbstractInput.h.

References PsAbstractInput< Type >::_listOfAliases, and list< PsInputAlias< Type > * >::push_back().

00320 {
00321    if ( aliasingInputAlias != NULL )
00322       {
00323          _listOfAliases.push_back( aliasingInputAlias );
00324       }

template<class Type>
virtual void PsAbstractInput< Type >::printDebuggingInformation ostream &    err const [pure virtual]
 

print any usefull debugging information for this input

Implements PsAttribute.

Implemented in PsInput< Type >, and PsInputAlias< Type >.

Referenced by PsAbstractInput< Type >::connect(), and PsAbstractInput< Type >::connectToControlParameter().

template<typename Type>
void PsAbstractInput< Type >::setConnectable bool    nextConnectableState [virtual]
 

setConnectable.

Definition at line 337 of file PsAbstractInput.h.

References PsAbstractInput< Type >::_connectable, PsAttribute::_owner, PsSimulatedObject::getController(), PsnCurrentActiveObject::getCurrentActiveObject(), PsAttribute::getName(), and PsSimulatedObject::getName().

00339 {
00340    if ( PsnCurrentActiveObject::getCurrentActiveObject() == & _owner ||
00341         PsnCurrentActiveObject::getCurrentActiveObject() == & _owner.getController() ||
00342         PsnCurrentActiveObject::getCurrentActiveObject() == NULL ) 
00343       {
00344          _connectable = newConnectableState ;
00345       }
00346    else 
00347       {
00348          cerr<<"Warning: "
00349              <<_owner.getName()
00350              <<"::"
00351              <<getName()
00352              <<"only the owner can change the the connectable state of an input"<<endl;
00353       }

template<typename Type>
int PsAbstractInput< Type >::setPrecisionLevel const int    newValue [inline, virtual]
 

change the polation level of this input

Parameters:
newValue the new value
Returns:
the old polationValue

Definition at line 299 of file PsAbstractInput.h.

References PsAbstractInput< Type >::_precisionLevel.

00301 {
00302    int oldValue = _precisionLevel ;
00303    _precisionLevel = newValue ;
00304    return oldValue ;


Member Data Documentation

template<class Type>
bool PsAbstractInput< Type >::_connectable [protected]
 

can simulated objects other than the owner change the connection of this input

Definition at line 241 of file PsAbstractInput.h.

Referenced by PsAbstractInput< Type >::isConnectable(), and PsAbstractInput< Type >::setConnectable().

template<class Type>
const PsEventIdentifier PsAbstractInput< Type >::_connectionEventId [protected]
 

the connection event Identifier

Definition at line 244 of file PsAbstractInput.h.

Referenced by PsAbstractInput< Type >::getConnectionEventId().

template<class Type>
const PsEventIdentifier PsAbstractInput< Type >::_connectionToControlParameterEventId [protected]
 

the connection event Identifier

Definition at line 247 of file PsAbstractInput.h.

Referenced by PsAbstractInput< Type >::getConnectionToControlParameterEventId().

template<class Type>
list<PsInputAlias<Type> *> PsAbstractInput< Type >::_listOfAliases [protected]
 

list of aliases of this input

Definition at line 235 of file PsAbstractInput.h.

Referenced by PsAbstractInput< Type >::notifyAliasing(), PsAbstractInput< Type >::notifyUnaliasing(), PsSensitiveInputAlias< Type >::signalChange(), PsSensitiveInput< Type >::signalChange(), and PsAbstractInput< Type >::~PsAbstractInput().

template<class Type>
int PsAbstractInput< Type >::_precisionLevel [protected]
 

precision level asked for when a value is fetched from the connected output

Definition at line 238 of file PsAbstractInput.h.

Referenced by PsInput< Type >::get(), PsAbstractInput< Type >::getPrecisionLevel(), PsInputAlias< Type >::printDebuggingInformation(), PsInput< Type >::printDebuggingInformation(), and PsAbstractInput< Type >::setPrecisionLevel().


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

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

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