#include <OMKAttributeAnimator.h>
Inheritance diagram for OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >:
Initialisation. | |
virtual bool | loadParameters (const ConfigurationParameterDescriptor *node, const std::string *aliasName) |
Configuration parameters loader of IAttribute. | |
virtual bool | initAnimator (const ConfigurationParameterDescriptor *node, const std::string *aliasName) |
bool | initAnimator (const ConfigurationParameterDescriptor *node=0) |
bool | initAnimator (const ConfigurationParameterDescriptor *node, const std::string &aliasName) |
Public Member Functions | |
Updating value according to the output. | |
virtual void | setValueToOutput () |
Sets the output value with the one retrived in the attribute. | |
Protected Types | |
enum | { TYPE_UNINITIALISED = 0, TYPE_OUTPUT, TYPE_EVENT_LOCAL_VISU, TYPE_SIGNAL_ALL_VISU } |
Protected Attributes | |
Name | _localVisu |
EventIdentifier | _eventId |
Name | _eventBaseId |
enum OMK::IAttributeAnimatorT:: { ... } | _type |
This class is a full implementation of the attribute interface IAttribute, see it for more details.
There is three template arguments
obj { UserParams { FooAnimator { Class AnimatorClassId VisualObject theIdOfVisualObjectWhichWillBeTheOwnerOfTheAnimator VisuName localVisualisationId // Optional if the animator is only for one visualisation ... // Other parameters for the animator, depends of its class } Foo theInitialValueOfFoo FooOutput true ... // Other "Foo" parameters like FooConnectTo,... see "IAttribute" } }
Creation
of the animator If the parameter VisuName is set the attribute will send an event to create the animator according to the parameters included in the xxxAnimator field. Update
of the animator If a output is defined for the attribut (by setting the paramater xxxOutput, or by calling the addAttribute with the second parameter set to true) the animator will be updated through this output. If not and if the parameter VisuName is set the attribute instead of output will send an event to the indicated visualisation, else if the parameter is not set, the attribute will fire a signal to all visualisation.
Definition at line 102 of file OMKAttributeAnimator.h.
anonymous enum [protected] |
Definition at line 160 of file OMKAttributeAnimator.h.
00161 { 00162 TYPE_UNINITIALISED = 0, 00163 TYPE_OUTPUT, 00164 TYPE_EVENT_LOCAL_VISU, 00165 TYPE_SIGNAL_ALL_VISU 00166 } _type ;
OMK::IAttributeAnimatorT< Type, ModelType, AccessorType >::IAttributeAnimatorT | ( | const Name & | id, | |
const AccessorType & | init | |||
) | [protected] |
Constructor.
[in] | id | See _id. |
[in] | init | The accessor to intialise. |
Definition at line 431 of file OMKAttributeAnimator.h.
00432 : IAttributeT< Type, ModelType, AccessorType >( id, init ), 00433 _localVisu(), 00434 _type( TYPE_UNINITIALISED ) 00435 { 00436 }
OMK::IAttributeAnimatorT< Type, ModelType, AccessorType >::~IAttributeAnimatorT | ( | ) | [virtual] |
Destructor.
Disconnect and delete the associated input.The output cannot be delete it stay alive but is no more updated
Definition at line 440 of file OMKAttributeAnimator.h.
OMK::IAttributeAnimatorT< Type, ModelType, AccessorType >::IAttributeAnimatorT | ( | const Name & | id, | |
const AccessorType & | init | |||
) | [protected] |
Constructor.
[in] | id | See _id. |
[in] | init | The accessor to intialise. |
Definition at line 431 of file OMKAttributeAnimator.h.
00432 : IAttributeT< Type, ModelType, AccessorType >( id, init ), 00433 _localVisu(), 00434 _type( TYPE_UNINITIALISED ) 00435 { 00436 }
OMK::IAttributeAnimatorT< Type, ModelType, AccessorType >::~IAttributeAnimatorT | ( | ) | [virtual] |
Destructor.
Disconnect and delete the associated input.The output cannot be delete it stay alive but is no more updated
Definition at line 440 of file OMKAttributeAnimator.h.
bool OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::loadParameters | ( | const ConfigurationParameterDescriptor * | node, | |
const std::string * | aliasName | |||
) | [protected, virtual] |
Configuration parameters loader of IAttribute.
See the ancestor.
Set the needed parameters to create the associated animator.
Reimplemented from OMK::IAttributeBaseT< PrmType >.
Definition at line 447 of file OMKAttributeAnimator.h.
References OMK::ParametersAccessor::get(), OMK::EventId::getCurrentValueEventId(), OMASSERTM, and OMK::ParametersAccessor::set().
00448 { 00449 std::string strId( aliasName ? *aliasName : getId().getCString() ) ; 00450 bool ok = true ; 00451 const ConfigurationParameterDescriptor * animatorNode = 0 ; 00452 ok = ok && ParametersAccessor::get( node, strId + "Animator", animatorNode ) ; 00453 ok = ok && animatorNode != 0 ; 00454 00455 // Set the type of connection with the animator 00456 // Look for visualisation name (the same as AddAnimatorPrm::loadParameters) 00457 bool localVisu = ParametersAccessor::get( animatorNode, "VisuName", _localVisu ) ; 00458 // If there is an output => force to output 00459 _type = _output ? TYPE_OUTPUT : ( localVisu ? TYPE_EVENT_LOCAL_VISU : TYPE_SIGNAL_ALL_VISU ) ; 00460 00461 _eventBaseId = _owner->getName().getString() + "_" + getId().getString() + "_animator" ; 00462 _eventId = OMK::EventId::getCurrentValueEventId( _eventBaseId.getString() ) ; 00463 // Load the parameters to create the connection for the animator 00464 ConfigurationParameterDescriptor * modifiedAnimatorNode = const_cast< ConfigurationParameterDescriptor* >( animatorNode ) ; 00465 switch( _type ) 00466 { 00467 case TYPE_OUTPUT: 00468 ParametersAccessor::set( modifiedAnimatorNode, "ConnectTo", std::pair< Name, Name >( _owner->getName(), _output->getName() )) ; 00469 break ; 00470 case TYPE_EVENT_LOCAL_VISU : 00471 ParametersAccessor::set( modifiedAnimatorNode, "ListenedEvent", _eventId ) ; 00472 break ; 00473 case TYPE_SIGNAL_ALL_VISU : 00474 ParametersAccessor::set( modifiedAnimatorNode, "ListenedEvent", _eventId ) ; 00475 ParametersAccessor::set( modifiedAnimatorNode, "Emitter", _owner->getName() ) ; 00476 break ; 00477 default: 00478 OMASSERTM( false, "Cannot create the animator" ) ; 00479 } 00480 return ok && IAttributeT< PrmType, ModelType, AccessorType >::loadParameters( node, aliasName ) ; 00481 }
bool OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::initAnimator | ( | const ConfigurationParameterDescriptor * | node = 0 |
) | [inline] |
Definition at line 142 of file OMKAttributeAnimator.h.
Referenced by OMK::IAttributeAnimatorT< PrmType, OMK::Type::SimpleTypeT< PrmType >, OMK::AccessorFctT< PrmType, ObjectType > >::initAnimator().
00142 { return initAnimator( node, 0 ) ; }
bool OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::initAnimator | ( | const ConfigurationParameterDescriptor * | node, | |
const std::string & | aliasName | |||
) | [inline] |
Definition at line 143 of file OMKAttributeAnimator.h.
00143 { return initAnimator( node, &aliasName ) ; }
bool OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::initAnimator | ( | const ConfigurationParameterDescriptor * | node, | |
const std::string * | aliasName | |||
) | [protected, virtual] |
Definition at line 485 of file OMKAttributeAnimator.h.
References OMK::Vis::VisBase::ADD_ANIMATOR_EVENT_ID, OMK::ConfigurationParameterDescriptor::clone(), OMK::ParametersAccessor::get(), OMK::Type::AddAnimatorPrm::getObjectName(), OMK::Type::AddAnimatorPrm::loadParameters(), OMASSERTM, OMK::Type::AddAnimatorPrm::setConfigParam(), and OMK::Type::AddAnimatorPrm::setObjectName().
00486 { 00487 node = node ? node : _owner->getConfigurationParameters() ; 00488 std::string strId( aliasName ? *aliasName : getId().getCString() ) ; 00489 bool ok = true ; 00490 const ConfigurationParameterDescriptor * animatorNode = 0 ; 00491 ok = ok && ParametersAccessor::get( node, strId + "Animator", animatorNode ) ; 00492 // OMMESSAGE( "Config " << *animatorNode); 00493 ok = ok && animatorNode != 0 ; 00494 00495 00496 OMK::Type::AddAnimatorPrm animatorPrm ; 00497 animatorPrm.loadParameters( animatorNode ) ; 00498 animatorPrm.setConfigParam( animatorNode->clone() ); 00499 // if name is not defined, defines one 00500 if( animatorPrm.getObjectName() == Name() ) animatorPrm.setObjectName( _eventBaseId.getString() ) ; 00501 00502 if( ok ) 00503 { 00504 //Don't send a signal if it's a local object ie on only one visu 00505 if( Name() != _localVisu ) 00506 { 00507 _owner->sendValuedEvent( _localVisu, 00508 OMK::Vis::VisBase::ADD_ANIMATOR_EVENT_ID, animatorPrm ) ; 00509 } 00510 else 00511 { 00512 _owner->fireValuedSignal( OMK::Vis::VisBase::ADD_ANIMATOR_EVENT_ID, animatorPrm ) ; 00513 } 00514 } 00515 else 00516 { 00517 OMASSERTM(false, "Unable to create the animator, have you forget some parameters?" << *animatorNode ) ; 00518 } 00519 return ok; 00520 00521 }
void OMK::IAttributeAnimatorT< Type, 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.
Reimplemented from OMK::IAttributeT< PrmType, ModelType, AccessorType >.
Definition at line 524 of file OMKAttributeAnimator.h.
References OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::_eventBaseId, OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::_localVisu, OMK::IAttributeT< PrmType, ModelType, AccessorType >::_output, OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::_type, OMK::IAttribute::fireValueTo(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::get(), OMK::EventId::getCurrentValueEventId(), OMK::IAttribute::isUpdated(), OMASSERTM, OMERROR, OMTRACEID, OMK::IAttribute::sendValueTo(), OMK::Output< T >::set(), OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::TYPE_EVENT_LOCAL_VISU, OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::TYPE_OUTPUT, OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::TYPE_SIGNAL_ALL_VISU, and OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::TYPE_UNINITIALISED.
00525 { 00526 if ( isUpdated() ) 00527 OMTRACEID("Attribute","Attr Updated " << EventId::getCurrentValueEventId( this->_id.getCString()) << " current :"<< _eventBaseId); 00528 00529 switch( _type ) 00530 { 00531 case TYPE_OUTPUT: 00532 _output->set( ModelType( get() ) ) ; 00533 break ; 00534 case TYPE_EVENT_LOCAL_VISU : 00535 if( isUpdated() ) sendValueTo( _localVisu, _eventBaseId, false ) ; 00536 break ; 00537 case TYPE_SIGNAL_ALL_VISU : 00538 if( isUpdated() ) fireValueTo( _eventBaseId, false ) ; 00539 break ; 00540 case TYPE_UNINITIALISED : 00541 OMERROR( "The attribute is not initialised, call loadParameters()" ) ; 00542 if ( _output ) 00543 _output->set( ModelType( get() ) ) ; 00544 break; 00545 default: 00546 OMASSERTM( false, "Cannot update the animator" ) ; 00547 } 00548 }
Name OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::_localVisu [protected] |
Definition at line 157 of file OMKAttributeAnimator.h.
Referenced by OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::setValueToOutput().
EventIdentifier OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::_eventId [protected] |
Definition at line 158 of file OMKAttributeAnimator.h.
Name OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::_eventBaseId [protected] |
Definition at line 159 of file OMKAttributeAnimator.h.
Referenced by OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::setValueToOutput().
enum { ... } OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::_type [protected] |
Documentation generated on Mon Jun 9 11:46:03 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |