OMK::IAttributeT< PrmType, ModelType, AccessorType > Class Template Reference
[Attribute feature]

Attribute interface. More...

#include <OMKAttribute.h>

Inheritance diagram for OMK::IAttributeT< PrmType, ModelType, AccessorType >:

Inheritance graph
[legend]
Collaboration diagram for OMK::IAttributeT< PrmType, ModelType, AccessorType >:

Collaboration graph
[legend]
List of all members.

Accessors.

AccessorType _accessor
 The value of the attribute.
virtual const std::type_info & getModelTypeId () const
 return the model type of the attribut.
virtual const PrmTypeget () const
 Get the value of the attribute.
virtual void set (const PrmType &value)
 Set the value.

Creation of input and output.

Input< ModelType > * _input
 The associated input.
Output< ModelType > * _output
 The associated output.
virtual void createInput ()
 Creates the associated input.
virtual InputNTgetInput ()
 Returns the associated input.
Input< ModelType > * getInputT ()
 Returns the typed associated input.
virtual void createOutput ()
 Creates the associated output.
virtual OutputNTgetOutput ()
 Returns the associated output.
Output< ModelType > * getOutputT ()
 Returns the associated output.

Events processing to manage value setting.

virtual void sendIdAndValue (const Name &receiver, const EventIdentifier &eventId, const Name &attributeId)
 Sends the value to the receiver in a valued event with the specified event id.
virtual void sendValue (const Name &receiver, const EventIdentifier &eventId)
 Sends the value to the receiver with the specified event id.
virtual void fireIdAndValue (const EventIdentifier &eventId, const Name &attributeId)
 Sends the value to the listening objects in a valued event with the specified event id.
virtual void fireValue (const EventIdentifier &eventId)
 Sends the value to the listening objects to inform them of the current value.
bool processSetValueOf (ValuedEvent< ModelType > *e)
 The call back method to process the update of the attribute value.
virtual bool processSetValue (IdAndValueEvent *e)
 The call back method to process the update of the attribute value.

Public Types

typedef std::pair< Name, ModelType > IdAndValuePrm
 The type of the data to update or retrieve the attibute value.

Public Member Functions

 DECLARE_TYPE_EVENT_LISTENER (IdAndValuePrm, IdAndValue, EventTypeForAttributeT< ModelType >)
 The type of the event to update or retrieve the attibute value.
Updating value according to the input or output.
virtual void getValueFromInput ()
 Sets the attribute value with the one retrived in the associated input.
virtual void setValueToOutput ()
 Sets the output value with the one retrived in the attribute.
Activation of event processing.
virtual void activateSetByEvent ()
 Activate the handling of "current_value" event.
virtual void activateSetByEventOf ()
 Activate the handling of "current_value_of_<i>id</i>" event.
Services for additional inputs.
use by connectors.

virtual InputNTcreateInput (const Name &name)
 Creates an input with the good type.
virtual void getValueFromInput (InputNT *input)
 Retrieves the value in the given input to set the attribute value.
virtual void getValueFromInput (PrmType &value, InputNT *input, int deltaT=0) const
 Retrieves the value in the given input.

Detailed Description

template<typename PrmType, typename ModelType, typename AccessorType>
class OMK::IAttributeT< PrmType, ModelType, AccessorType >

Attribute interface.

Date:
2007-05-01
Author:
BenoƮt Chanclou
This class defines an interface class and is the ancestor class for attrribute templated class (AttributeT and sons). It is a part of the attribute services.

This class is the full implementation of the attribute interface IAttribute, see it for more details.

There is three template arguments

Definition at line 153 of file OMKAttribute.h.


Member Typedef Documentation

template<typename PrmType, typename ModelType, typename AccessorType>
typedef std::pair< Name, ModelType > OMK::IAttributeT< PrmType, ModelType, AccessorType >::IdAndValuePrm

The type of the data to update or retrieve the attibute value.

This is a pair in which the first item is an id and the second is the value.

See sendValue and fireValue.

Reimplemented from OMK::EventTypeForAttributeT< ModelType >.

Definition at line 156 of file OMKAttribute.h.


Constructor & Destructor Documentation

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::IAttributeT< PrmType, ModelType, AccessorType >::IAttributeT ( const Name id,
const AccessorType &  init 
) [protected]

Constructor.

Parameters:
[in] id See _id.
[in] init The accessor to intialise.
The attributes use the default copy constructor of the accessor. Be carreful if you create a new kind of accessor, be sure to have a copy constructor to use it for attribute, the default one is used for the three base accessors.

Definition at line 76 of file OMKAttribute.inl.

00077 : OMK::IAttributeBaseT< PrmType >( id ),
00078   _accessor( init ),
00079   _input( 0 ),
00080   _output( 0 )
00081 {
00082 }

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::IAttributeT< PrmType, ModelType, AccessorType >::~IAttributeT (  )  [virtual]

Destructor.

Disconnect and delete the associated input.The output cannot be delete it stay alive but is no more updated

Definition at line 86 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_input, OMK::IAttribute::_owner, OMK::SimulatedObject::deleteInput(), OMK::Input< T >::disconnect(), and OMK::KernelAttribute::getName().

00087 {
00088   // disconnect and delete the associated input
00089   if( _input )
00090   {
00091     _input->disconnect() ; 
00092     this->_owner->deleteInput( _input->getName() ) ;
00093     _input = 0 ;
00094   }
00095   // The output cannot be delete it stay alive but is no more updated
00096 }

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::IAttributeT< PrmType, ModelType, AccessorType >::~IAttributeT (  )  [virtual]

Destructor.

Disconnect and delete the associated input.The output cannot be delete it stay alive but is no more updated

Definition at line 86 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_input, OMK::IAttribute::_owner, OMK::SimulatedObject::deleteInput(), OMK::Input< T >::disconnect(), and OMK::KernelAttribute::getName().

00087 {
00088   // disconnect and delete the associated input
00089   if( _input )
00090   {
00091     _input->disconnect() ; 
00092     this->_owner->deleteInput( _input->getName() ) ;
00093     _input = 0 ;
00094   }
00095   // The output cannot be delete it stay alive but is no more updated
00096 }

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::IAttributeT< PrmType, ModelType, AccessorType >::IAttributeT ( const Name id,
const AccessorType &  init 
) [protected]

Constructor.

Parameters:
[in] id See _id.
[in] init The accessor to intialise.
The attributes use the default copy constructor of the accessor. Be carreful if you create a new kind of accessor, be sure to have a copy constructor to use it for attribute, the default one is used for the three base accessors.

Definition at line 76 of file OMKAttribute.inl.

00077 : OMK::IAttributeBaseT< PrmType >( id ),
00078   _accessor( init ),
00079   _input( 0 ),
00080   _output( 0 )
00081 {
00082 }


Member Function Documentation

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::IAttributeT< PrmType, ModelType, AccessorType >::DECLARE_TYPE_EVENT_LISTENER ( IdAndValuePrm  ,
IdAndValue  ,
EventTypeForAttributeT< ModelType >   
)

The type of the event to update or retrieve the attibute value.

This is a pair encapsulated in a valued event in which the first item is an id and the second is the value.

See sendValue and fireValue.

Reimplemented from OMK::EventTypeForAttributeT< ModelType >.

template<typename PrmType, typename ModelType, typename AccessorType>
virtual const std::type_info& OMK::IAttributeT< PrmType, ModelType, AccessorType >::getModelTypeId (  )  const [inline, virtual]

return the model type of the attribut.

Returns:
the model type of the attribute as a std::type_info.

Implements OMK::IAttribute.

Definition at line 185 of file OMKAttribute.h.

00185 { return typeid( ModelType ) ; }

template<typename PrmType, typename ModelType, typename AccessorType>
virtual const PrmType& OMK::IAttributeT< PrmType, ModelType, AccessorType >::get (  )  const [inline, virtual]

Get the value of the attribute.

Returns:
The current value of the attribute.
Get the value through the accessor. See _accessor.

Implements OMK::IAccessorT< PrmType >.

Definition at line 190 of file OMKAttribute.h.

Referenced by OMK::Trajectory::computeParameters(), OMK::Tracker::computeParameters(), OMK::Orbit::computeParameters(), OMK::HumanoRecorder::computeParameters(), OMK::FixedPoint::computeParameters(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::fireIdAndValue(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::fireValue(), OMK::Inp::PlusMinusExtension< T >::increment(), OMK::Trajectory::loadParameters(), OMK::Tracker::loadParameters(), OMK::Orbit::loadParameters(), OMK::FixedPoint::loadParameters(), OMK::TriggerBaseExtension::preComputeParameters(), OMK::PreOffsetExtension::preComputeParameters(), OMK::NotAttributeExtension::preComputeParameters(), OMK::MKMMoveToTaskExtension::preComputeParameters(), OMK::MKMMotionTaskExtension::preComputeParameters(), OMK::MKMHeadToTaskExtension::preComputeParameters(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::sendIdAndValue(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::sendValue(), OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::setValueToOutput(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::setValueToOutput().

00191   {
00192     return _accessor.AccessorType::get() ; 
00193   }

template<typename PrmType, typename ModelType, typename AccessorType>
virtual void OMK::IAttributeT< PrmType, ModelType, AccessorType >::set ( const PrmType value  )  [inline, virtual]

Set the value.

Parameters:
[in] value The new value of the attribute.
Set the value through the accessor. See _accessor. Set the _updated flag to true.

Implements OMK::IAccessorT< PrmType >.

Definition at line 198 of file OMKAttribute.h.

Referenced by OMK::Trajectory::computeParameters(), OMK::Tracker::computeParameters(), OMK::Orbit::computeParameters(), OMK::MKMHumano::computeParameters(), OMK::HumanoPlayer::computeParameters(), OMK::FixedPoint::computeParameters(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::getValueFromInput(), OMK::Inp::PlusMinusExtension< T >::loadExtensionParameters(), OMK::Trajectory::loadParameters(), OMK::FixedPoint::loadParameters(), OMK::NotAttributeExtension::postComputeParameters(), OMK::DistanceToExtension::preComputeParameters(), OMK::NotAttributeExtension::preComputeParameters(), OMK::MKMMoveToTaskExtension::preComputeParameters(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::processSetValue(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::processSetValueOf().

00199   {
00200     this->_updated = true ;
00201     _accessor.AccessorType::set( value ) ; 
00202   }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::createInput (  )  [virtual]

Creates the associated input.

The value will be retrieved with getValueFromInput().

Implements OMK::IAttribute.

Definition at line 133 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_input, OMK::IAttribute::_owner, OMK::IAttribute::getId(), and OMASSERTM.

00134 {
00135   OMASSERTM( !_input, "There is already an input!" ) ;
00136 
00137   _input = &this->_owner->template addInput< ModelType >( getId() ) ;
00138 }

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::InputNT * OMK::IAttributeT< PrmType, ModelType, AccessorType >::getInput (  )  [virtual]

Returns the associated input.

Returns:
The associated input. See _input.
This input is not typed. So you cannot get the value, in fact, the value should be retrieved in the attribute. If you need the history features of the input see getValueFromInput.

Implements OMK::IAttribute.

Definition at line 160 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_input.

Referenced by OMK::Tracker::computeParameters(), and OMK::Iii::JointExtension::postComputeParameters().

00161 {
00162   return _input ;
00163 }

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::Input< ModelType > * OMK::IAttributeT< PrmType, ModelType, AccessorType >::getInputT (  ) 

Returns the typed associated input.

Returns:
The typed associated input. See _input.
This input is typed. It is not very usefull because the value should be retrieved in the attribute. If you need the history features of the input see getValueFromInput.

Definition at line 174 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_input.

00175 {
00176   return _input ;
00177 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::createOutput (  )  [virtual]

Creates the associated output.

The call to this method must be done during the creation of the object which is the owner of the attribute.

The output will be set with setValueToOutput.

Implements OMK::IAttribute.

Definition at line 149 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_output, OMK::IAttribute::_owner, OMK::IAttribute::getId(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::setValueToOutput().

00150 {
00151   if( !_output )
00152   {
00153     _output = &this->_owner->template addOutput< ModelType >( getId() ) ;
00154   }
00155   setValueToOutput() ;
00156 }

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::OutputNT * OMK::IAttributeT< PrmType, ModelType, AccessorType >::getOutput (  )  [virtual]

Returns the associated output.

Returns:
The associated output. See _output.
To set the value of the output, you must use setValueToOutput.

Implements OMK::IAttribute.

Definition at line 167 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_output.

00168 {
00169   return _output ;
00170 }

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::Output< ModelType > * OMK::IAttributeT< PrmType, ModelType, AccessorType >::getOutputT (  ) 

Returns the associated output.

Returns:
The typed associated output. See _output.

Definition at line 181 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_output.

00182 {
00183   return _output ;
00184 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::getValueFromInput (  )  [virtual]

Sets the attribute value with the one retrived in the associated input.

If the associated input is not already created, the attribute value stays unchanged. The input can be created with the method createInput.

If you need the history features of the input, you must use getValueFromInput whith arguments.

 AttributeT< Type > attribute( "myAttribute", Type() ) ;
 ...
 attribute.createInput() ;
 ...
 Type oldValue ;
 attribute.getValueFromInput( oldValue, attribute.getInput(), oldTime ) ;

Implements OMK::IAttribute.

Definition at line 188 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_input, OMK::Input< T >::get(), OMK::Input< T >::getConnectedOutput(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::set().

00189 {
00190   if( _input && _input->getConnectedOutput() )
00191   {
00192     set( static_cast< const PrmType & >( _input->get() ) ) ;
00193   }
00194 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::setValueToOutput (  )  [virtual]

Sets the output value with the one retrived in the attribute.

If the associated output is not created this method does nothing. The output can be created with the method createOutput.

Implements OMK::IAttribute.

Reimplemented in OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >, OMK::IAttributeAnimatorT< PrmType, PrmType, OMK::AccessorFctT< PrmType, ObjectType > >, OMK::IAttributeAnimatorT< PrmType, OMK::Type::SimpleTypeT< PrmType >, OMK::AccessorAccT< PrmType, PrmAccType > >, OMK::IAttributeAnimatorT< PrmType, PrmType, OMK::AccessorAccT< PrmType, PrmAccType > >, OMK::IAttributeAnimatorT< PrmType, PrmType, OMK::AccessorT< PrmType > >, OMK::IAttributeAnimatorT< PrmType, OMK::Type::SimpleTypeT< PrmType >, OMK::AccessorT< PrmType > >, and OMK::IAttributeAnimatorT< PrmType, OMK::Type::SimpleTypeT< PrmType >, OMK::AccessorFctT< PrmType, ObjectType > >.

Definition at line 220 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::_output, OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), and OMK::Output< T >::set().

Referenced by OMK::IAttributeT< PrmType, ModelType, AccessorType >::createOutput(), OMK::Trajectory::loadParameters(), and OMK::Orbit::loadParameters().

00221 {
00222   if( _output )
00223   {
00224     _output->set( ModelType( get() ) ) ;
00225   }
00226 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::sendIdAndValue ( const Name receiver,
const EventIdentifier eventId,
const Name attributeId 
) [virtual]

Sends the value to the receiver in a valued event with the specified event id.

See IAttribute::sendIdAndValue.

Implements OMK::IAttribute.

Definition at line 249 of file OMKAttribute.inl.

References OMK::IAttribute::_owner, OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), and OMK::SimulatedObject::sendValuedEvent().

00250 {
00251   this->_owner->sendValuedEvent( receiver, eventId, IdAndValueType( IdAndValuePrm( attributeId, ModelType( get() ) ) ) ) ;
00252 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::sendValue ( const Name receiver,
const EventIdentifier eventId 
) [virtual]

Sends the value to the receiver with the specified event id.

See IAttribute::sendValue.

Implements OMK::IAttribute.

Definition at line 256 of file OMKAttribute.inl.

References OMK::IAttribute::_owner, OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), and OMK::SimulatedObject::sendValuedEvent().

00257 {
00258   this->_owner->sendValuedEvent( receiver, eventId, ModelType( get() ) ) ;
00259 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::fireIdAndValue ( const EventIdentifier eventId,
const Name attributeId 
) [virtual]

Sends the value to the listening objects in a valued event with the specified event id.

See IAttribute::fireIdAndValue.

Implements OMK::IAttribute.

Definition at line 263 of file OMKAttribute.inl.

References OMK::IAttribute::_owner, OMK::SimulatedObject::fireValuedSignal(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), and OMK::IAttribute::getId().

00264 {
00265   this->_owner->fireValuedSignal( eventId, IdAndValueType( IdAndValuePrm( getId(), ModelType( get() ) ) ) ) ;
00266 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::fireValue ( const EventIdentifier eventId  )  [virtual]

Sends the value to the listening objects to inform them of the current value.

See IAttribute::fireValue.

Implements OMK::IAttribute.

Definition at line 270 of file OMKAttribute.inl.

References OMK::IAttribute::_owner, OMK::SimulatedObject::fireValuedSignal(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::get().

00271 {
00272   this->_owner->fireValuedSignal( eventId, ModelType( get() ) ) ;
00273 }

template<typename PrmType, typename ModelType, typename AccessorType>
bool OMK::IAttributeT< PrmType, ModelType, AccessorType >::processSetValueOf ( ValuedEvent< ModelType > *  e  )  [protected]

The call back method to process the update of the attribute value.

Parameters:
[in] e The valued event which encapsulate the new value.
Returns:
true if processed.
Use activateSetByEventOf to activate this feature. You can use sendValue or fireSignal with the good attributeId and genericId set to false to send the event.

Definition at line 229 of file OMKAttribute.inl.

References OMK::IAttributeT< PrmType, ModelType, AccessorType >::set(), and OMK::ValuedEvent< UserType >::value.

00230 {
00231   set( static_cast< const PrmType & >( e->value ) ) ;
00232   return true ;
00233 }

template<typename PrmType, typename ModelType, typename AccessorType>
bool OMK::IAttributeT< PrmType, ModelType, AccessorType >::processSetValue ( IdAndValueEvent *  e  )  [protected, virtual]

The call back method to process the update of the attribute value.

Parameters:
[in] e The valued event which encapsulate the attribute id and the new value. If the attibute id is not the good one, nothing is done.
Returns:
true if processed.
Use activateSetByEvent to activate this feature. You can use sendValue or fireSignal with the good attributeId and genericId set to true to send the event.

Implements OMK::EventTypeForAttributeT< ModelType >.

Definition at line 237 of file OMKAttribute.inl.

References OMK::IAttribute::getId(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::set().

00238 {
00239   bool ok = e && ( getId() == e->value.getValue().first ) ; 
00240   if( ok )
00241   {
00242     set( static_cast< const PrmType & >( e->value.getValue().second ) ) ;
00243   }
00244   return ok ;
00245 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::activateSetByEvent (  )  [virtual]

Activate the handling of "current_value" event.

Creates the listener for the event to handle.

Implements OMK::IAttribute.

Definition at line 100 of file OMKAttribute.inl.

References OMK::IAttribute::_currentValueListener, OMK::EventId::CURRENT_ATTRIBUTE_VALUE, OMK::debugMsg(), OMK_DEBUG_OMK_ATTR, and OMTRACEID.

00101 {
00102   if( !this->_currentValueListener )
00103   {
00104     this->_currentValueListener = new IdAndValueEventListener
00105         ( * this->_owner, this, 
00106         (typename IdAndValueEventListener::CallBackFct)&OMK::IAttributeT< PrmType, ModelType, AccessorType >::processSetValue, 
00107         EventId::CURRENT_ATTRIBUTE_VALUE ) ;
00108     OMTRACEID( OMK_DEBUG_OMK_ATTR, 
00109       "Information for " << OMK::debugMsg( this ) << std::endl
00110       << ">>> :-) Set by event is activated!" ) ;
00111   }
00112 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::activateSetByEventOf (  )  [virtual]

Activate the handling of "current_value_of_<i>id</i>" event.

Creates the listener for the event to handle.

Implements OMK::IAttribute.

Definition at line 116 of file OMKAttribute.inl.

References OMK::IAttribute::_currentValueOfListener, OMK::IAttribute::_owner, OMK::debugMsg(), OMK_DEBUG_OMK_ATTR, and OMTRACEID.

00117 {
00118   if( !this->_currentValueOfListener )
00119   {
00120     this->_currentValueOfListener = new ValuedEventListenerCallBack< OMK::IAttributeT< PrmType, ModelType, AccessorType >, ModelType >
00121       ( * this->_owner, this, 
00122         ( typename ValuedEventListenerCallBack< OMK::IAttributeT< PrmType, ModelType, AccessorType >, ModelType >::CallBackFct)&OMK::IAttributeT< PrmType, ModelType, AccessorType >::processSetValueOf, 
00123           this->_currentValueOfId ) ;
00124     OMTRACEID( OMK_DEBUG_OMK_ATTR, 
00125       "Information for " << OMK::debugMsg( this ) << std::endl
00126           << ">>> :-) Set by event \"" << this->_currentValueOfId.getCString() 
00127       << "\" is activated!" ) ;
00128   }
00129 }

template<typename PrmType, typename ModelType, typename AccessorType>
OMK::InputNT * OMK::IAttributeT< PrmType, ModelType, AccessorType >::createInput ( const Name name  )  [virtual]

Creates an input with the good type.

Parameters:
[in] name The name of the input to create.
The value will be retrieved with getValueFromInput to set the attribute or with getValueFromInput to get the value, this last method needs a type.

Implements OMK::IAttribute.

Definition at line 142 of file OMKAttribute.inl.

References OMK::IAttribute::_owner.

00143 {
00144   return &this->_owner->template addInput< ModelType >( name ) ;
00145 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::getValueFromInput ( InputNT input  )  [virtual]

Retrieves the value in the given input to set the attribute value.

Parameters:
[in] input The input in which the value will be retrieved.
If the input is not valid (null, of the wrong type or not connected) the attribute value stays unchanged. The input should be created with the method createInput.

If you need the history features of the input, you must use getValueFromInput whith arguments.

Implements OMK::IAttributeBaseT< PrmType >.

Definition at line 198 of file OMKAttribute.inl.

References OMK::Input< T >::get(), OMK::Input< T >::getConnectedOutput(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::set().

00199 {
00200   Input< ModelType >*typedInput = dynamic_cast< Input< ModelType >* >( input ) ;
00201   if( typedInput && typedInput->getConnectedOutput() )
00202   {
00203     set( static_cast< const PrmType & >( typedInput->get() ) ) ;
00204   }
00205 }

template<typename PrmType, typename ModelType, typename AccessorType>
void OMK::IAttributeT< PrmType, ModelType, AccessorType >::getValueFromInput ( PrmType value,
InputNT input,
int  deltaT = 0 
) const [virtual]

Retrieves the value in the given input.

Parameters:
[out] value The returned value.
[in] input The input in which the value will be retrieved. It was previously created by the call to createInput.
[in] deltaT The time of the asked value.
If the input is not valid (null, of the wrong type or not connected) the value stays unchanged. The input should be created with the method createInput.

If you need the history features of the input, you can specify the deltaT value.

 AttributeT< Type > attribute( "myAttribute", Type() ) ;
 ...
 InputNT* myInput = attribute.createInput( "myInput" ) ;
 ...
 Type oldValue ;
 attribute.getValueFromInput( oldValue, myInput, oldTime ) ;

Implements OMK::IAttributeBaseT< PrmType >.

Definition at line 209 of file OMKAttribute.inl.

References OMK::Input< T >::get(), and OMK::Input< T >::getConnectedOutput().

00210 {
00211   Input< ModelType >*typedInput = dynamic_cast< Input< ModelType >* >( input ) ;
00212   if( typedInput && typedInput->getConnectedOutput() ) 
00213   { 
00214     value = static_cast< const PrmType & >( typedInput->get( deltaT ) ) ;
00215   }
00216 }


Member Data Documentation

template<typename PrmType, typename ModelType, typename AccessorType>
AccessorType OMK::IAttributeT< PrmType, ModelType, AccessorType >::_accessor [protected]

The value of the attribute.

This value is reached through an accessor defined as a template argument.

Definition at line 206 of file OMKAttribute.h.

Referenced by OMK::IAttributeT< PrmType, OMK::Type::SimpleTypeT< PrmType >, OMK::AccessorFctT< PrmType, ObjectType > >::get(), OMK::AttributeAnimatorTypeT< PrmType >::getRef(), OMK::AttributeAnimatorT< PrmType >::getRef(), OMK::AttributeTypeT< PrmType >::getRef(), OMK::AttributeT< OMK::Type::Transform >::getRef(), OMK::IAttributeT< PrmType, OMK::Type::SimpleTypeT< PrmType >, OMK::AccessorFctT< PrmType, ObjectType > >::set(), OMK::AttributeAnimatorAccTypeT< PrmType, PrmAccType >::setAccessor(), OMK::AttributeAnimatorAccT< PrmType, PrmAccType >::setAccessor(), OMK::AttributeAccTypeT< PrmType, PrmAccType >::setAccessor(), and OMK::AttributeAccT< Type, AttributType >::setAccessor().

template<typename PrmType, typename ModelType, typename AccessorType>
Input< ModelType >* OMK::IAttributeT< PrmType, ModelType, AccessorType >::_input [protected]

The associated input.

The associated input is created by a call to createInput whithout argument.

Definition at line 247 of file OMKAttribute.h.

Referenced by OMK::IAttributeT< PrmType, ModelType, AccessorType >::createInput(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::getInput(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::getInputT(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::getValueFromInput(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::~IAttributeT().

template<typename PrmType, typename ModelType, typename AccessorType>
Output< ModelType >* OMK::IAttributeT< PrmType, ModelType, AccessorType >::_output [protected]

The associated output.

The associated output is created by a call to createOutput and is set with calls to setValueToOutput.

Definition at line 251 of file OMKAttribute.h.

Referenced by OMK::IAttributeT< PrmType, ModelType, AccessorType >::createOutput(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::getOutput(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::getOutputT(), OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::setValueToOutput(), and OMK::IAttributeT< PrmType, ModelType, AccessorType >::setValueToOutput().


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007