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

PsGenericControlParameter< Type, AncestorClass > Class Template Reference

a genric control parameter. More...

#include <PsGenericControlParameter.h>

Inheritance diagram for PsGenericControlParameter< Type, AncestorClass >:

Inheritance graph
[legend]
Collaboration diagram for PsGenericControlParameter< Type, AncestorClass >:

Collaboration graph
[legend]
List of all members.

Public Methods

 PsGenericControlParameter (const PsName &attributeName, PsSimulatedObject &owner, const int historyLength, PsPolatorNT *polator)
 Constructor.

virtual ~PsGenericControlParameter (void)
 Destructor.

virtual const Type & get (int &distanceToExactValue, const int precisionLevel, const PsDate &deltaT, Type &calculatedResult) const
 redefined to avoid unecessary warnings because of the partial overide of get

virtual const Type & get (void) const
 get the last approved value of this control parameter

virtual const Type & getLastExactValue (void) const
 get the last approved value of this control parameter

virtual const PsDategetDateOfLastExactValue (void) const
 get the date of the last approved value of this control parameter

virtual void set (const Type &val)
 suggest a new value to this control parameter

virtual void extract (istream &=cin)
 extract from an input stream

virtual void unpack (PsIncomingSynchronisationMessage &)
 unpack from a message

virtual void pack (PsOutgoingSynchronisationMessage &) const
 pack in a message

virtual void insertInStream (ostream &=cout) const
 insert in an output stream

virtual void printDebuggingInformation (ostream &err) const
 print any usefull debugging information

virtual bool connect (const PsName &objectName, const PsName &inputName)
 connect the control parameter to a public input of another object

virtual bool connect (PsSimulatedObject &object, const PsName &inputName)
 connect the control parameter to a public input of another object

virtual bool connect (PsSimulatedObject *pointerToObject, const PsName &inputName)
 connect the control parameter to a public input of another object


Protected Methods

virtual void realSet (const Type &val)
 really change the value in the history


Protected Attributes

PsChangedControlParameterEventListener<
Type > * 
_associatedEventListener
 the default event listener reacting to changes suggested on that control parameter


Detailed Description

template<typename Type, class AncestorClass>
class PsGenericControlParameter< Type, AncestorClass >

a genric control parameter.

A control parameter is, with openMask 3.0 an output that accepts new value from all simulated objects. Therefore, control parameters are implemented has inehriting from outputs and the control parameter interface. As outputs can be redefined for better distribution, a generic control parameter inherits from it's second template parameter, wich should itself inherit from PsOutput<Type>, wher type is the first template parameter

Author:
David Margery
Version:
1.1 (revision )

Definition at line 35 of file PsGenericControlParameter.h.


Constructor & Destructor Documentation

template<typename Type, class AncestorClass>
PsGenericControlParameter< Type, AncestorClass >::PsGenericControlParameter const PsName   attributeName,
PsSimulatedObject   owner,
const int    historyLength,
PsPolatorNT   polator
[inline]
 

Constructor.

Parameters:
attributeName name of this attribute for it's owner
owner simulatedObject owning that attribute
historylength the length of the stored history of values
polator the polator used to produced any needed values

Definition at line 128 of file PsGenericControlParameter.h.

References PsGenericControlParameter< Type, AncestorClass >::_associatedEventListener, and PsSimulatedObject::addEventListener().

00132                                                                                          : 
00133    PsAttribute (owner, controlParameterName),  
00134    AncestorClass (controlParameterName,
00135                   owner,
00136                   historyLength,
00137                   polator),
00138    PsControlParameter<Type> (owner, 
00139                              controlParameterName,
00140                              PsString("ChangedControlParameter::")+controlParameterName.getCString() )
00141 {
00142    _associatedEventListener = new PsChangedControlParameterEventListener<Type>(owner, *this ) ;
00143    owner.addEventListener( *_associatedEventListener ) ;

template<typename Type, class AncestorClass>
PsGenericControlParameter< Type, AncestorClass >::~PsGenericControlParameter void    [inline, virtual]
 

Destructor.

Definition at line 148 of file PsGenericControlParameter.h.

References PsGenericControlParameter< Type, AncestorClass >::_associatedEventListener.

00150 {
00151    delete _associatedEventListener ;


Member Function Documentation

template<typename Type, class AncestorClass>
bool PsGenericControlParameter< Type, AncestorClass >::connect PsSimulatedObject   pointerToObject,
const PsName   inputName
[virtual]
 

connect the control parameter to a public input of another object

Parameters:
pointerToObject the object owning inputName
inputName the name of the input to be connected to
Returns:
bool connecting successfull

Implements PsControlParameter< Type >.

Definition at line 273 of file PsGenericControlParameter.h.

00275 {
00276    return AncestorClass::connect (pointerToObject, inputName) ;

template<typename Type, class AncestorClass>
bool PsGenericControlParameter< Type, AncestorClass >::connect PsSimulatedObject   object,
const PsName   inputName
[virtual]
 

connect the control parameter to a public input of another object

Parameters:
objectthe object owning inputName
inputName the name of the input to be connected to
Returns:
bool connecting successfull

Implements PsControlParameter< Type >.

Definition at line 266 of file PsGenericControlParameter.h.

00268 {
00269    return AncestorClass::connect (object, inputName) ;

template<typename Type, class AncestorClass>
bool PsGenericControlParameter< Type, AncestorClass >::connect const PsName   objectName,
const PsName   inputName
[virtual]
 

connect the control parameter to a public input of another object

Parameters:
objectName the object owning inputName
inputName the name of the input to be connected to
Returns:
bool connecting successfull

Implements PsControlParameter< Type >.

Definition at line 259 of file PsGenericControlParameter.h.

00261 {
00262    return AncestorClass::connect (objectName, inputName) ;

template<typename Type, class AncestorClass>
void PsGenericControlParameter< Type, AncestorClass >::extract istream &    = cin [inline, virtual]
 

extract from an input stream

Implements PsAttribute.

Definition at line 195 of file PsGenericControlParameter.h.

00197 {
00198    /*thread safety assessement :
00199      As thread safe as localInsert 
00200    */
00201    AncestorClass::extract ( in ) ; 

template<typename Type, class AncestorClass>
const Type & PsGenericControlParameter< Type, AncestorClass >::get void    const [inline, virtual]
 

get the last approved value of this control parameter

Implements PsControlParameter< Type >.

Definition at line 240 of file PsGenericControlParameter.h.

00242 {
00243   return AncestorClass::getLastExactValue ( ) ;

template<typename Type, class AncestorClass>
const Type & PsGenericControlParameter< Type, AncestorClass >::get int &    distanceToExactValue,
const int    precisionLevel,
const PsDate   deltaT,
Type &    calculatedResult
const [virtual]
 

redefined to avoid unecessary warnings because of the partial overide of get

Definition at line 231 of file PsGenericControlParameter.h.

References PsDate.

00236 {
00237    return AncestorClass::get(distanceToExactValue,precisionLevel,deltaT,calculatedResult );

template<typename Type, class AncestorClass>
const PsDate & PsGenericControlParameter< Type, AncestorClass >::getDateOfLastExactValue void    const [inline, virtual]
 

get the date of the last approved value of this control parameter

Implements PsControlParameter< Type >.

Definition at line 247 of file PsGenericControlParameter.h.

References PsDate.

00249 {
00250   return AncestorClass::getDateOfLastExactValue ( ) ;

template<typename Type, class AncestorClass>
const Type & PsGenericControlParameter< Type, AncestorClass >::getLastExactValue void    const [inline, virtual]
 

get the last approved value of this control parameter

Implements PsControlParameter< Type >.

Definition at line 253 of file PsGenericControlParameter.h.

00255 {
00256   return AncestorClass::getLastExactValue ( ) ;

template<typename Type, class AncestorClass>
void PsGenericControlParameter< Type, AncestorClass >::insertInStream ostream &    = cout const [inline, virtual]
 

insert in an output stream

Implements PsAttribute.

Definition at line 186 of file PsGenericControlParameter.h.

00188 {
00189    /*thread safety assessement :
00190      As thread safe as localInsert 
00191    */
00192    AncestorClass::insertInStream ( out ) ; 

template<typename Type, class AncestorClass>
void PsGenericControlParameter< Type, AncestorClass >::pack PsOutgoingSynchronisationMessage   const [inline, virtual]
 

pack in a message

Reimplemented from PsFlowable.

Definition at line 205 of file PsGenericControlParameter.h.

00207 {
00208    /*thread safety assessement :
00209      As thread safe as localInsert 
00210    */
00211    AncestorClass::pack ( out ) ; 

template<typename Type, class AncestorClass>
void PsGenericControlParameter< Type, AncestorClass >::printDebuggingInformation ostream &    err const [inline, virtual]
 

print any usefull debugging information

Implements PsAttribute.

Definition at line 224 of file PsGenericControlParameter.h.

00226 {
00227   AncestorClass::printDebuggingInformation( err ) ;
00228   err <<" Output is a control parameter "<<endl;

template<typename Type, class AncestorClass>
void PsGenericControlParameter< Type, AncestorClass >::realSet const Type &    val [inline, protected, virtual]
 

really change the value in the history

Implements PsControlParameter< Type >.

Definition at line 174 of file PsGenericControlParameter.h.

References PsAttribute::_owner, PsSimulatedObject::getObjectHandle(), and PsnObjectHandle::notifyChangeInControlParameter().

Referenced by PsGenericControlParameter< Type, AncestorClass >::set().

00176 {
00177    if ( _owner.getObjectHandle() != NULL )
00178       {//during initialisation phase, objectHandle of the owner can be null
00179          _owner.getObjectHandle()->notifyChangeInControlParameter (this) ;
00180       }
00181    AncestorClass::set(val) ;

template<typename Type, class AncestorClass>
void PsGenericControlParameter< Type, AncestorClass >::set const Type &    val [inline, virtual]
 

suggest a new value to this control parameter

Implements PsControlParameter< Type >.

Definition at line 156 of file PsGenericControlParameter.h.

References PsAttribute::_owner, PsControlParameter< Type >::getAssociatedEventId(), PsnCurrentActiveObject::getCurrentActiveObject(), PsGenericControlParameter< Type, AncestorClass >::realSet(), and PsSimulatedObject::sendValuedEvent().

00158 {
00159    PsSimulatedObject * caller = PsnCurrentActiveObject::getCurrentActiveObject() ;
00160    if ( (caller != NULL) &&
00161         (caller != &_owner) )
00162       {
00163          caller->sendValuedEvent(_owner,getAssociatedEventId(),val) ;
00164       } 
00165    else //probably in initialisation phase : suppose the owner is calling set with the initial value
00166       // warning: this is a security hole, because the currentActiveObject can easily be changed
00167       {
00168          realSet (val) ;
00169       }

template<typename Type, class AncestorClass>
void PsGenericControlParameter< Type, AncestorClass >::unpack PsIncomingSynchronisationMessage   [inline, virtual]
 

unpack from a message

Reimplemented from PsFlowable.

Definition at line 214 of file PsGenericControlParameter.h.

00216 {
00217    /*thread safety assessement :
00218      As thread safe as localInsert 
00219    */
00220    AncestorClass::unpack ( in ) ; 


Member Data Documentation

template<typename Type, class AncestorClass>
PsChangedControlParameterEventListener<Type>* PsGenericControlParameter< Type, AncestorClass >::_associatedEventListener [protected]
 

the default event listener reacting to changes suggested on that control parameter

Definition at line 120 of file PsGenericControlParameter.h.

Referenced by PsGenericControlParameter< Type, AncestorClass >::PsGenericControlParameter(), and PsGenericControlParameter< Type, AncestorClass >::~PsGenericControlParameter().


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

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

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