#include <OMKGenericControlParameter.h>
Inheritance diagram for OMK::GenericControlParameter< T, AncestorClass >:
Public Member Functions | |
GenericControlParameter (const Name &attributeName, SimulatedObject &owner, const int historyLength, OMK::Type::PolatorNT *polator) | |
Constructor. | |
virtual | ~GenericControlParameter () |
Destructor. | |
virtual const T & | get (int &distanceToExactValue, const int precisionLevel, const Date &deltaT, T &calculatedResult) const |
redefined to avoid unecessary warnings because of the partial overide of get | |
virtual const T & | get () const |
get the last approved value of this control parameter | |
virtual const T & | getLastExactValue () const |
get the last approved value of this control parameter | |
virtual const Date & | getDateOfLastExactValue () const |
get the date of the last approved value of this control parameter | |
virtual void | set (const T &val) |
suggest a new value to this control parameter | |
virtual void | extract (std::istream &=std::cin) |
extract from an input stream | |
virtual void | unpack (IncomingSynchronisationMessage &) |
unpack from a message | |
virtual void | pack (OutgoingSynchronisationMessage &) const |
pack in a message | |
virtual void | insertInStream (std::ostream &=std::cout) const |
insert in an output stream | |
virtual void | printDebuggingInformation (std::ostream &err) const |
print any usefull debugging information | |
virtual bool | connect (const Name &objectName, const Name &inputName) |
connect the control parameter to a public input of another object | |
virtual bool | connect (SimulatedObject &object, const Name &inputName) |
connect the control parameter to a public input of another object | |
virtual bool | connect (SimulatedObject *pointerToObject, const Name &inputName) |
connect the control parameter to a public input of another object | |
Protected Member Functions | |
virtual void | realSet (const T &val) |
really change the value in the history | |
Protected Attributes | |
ChangedControlParameterEventListener< T > * | _associatedEventListener |
the default event listener reacting to changes suggested on that 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 OMKOutput<T>, wher type is the first template parameter
Definition at line 38 of file OMKGenericControlParameter.h.
OMK::GenericControlParameter< T, AncestorClass >::GenericControlParameter | ( | const Name & | attributeName, | |
SimulatedObject & | owner, | |||
const int | historyLength, | |||
OMK::Type::PolatorNT * | polator | |||
) | [inline] |
Constructor.
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 146 of file OMKGenericControlParameter.h.
References OMK::GenericControlParameter< T, AncestorClass >::_associatedEventListener.
00151 : KernelAttribute( owner, controlParameterName ), 00152 AncestorClass( controlParameterName, 00153 owner, 00154 historyLength, 00155 polator ), 00156 ControlParameter< T >( owner, 00157 controlParameterName, 00158 ( "ChangedControlParameter::" + 00159 controlParameterName.getString() ) ) 00160 { 00161 _associatedEventListener = 00162 new ChangedControlParameterEventListener< T >( owner, *this ) ; 00163 }
OMK::GenericControlParameter< T, AncestorClass >::~GenericControlParameter | ( | ) | [inline, virtual] |
Destructor.
Definition at line 168 of file OMKGenericControlParameter.h.
References OMK::GenericControlParameter< T, AncestorClass >::_associatedEventListener.
00169 { 00170 delete _associatedEventListener ; 00171 }
const T & OMK::GenericControlParameter< T, AncestorClass >::get | ( | int & | distanceToExactValue, | |
const int | precisionLevel, | |||
const Date & | deltaT, | |||
T & | calculatedResult | |||
) | const [virtual] |
redefined to avoid unecessary warnings because of the partial overide of get
Definition at line 264 of file OMKGenericControlParameter.h.
00269 { 00270 return AncestorClass::get( distanceToExactValue, precisionLevel, deltaT, 00271 calculatedResult ) ; 00272 }
const T & OMK::GenericControlParameter< T, AncestorClass >::get | ( | ) | const [inline, virtual] |
get the last approved value of this control parameter
Implements OMK::ControlParameter< T >.
Definition at line 277 of file OMKGenericControlParameter.h.
const T & OMK::GenericControlParameter< T, AncestorClass >::getLastExactValue | ( | ) | const [inline, virtual] |
get the last approved value of this control parameter
Implements OMK::ControlParameter< T >.
Definition at line 293 of file OMKGenericControlParameter.h.
const Date & OMK::GenericControlParameter< T, AncestorClass >::getDateOfLastExactValue | ( | ) | const [inline, virtual] |
get the date of the last approved value of this control parameter
Implements OMK::ControlParameter< T >.
Definition at line 285 of file OMKGenericControlParameter.h.
void OMK::GenericControlParameter< T, AncestorClass >::set | ( | const T & | val | ) | [inline, virtual] |
suggest a new value to this control parameter
Implements OMK::ControlParameter< T >.
Definition at line 176 of file OMKGenericControlParameter.h.
References OMK::KernelAttribute::_owner, OMK::ControlParameter< T >::getAssociatedEventId(), OMK::CurrentActiveObject::getCurrentActiveObject(), OMK::GenericControlParameter< T, AncestorClass >::realSet(), and OMK::SimulatedObject::sendValuedEvent().
00177 { 00178 SimulatedObject * caller = CurrentActiveObject::getCurrentActiveObject() ; 00179 if( caller != 0 && caller != &_owner ) 00180 { 00181 caller->sendValuedEvent( _owner, getAssociatedEventId(), val ) ; 00182 } 00183 else 00184 { 00185 /* Probably in initialisation phase : suppose the owner is calling set 00186 * with the initial value. 00187 * WARNING: this is a security hole because the currentActiveObject can 00188 * easily be changed. 00189 */ 00190 realSet( val ) ; 00191 } 00192 }
void OMK::GenericControlParameter< T, AncestorClass >::extract | ( | std::istream & | = std::cin |
) | [inline, virtual] |
extract from an input stream
Implements OMK::KernelAttribute.
Definition at line 221 of file OMKGenericControlParameter.h.
00223 { 00224 /* Thread safety assessement : as thread safe as localInsert 00225 */ 00226 AncestorClass::extract( in ) ; 00227 }
void OMK::GenericControlParameter< T, AncestorClass >::unpack | ( | IncomingSynchronisationMessage & | ) | [inline, virtual] |
unpack from a message
Reimplemented from OMK::Flowable.
Definition at line 243 of file OMKGenericControlParameter.h.
00245 { 00246 /* Thread safety assessement : as thread safe as localInsert 00247 */ 00248 AncestorClass::unpack( in ) ; 00249 }
void OMK::GenericControlParameter< T, AncestorClass >::pack | ( | OutgoingSynchronisationMessage & | ) | const [inline, virtual] |
pack in a message
Reimplemented from OMK::Flowable.
Definition at line 232 of file OMKGenericControlParameter.h.
00234 { 00235 /* Thread safety assessement : as thread safe as localInsert 00236 */ 00237 AncestorClass::pack( out ) ; 00238 }
void OMK::GenericControlParameter< T, AncestorClass >::insertInStream | ( | std::ostream & | = std::cout |
) | const [inline, virtual] |
insert in an output stream
Implements OMK::KernelAttribute.
Definition at line 210 of file OMKGenericControlParameter.h.
00212 { 00213 /* Thread safety assessement : as thread safe as localInsert 00214 */ 00215 AncestorClass::insertInStream( out ) ; 00216 }
void OMK::GenericControlParameter< T, AncestorClass >::printDebuggingInformation | ( | std::ostream & | err | ) | const [inline, virtual] |
print any usefull debugging information
Implements OMK::KernelAttribute.
Definition at line 254 of file OMKGenericControlParameter.h.
00256 { 00257 AncestorClass::printDebuggingInformation( err ) ; 00258 err << " Output is a control parameter " << std::endl ; 00259 }
bool OMK::GenericControlParameter< T, AncestorClass >::connect | ( | const Name & | objectName, | |
const Name & | inputName | |||
) | [virtual] |
connect the control parameter to a public input of another object
objectName | the object owning inputName | |
inputName | the name of the input to be connected to |
Implements OMK::ControlParameter< T >.
Definition at line 301 of file OMKGenericControlParameter.h.
bool OMK::GenericControlParameter< T, AncestorClass >::connect | ( | SimulatedObject & | object, | |
const Name & | inputName | |||
) | [virtual] |
connect the control parameter to a public input of another object
objectthe | object owning inputName | |
inputName | the name of the input to be connected to |
Implements OMK::ControlParameter< T >.
Definition at line 310 of file OMKGenericControlParameter.h.
bool OMK::GenericControlParameter< T, AncestorClass >::connect | ( | SimulatedObject * | pointerToObject, | |
const Name & | inputName | |||
) | [virtual] |
connect the control parameter to a public input of another object
pointerToObject | the object owning inputName | |
inputName | the name of the input to be connected to |
Implements OMK::ControlParameter< T >.
Definition at line 319 of file OMKGenericControlParameter.h.
void OMK::GenericControlParameter< T, AncestorClass >::realSet | ( | const T & | val | ) | [inline, protected, virtual] |
really change the value in the history
Implements OMK::ControlParameter< T >.
Definition at line 197 of file OMKGenericControlParameter.h.
References OMK::KernelAttribute::_owner, OMK::SimulatedObject::getObjectHandle(), and OMK::ObjectHandle::notifyChangeInControlParameter().
Referenced by OMK::GenericControlParameter< T, AncestorClass >::set().
00199 { 00200 if( _owner.getObjectHandle() != 0 ) 00201 {//during initialisation phase, objectHandle of the owner can be null 00202 _owner.getObjectHandle()->notifyChangeInControlParameter( this ) ; 00203 } 00204 AncestorClass::set( val ) ; 00205 }
ChangedControlParameterEventListener<T>* OMK::GenericControlParameter< T, AncestorClass >::_associatedEventListener [protected] |
the default event listener reacting to changes suggested on that control parameter
Definition at line 127 of file OMKGenericControlParameter.h.
Referenced by OMK::GenericControlParameter< T, AncestorClass >::GenericControlParameter(), and OMK::GenericControlParameter< T, AncestorClass >::~GenericControlParameter().
Documentation generated on Mon Jun 9 11:46:01 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |