OMK::Input< T > Class Template Reference

An input for a simulation object. More...

#include <OMKInput.h>

Inheritance diagram for OMK::Input< T >:

Inheritance graph
[legend]
Collaboration diagram for OMK::Input< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Input (const Name &inputName, SimulatedObject &owner, bool makeConnectable, const int precisionLevel=OMK::Type::PolatorNT::defaultPrecisionLevel)
 Constructor.
virtual ~Input ()
virtual bool connect (const Name &objectName, const Name &outputName)
 connect this input to the output of an other simulated object.
virtual bool connect (SimulatedObject &object, const Name &outputName)
 connect this input to the output of an other simulated object.
virtual bool connect (SimulatedObject *pointerToObject, const Name &outputName)
 connect this input to the output of an other simulated object.
virtual bool connect (const Name &objectName, const Name &outputName, const T &initialValue)
 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 (SimulatedObject &object, const Name &outputName, const T &initialValue)
 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 (SimulatedObject *pointerToObject, const Name &outputName, const T &initialValue)
 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 Name &objectName, const Name &controlParameterName)
 connect this input to a control parameter of an other simulated object.
virtual bool connectToControlParameter (SimulatedObject &object, const Name &controlParameterName)
 connect this input to the controlParameter of an other simulated object.
virtual bool connectToControlParameter (SimulatedObject *pointerToObject, const Name &controlParameterName)
 connect this input to the controlParameter of an other simulated object.
virtual bool connectToControlParameter (const Name &objectName, const Name &controlParameterName, const T &initialValue)
 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 (SimulatedObject &object, const Name &controlParameterName, const T &initialValue)
 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 (SimulatedObject *pointerToObject, const Name &controlParameterName, const T &initialValue)
 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 const OutputNTgetConnectedOutput () const
 get a pointer to output this input is connected to
virtual void disconnect ()
 disconnect the input from the connected output
virtual bool isConnected ()
 return true if the input is connected
virtual const T & get (int deltaT=0)
 get the value of the connected output a certain date.
virtual int getDistanceToExactValue () const
 get distance to exact value.
virtual const T & getLastExactValue () const
 get the last exact value.
virtual const DategetDateOfLastExactValue () const
 get the date of the last exact value.
virtual void printDebuggingInformation (std::ostream &err) const
 print any usefull debugging information for this input
virtual void extract (std::istream &=std::cin)
 extraction from an input stream (input stream) no real semantic has yet been defined for this operation
virtual void insertInStream (std::ostream &=std::cout) const
 insert in anoutput stream no real semantic has yet been defined for this operation
virtual void outputDestroyed ()
 called by the destructor of an connected output
virtual bool realConnect (OutputNT *output)
 the real connecting member function

Protected Attributes

int _distanceToExactValueOfLastGet
 distance To Exact Value Of Last Get the distance in milli seconds between the last value returned by get and the nearest exact value from which it was calculated.
Output< T > * _connectedOutput
 reference to the connected output
_calculatedResult
 cache for computations of approximated values using this cache enables get to return a reference to a value, which enables implementing get whithout unnecessary copy operations
InputConnectionEventListener<
T > * 
_associatedEventListener
 the event listener implementing default policy for connection by other objects

Detailed Description

template<typename T>
class OMK::Input< T >

An input for a simulation object.

template parameter must be of a derived class of OMKType

See also:
OMKType
Author:
Thierry Duval
Version:
2.3

Definition at line 42 of file OMKInput.h.


Constructor & Destructor Documentation

template<typename T>
OMK::Input< T >::Input ( const Name inputName,
SimulatedObject owner,
bool  makeConnectable,
const int  precisionLevel = OMK::Type::PolatorNT::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 273 of file OMKInput.h.

References OMK::Input< T >::_associatedEventListener.

00276   : AbstractInput<T>( inputName, owner, makeConnectable, precisionLevel ),
00277     _connectedOutput( 0 )
00278 {
00279   /* the event listener has to be created even is makeConnectable
00280    * is false to enable dynamic change in the connectable state
00281    * without side effects on event listener order. This is
00282    * important to ensure consistent behaviour in way that doesn't
00283    * depend on creation and making public order.
00284    */
00285   _associatedEventListener = new InputConnectionEventListener<T>(
00286     owner, this ) ;
00287 };

template<typename T>
OMK::Input< T >::~Input (  )  [virtual]

Definition at line 292 of file OMKInput.h.

References OMK::Input< T >::_associatedEventListener, and OMK::Input< T >::_connectedOutput.

00293 {
00294   delete _associatedEventListener ;
00295   if( _connectedOutput )
00296   {
00297     _connectedOutput->disconnectedMyself( this ) ;
00298   }
00299 }


Member Function Documentation

template<typename T>
bool OMK::Input< T >::connect ( const Name objectName,
const Name outputName 
) [inline, 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 OMK::AbstractInput< T >.

Definition at line 316 of file OMKInput.h.

References OMK::KernelAttribute::_owner, OMK::SimulatedObject::getController(), OMK::SimulatedObject::getPointerToOutputNamed(), OMK::Controller::getPointerToSimulatedObjectNamed(), OMERROR, OMK_DEBUG_OMK_TYPE, OMTRACEID, OMK::Input< T >::printDebuggingInformation(), and OMK::Input< T >::realConnect().

Referenced by OMK::Input< T >::connect(), and OMK::Input< T >::connectToControlParameter().

00318 {
00319   OMTRACEID( OMK_DEBUG_OMK_TYPE,
00320              "Input: trying connection with object \"" << objectName
00321              << "\" on output \"" << outputName << "\"" ) ;
00322   SimulatedObject * object =
00323     _owner.getController().getPointerToSimulatedObjectNamed( objectName ) ;
00324   bool ok = false ;
00325   if( object ) 
00326   {
00327     OutputNT * output = object->getPointerToOutputNamed( outputName ) ;
00328     if( output != 0 )
00329     {
00330       ok = realConnect( output ) ;
00331     }
00332     else
00333     {
00334       OMERROR( "Output \"" << outputName
00335                << "\" not found on object \"" << objectName << "\"" ) ;
00336     }
00337   } 
00338   else
00339   {
00340     std::ostringstream msg ;
00341     printDebuggingInformation( msg ) ;
00342     OMERROR( msg.str() << "Input<T>::connect \"" << objectName
00343              << "\" unknown" ) ;
00344   }
00345   return ok ;
00346 }

template<typename T>
bool OMK::Input< T >::connect ( SimulatedObject object,
const Name outputName 
) [inline, virtual]

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

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

Implements OMK::AbstractInput< T >.

Definition at line 393 of file OMKInput.h.

References OMK::SimulatedObject::getName(), OMK::SimulatedObject::getPointerToOutputNamed(), OMK_DEBUG_OMK_TYPE, OMTRACEID, and OMK::Input< T >::realConnect().

00395 {
00396   OMTRACEID( OMK_DEBUG_OMK_TYPE, "Input<T>::connect( \""
00397              << object.getName() << "\", \"" << outputName << "\" )" ) ;
00398   return realConnect( object.getPointerToOutputNamed( outputName ) ) ;
00399 }

template<typename T>
bool OMK::Input< T >::connect ( SimulatedObject pointerToObject,
const Name outputName 
) [inline, 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 OMK::AbstractInput< T >.

Definition at line 404 of file OMKInput.h.

00406 {
00407   return AbstractInput<T>::connect( object, outputName ) ;
00408 }

template<typename T>
bool OMK::Input< T >::connect ( const Name objectName,
const Name outputName,
const T &  initialValue 
) [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 351 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput, and OMK::Input< T >::connect().

00354 {
00355   bool connected = false ;
00356   if( connect( objectName, outputName ) && _connectedOutput )
00357   {
00358     _connectedOutput->suggest( initialValue ) ;
00359     connected = true ;
00360   }
00361   return connected ;
00362 }

template<typename T>
bool OMK::Input< T >::connect ( SimulatedObject object,
const Name outputName,
const T &  initialValue 
) [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 367 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput, and OMK::Input< T >::connect().

00370 {
00371   bool connected = false ;
00372   if( connect( object, outputName ) )
00373   {
00374     _connectedOutput->suggest( initialValue ) ;
00375     connected = true ;
00376   }
00377   return connected ;
00378 }

template<typename T>
bool OMK::Input< T >::connect ( SimulatedObject pointerToObject,
const Name outputName,
const T &  initialValue 
) [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 383 of file OMKInput.h.

00386 {
00387   return AbstractInput<T>::connect( object, outputName, initialValue ) ;
00388 }

template<typename T>
bool OMK::Input< T >::connectToControlParameter ( const Name objectName,
const Name controlParameterName 
) [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 413 of file OMKInput.h.

References OMK::KernelAttribute::_owner, OMK::SimulatedObject::getController(), OMK::SimulatedObject::getPointerToControlParameterNamed(), OMK::Controller::getPointerToSimulatedObjectNamed(), OMERROR, OMK_DEBUG_OMK_TYPE, OMTRACEID, OMK::Input< T >::printDebuggingInformation(), and OMK::Input< T >::realConnect().

00416 {
00417   OMTRACEID( OMK_DEBUG_OMK_TYPE,
00418              "Input<T>::connectToControlParameter( \""
00419              << objectName << "\", \"" << controlParameterName
00420              << "\" )" ) ;
00421   SimulatedObject * object =
00422     _owner.getController().getPointerToSimulatedObjectNamed( objectName ) ;
00423   bool ok = false ;
00424   if( object ) 
00425   {
00426     ok = realConnect( object->getPointerToControlParameterNamed( 
00427                         controlParameterName ) ) ;
00428   } 
00429   else 
00430   {
00431     std::ostringstream msg ;
00432     printDebuggingInformation( msg ) ;
00433     OMERROR( msg.str() << "Input<T>::connectToControlParameter "
00434              << objectName << " unknown" ) ;
00435   }
00436   return ok ;
00437 }

template<typename T>
bool OMK::Input< T >::connectToControlParameter ( SimulatedObject object,
const Name controlParameterName 
) [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 487 of file OMKInput.h.

References OMK::SimulatedObject::getName(), OMK::SimulatedObject::getPointerToControlParameterNamed(), OMK_DEBUG_OMK_TYPE, OMTRACEID, and OMK::Input< T >::realConnect().

00490 {
00491   OMTRACEID( OMK_DEBUG_OMK_TYPE,
00492              "Input<T>::connectToControlParameter( \""
00493              << object.getName() << "\", \"" << controlParameterName
00494              << "\" )" ) ;
00495   return realConnect( object.getPointerToControlParameterNamed(
00496                         controlParameterName ) ) ;
00497 }

template<typename T>
bool OMK::Input< T >::connectToControlParameter ( SimulatedObject pointerToObject,
const Name controlParameterName 
) [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 502 of file OMKInput.h.

References OMK::SimulatedObject::getName(), OMK_DEBUG_OMK_TYPE, and OMTRACEID.

00505 {
00506   OMTRACEID( OMK_DEBUG_OMK_TYPE,
00507              "Input<T>::connectToControlParameter( \""
00508              << object->getName() << "\", \"" << controlParameterName
00509              << "\" )" ) ;
00510   return AbstractInput<T>::connectToControlParameter(
00511     object, controlParameterName ) ;
00512 }

template<typename T>
bool OMK::Input< T >::connectToControlParameter ( const Name objectName,
const Name controlParameterName,
const T &  initialValue 
) [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 442 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput, and OMK::Input< T >::connect().

00446 {
00447   bool ok = false ;
00448   if( connect( objectName, controlParameterName ) && _connectedOutput )
00449   {
00450     _connectedOutput->suggest( initialValue ) ;
00451     ok = true ;
00452   }
00453   return ok ;
00454 }

template<typename T>
bool OMK::Input< T >::connectToControlParameter ( SimulatedObject object,
const Name controlParameterName,
const T &  initialValue 
) [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 459 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput, and OMK::Input< T >::connect().

00463 {
00464   bool ok = false ;
00465   if( connect( object, controlParameterName ) && _connectedOutput )
00466   {
00467     _connectedOutput->suggest( initialValue ) ;
00468     ok = true ;
00469   }
00470   return ok ;
00471 }

template<typename T>
bool OMK::Input< T >::connectToControlParameter ( SimulatedObject pointerToObject,
const Name controlParameterName,
const T &  initialValue 
) [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 476 of file OMKInput.h.

00480 {
00481   return AbstractInput<T>::connectToControlParameter(
00482     pointerToObject, controlParameterName, initialValue ) ;
00483 }

template<typename T>
const OutputNT * OMK::Input< T >::getConnectedOutput (  )  const [inline, virtual]

get a pointer to output this input is connected to

Implements OMK::AbstractInput< T >.

Definition at line 584 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput.

Referenced by OMK::IAttributeT< PrmType, ModelType, AccessorType >::getValueFromInput().

00585 {
00586   return _connectedOutput ;
00587 }

template<typename T>
void OMK::Input< T >::disconnect (  )  [inline, virtual]

disconnect the input from the connected output

Implements OMK::InputNT.

Definition at line 304 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput.

Referenced by OMK::Input< T >::realConnect(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::~IAttributeT().

00305 {
00306   if( _connectedOutput )
00307   {
00308     _connectedOutput->disconnectedMyself( this ) ;
00309     _connectedOutput = 0 ;
00310   }
00311 }

template<typename T>
bool OMK::Input< T >::isConnected (  )  [inline, virtual]

return true if the input is connected

Implements OMK::InputNT.

Definition at line 693 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput.

00694 {
00695   return _connectedOutput != 0 ;
00696 } 

template<typename T>
const T & OMK::Input< T >::get ( int  deltaT = 0  )  [inline, virtual]

get the value of the connected output a certain date.

Parameters:
deltaT the time decrement use : the value return is the one the would have be produced at current date - deltaT

Implements OMK::AbstractInput< T >.

Definition at line 592 of file OMKInput.h.

References OMK::Input< T >::_calculatedResult, OMK::Input< T >::_connectedOutput, OMK::Input< T >::_distanceToExactValueOfLastGet, OMK::KernelAttribute::_name, OMK::KernelAttribute::_owner, OMK::AbstractInput< T >::_precisionLevel, OMK::SimulatedObject::getName(), OMERROR, OMK_DEBUG_OMK_TYPE, and OMTRACEID.

Referenced by OMK::IAttributeT< PrmType, ModelType, AccessorType >::getValueFromInput().

00593 {
00594   OMTRACEID( OMK_DEBUG_OMK_TYPE,
00595              "Input<T>::localGet calling get of _connectedOutput" ) ;
00596   if( !_connectedOutput )
00597   {
00598     OMERROR( "Input< " << typeid( T ).name() << " >::get \n"
00599              << "Of owner \"" << _owner.getName()
00600              << "\" named \"" << _name << "\"" ) ;
00601     throw InvalidOutputException() ;
00602   }
00603   return _connectedOutput->get( _distanceToExactValueOfLastGet,
00604                                 _precisionLevel, 
00605                                 deltaT,
00606                                 _calculatedResult ) ;
00607 }

template<typename T>
int OMK::Input< T >::getDistanceToExactValue (  )  const [inline, 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.

Implements OMK::AbstractInput< T >.

Definition at line 644 of file OMKInput.h.

References OMK::Input< T >::_distanceToExactValueOfLastGet.

00645 {
00646   return _distanceToExactValueOfLastGet ;
00647 }

template<typename T>
const T & OMK::Input< T >::getLastExactValue (  )  const [inline, 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

Implements OMK::AbstractInput< T >.

Definition at line 612 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput, OMK::KernelAttribute::_name, OMK::KernelAttribute::_owner, OMK::SimulatedObject::getName(), and OMERROR.

00613 {
00614   if( !_connectedOutput )
00615   {
00616     OMERROR( "Input< " << typeid( T ).name()
00617              << " >::getLastExactValue \n"
00618              << "Of owner \"" << _owner.getName()
00619              << "\" named \"" << _name << "\"" ) ;
00620     throw InvalidOutputException() ;
00621   }
00622   return _connectedOutput->getLastExactValue() ;
00623 }

template<typename T>
const Date & OMK::Input< T >::getDateOfLastExactValue (  )  const [inline, virtual]

get the date of the last exact value.

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

Implements OMK::AbstractInput< T >.

Definition at line 628 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput, OMK::KernelAttribute::_name, OMK::KernelAttribute::_owner, OMK::SimulatedObject::getName(), and OMERROR.

00629 {
00630   if( !_connectedOutput )
00631   {
00632     OMERROR( "Input< " << typeid( T ).name()
00633              << " >::getDateOfLastExactValue \n"
00634              << "Of owner \"" << _owner.getName()
00635              << "\" named \"" << _name << "\"" ) ;
00636     throw InvalidOutputException() ;
00637   }
00638   return _connectedOutput->getDateOfLastExactValue() ;
00639 }

template<typename T>
void OMK::Input< T >::printDebuggingInformation ( std::ostream &  err  )  const [inline, virtual]

print any usefull debugging information for this input

Parameters:
err the output stream on which to print the debugging information

Implements OMK::AbstractInput< T >.

Definition at line 670 of file OMKInput.h.

References OMK::KernelAttribute::_owner, OMK::AbstractInput< T >::_precisionLevel, and OMK::SimulatedObject::getName().

Referenced by OMK::Input< T >::connect(), OMK::Input< T >::connectToControlParameter(), and OMK::Input< T >::realConnect().

00672 {
00673   err << std::endl
00674       << "**********************************************************"
00675       << std::endl
00676       << "Class Input" << std::endl
00677       << "owner : " << _owner.getName() << std::endl
00678       << "polation precision level : " << _precisionLevel << std::endl
00679       << "element type : " << typeid( T ).name() << std::endl ;
00680 }

template<typename T>
void OMK::Input< T >::extract ( std::istream &  = std::cin  )  [inline, virtual]

extraction from an input stream (input stream) no real semantic has yet been defined for this operation

Implements OMK::KernelAttribute.

Definition at line 652 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput, and OMASSERTM.

00653 {
00654   OMASSERTM( false, "shouldn't be called" ) ;
00655   in >> *_connectedOutput ;
00656 }

template<typename T>
void OMK::Input< T >::insertInStream ( std::ostream &  = std::cout  )  const [inline, virtual]

insert in anoutput stream no real semantic has yet been defined for this operation

Implements OMK::KernelAttribute.

Definition at line 661 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput, and OMASSERTM.

00662 {
00663   OMASSERTM( false, "shouldn't be called" ) ;
00664   out << *_connectedOutput << " " ;
00665 }

template<typename T>
void OMK::Input< T >::outputDestroyed (  )  [inline, virtual]

called by the destructor of an connected output

Definition at line 685 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput.

00686 {
00687   _connectedOutput = 0 ;
00688 } 

template<typename T>
bool OMK::Input< T >::realConnect ( OutputNT output  )  [inline, virtual]

the real connecting member function

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

Implements OMK::InputNT.

Definition at line 518 of file OMKInput.h.

References OMK::Input< T >::_connectedOutput, OMK::KernelAttribute::_owner, OMK::Input< T >::disconnect(), OMK::AbstractInput< T >::getConnectionEventId(), OMK::AbstractInput< T >::getConnectionToControlParameterEventId(), OMK::SimulatedObject::getController(), OMK::CurrentActiveObject::getCurrentActiveObject(), OMK::SimulatedObject::getName(), OMK::KernelAttribute::getName(), OMK::AbstractInput< T >::isConnectable(), OMERROR, OMK::KernelAttribute::printDebuggingInformation(), OMK::Input< T >::printDebuggingInformation(), and OMK::SimulatedObject::sendValuedEvent().

Referenced by OMK::Input< T >::connect(), and OMK::Input< T >::connectToControlParameter().

00519 {
00520   /* if the current active object isn't initialised or is the owner
00521    * of the input, proceed with connection
00522    */
00523   if( CurrentActiveObject::getCurrentActiveObject() == &_owner ||
00524       CurrentActiveObject::getCurrentActiveObject() == &_owner.getController() ||
00525       CurrentActiveObject::getCurrentActiveObject() == 0 )
00526   {
00527     // BEGIN TDTD add because problems with local objects // 10-04-2006
00528     if( _connectedOutput != 0 ) 
00529     {
00530       disconnect() ;
00531     }
00532     // END TDTD
00533     _connectedOutput = dynamic_cast< Output< T > * >( output ) ;
00534 
00535     if( _connectedOutput == 0 ) 
00536     {
00537       std::ostringstream msg ;
00538       printDebuggingInformation( msg ) ;
00539       if( output )
00540       {
00541         output->printDebuggingInformation( msg ) ;
00542       }
00543       OMERROR( msg.str()
00544                << ":-( Input::realConnect outpout is of wrong type or null" ) ;
00545       return false ;
00546     }
00547     else 
00548     {
00549       _connectedOutput->connectedMyself( this ) ;
00550       return true ;
00551     }
00552   }
00553   else if( isConnectable() )
00554   {
00555     ControlParameter<T> * controlParameter =
00556       dynamic_cast<ControlParameter<T> *>( output ) ;
00557     if( controlParameter == 0 )
00558     {
00559       CurrentActiveObject::getCurrentActiveObject()->sendValuedEvent(
00560         _owner,
00561         getConnectionEventId(),
00562         output->getName() ) ;
00563     }
00564     else
00565     {
00566       CurrentActiveObject::getCurrentActiveObject()->sendValuedEvent(
00567         _owner,
00568         getConnectionToControlParameterEventId(),
00569         output->getName() ) ;
00570     }
00571     return true ;
00572   }
00573   else
00574   {
00575     OMERROR( "Warning: " << _owner.getName() << "::" <<getName()
00576              << " is not connectable" ) ;
00577     return false ;
00578   }
00579 }


Member Data Documentation

template<typename T>
int OMK::Input< T >::_distanceToExactValueOfLastGet [protected]

distance To Exact Value Of Last Get 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.

Definition at line 240 of file OMKInput.h.

Referenced by OMK::Input< T >::get(), and OMK::Input< T >::getDistanceToExactValue().

template<typename T>
Output<T>* OMK::Input< T >::_connectedOutput [protected]

reference to the connected output

Definition at line 245 of file OMKInput.h.

Referenced by OMK::Input< T >::connect(), OMK::Input< T >::connectToControlParameter(), OMK::Input< T >::disconnect(), OMK::Input< T >::extract(), OMK::Input< T >::get(), OMK::Input< T >::getConnectedOutput(), OMK::Input< T >::getDateOfLastExactValue(), OMK::Input< T >::getLastExactValue(), OMK::Input< T >::insertInStream(), OMK::Input< T >::isConnected(), OMK::Input< T >::outputDestroyed(), OMK::Input< T >::realConnect(), and OMK::Input< T >::~Input().

template<typename T>
T OMK::Input< T >::_calculatedResult [protected]

cache for computations of approximated values using this cache enables get to return a reference to a value, which enables implementing get whithout unnecessary copy operations

Definition at line 251 of file OMKInput.h.

Referenced by OMK::Input< T >::get().

template<typename T>
InputConnectionEventListener<T>* OMK::Input< T >::_associatedEventListener [protected]

the event listener implementing default policy for connection by other objects

Definition at line 254 of file OMKInput.h.

Referenced by OMK::Input< T >::Input(), and OMK::Input< T >::~Input().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:01 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007