OMK::Vis::AnimatorT< T > Class Template Reference

Animator which computes the visualisation with the associated value found by the plug. More...

#include <OMKAnimatorT.h>

Inheritance diagram for OMK::Vis::AnimatorT< T >:

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

Collaboration graph
[legend]
List of all members.

Protected Member Functions

Interface.
virtual void selfProcessVis (void)
 Called by the partner to process the visualisation.
virtual void selfProcessVis (const T &value)=0

Protected Attributes

AnimatorPlugT< T > * _plugValue
 The plug to retrieve the value.

Detailed Description

template<typename T>
class OMK::Vis::AnimatorT< T >

Animator which computes the visualisation with the associated value found by the plug.

Author:
Benoit Chanclou,bunraku <bchanclo@irisa.fr> The aim of this animator and its sons is to update the visual object, which they are associated to, through the plug which gets the value with an event or an output. If the plug doesn't use a valued event or an output, it should use OMK::Vis::Animator which is the untyped version of the animator.
This typed animator and its sons use a typed plug of type OMK::Vis::AnimatorEventPlugT or OMK::Vis::AnimatorInputPlugT which reacts to valued events or reads an input.
See also:
How animators find the values

Definition at line 49 of file OMKAnimatorT.h.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 140 of file OMKAnimatorT.h.

00141 {
00142 }

template<typename T>
OMK::Vis::AnimatorT< T >::AnimatorT ( VisualObject visualObject,
const Name id,
AnimatorPlugT< T > *  plug 
) [protected]

Constructor for sons.

Definition at line 93 of file OMKAnimatorT.h.

References OMK::Vis::AnimatorT< T >::_plugValue, and OMASSERT.

00094 : Animator( visualObject, id ),
00095   _plugValue( plug ) 
00096 {
00097   OMASSERT( _plugValue && "must be a well typed plug" ) ;
00098 }

template<typename T>
OMK::Vis::AnimatorT< T >::AnimatorT ( VisualObject visualObject,
const Name id,
const ConfigurationParameterDescriptor node 
) [protected]

Constructor for object factory OMK::Vis::ObjectFactory.

Definition at line 104 of file OMKAnimatorT.h.

References OMK::Vis::Animator::_plugUpdate, OMK::Vis::AnimatorT< T >::_plugValue, OMK::ParametersAccessor::get(), OMASSERT, OMK::Vis::VisBase::registerEventPlug(), and OMK::Vis::VisualObject::touchVis().

00105 : Animator( visualObject, id ),
00106   _plugValue( 0 )
00107 {
00108   std::pair< std::string, std::string > inputPrm ;
00109   if( ParametersAccessor::get( &node, "ConnectTo", inputPrm ) )
00110   { 
00111     // found parameters for input plug => retrieve the input and create the plug
00112     Input< T >* input( visualObject.touchVis().template createInput< T >( inputPrm.first, inputPrm.second ) ) ;
00113     if( input )
00114     {
00115       AnimatorInputPlugT< T >* inputPlug( new AnimatorInputPlugT< T >( input ) ) ;
00116       _plugUpdate = inputPlug ;
00117       _plugValue  = inputPlug ;
00118     }
00119     OMASSERT( ( _plugUpdate != NULL ) && "Must be a valid pointer to a new plug" ) ;
00120     OMASSERT( ( _plugValue != NULL ) && "Cannot be null, must be a valid plug" ) ;
00121   }
00122   else
00123   {
00124     // If configFile is not providing the EventId, EventId will be the id
00125     std::string eventId = id.getString() ;
00126     ParametersAccessor::get( &node, "ListenedEvent", eventId ) ; 
00127     AnimatorEventPlugT<T>* eventPlug( new AnimatorEventPlugT<T>( visualObject.touchVis(), EventIdentifier( eventId ) ) ) ;
00128     _plugUpdate = eventPlug ;
00129     _plugValue  = eventPlug ;
00130     std::string emitter ;
00131     ParametersAccessor::get( &node, "Emitter", emitter ) ;
00132     visualObject.touchVis().registerEventPlug( EventIdentifier( eventId ), emitter, eventPlug ) ;
00133   }
00134 }

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

Destructor.

Definition at line 140 of file OMKAnimatorT.h.

00141 {
00142 }

template<typename T>
OMK::Vis::AnimatorT< T >::AnimatorT ( VisualObject visualObject,
const Name id,
AnimatorPlugT< T > *  plug 
) [protected]

Constructor for sons.

Definition at line 93 of file OMKAnimatorT.h.

References OMK::Vis::AnimatorT< T >::_plugValue, and OMASSERT.

00094 : Animator( visualObject, id ),
00095   _plugValue( plug ) 
00096 {
00097   OMASSERT( _plugValue && "must be a well typed plug" ) ;
00098 }

template<typename T>
OMK::Vis::AnimatorT< T >::AnimatorT ( VisualObject visualObject,
const Name id,
const ConfigurationParameterDescriptor node 
) [protected]

Constructor for object factory OMK::Vis::ObjectFactory.

Definition at line 104 of file OMKAnimatorT.h.

References OMK::Vis::Animator::_plugUpdate, OMK::Vis::AnimatorT< T >::_plugValue, OMK::ParametersAccessor::get(), OMASSERT, OMK::Vis::VisBase::registerEventPlug(), and OMK::Vis::VisualObject::touchVis().

00105 : Animator( visualObject, id ),
00106   _plugValue( 0 )
00107 {
00108   std::pair< std::string, std::string > inputPrm ;
00109   if( ParametersAccessor::get( &node, "ConnectTo", inputPrm ) )
00110   { 
00111     // found parameters for input plug => retrieve the input and create the plug
00112     Input< T >* input( visualObject.touchVis().template createInput< T >( inputPrm.first, inputPrm.second ) ) ;
00113     if( input )
00114     {
00115       AnimatorInputPlugT< T >* inputPlug( new AnimatorInputPlugT< T >( input ) ) ;
00116       _plugUpdate = inputPlug ;
00117       _plugValue  = inputPlug ;
00118     }
00119     OMASSERT( ( _plugUpdate != NULL ) && "Must be a valid pointer to a new plug" ) ;
00120     OMASSERT( ( _plugValue != NULL ) && "Cannot be null, must be a valid plug" ) ;
00121   }
00122   else
00123   {
00124     // If configFile is not providing the EventId, EventId will be the id
00125     std::string eventId = id.getString() ;
00126     ParametersAccessor::get( &node, "ListenedEvent", eventId ) ; 
00127     AnimatorEventPlugT<T>* eventPlug( new AnimatorEventPlugT<T>( visualObject.touchVis(), EventIdentifier( eventId ) ) ) ;
00128     _plugUpdate = eventPlug ;
00129     _plugValue  = eventPlug ;
00130     std::string emitter ;
00131     ParametersAccessor::get( &node, "Emitter", emitter ) ;
00132     visualObject.touchVis().registerEventPlug( EventIdentifier( eventId ), emitter, eventPlug ) ;
00133   }
00134 }


Member Function Documentation

template<typename T>
void OMK::Vis::AnimatorT< T >::selfProcessVis ( void   )  [protected, virtual]

Called by the partner to process the visualisation.

This method calls the homonymous method with a typed argument, the argument value is got by the plug.

Implements OMK::Vis::Animator.

Definition at line 148 of file OMKAnimatorT.h.

References OMK::Vis::AnimatorT< T >::_plugValue.

00149 {
00150   selfProcessVis( _plugValue->getTypedValue() ) ;
00151 }

template<typename T>
virtual void OMK::Vis::AnimatorT< T >::selfProcessVis ( const T &  value  )  [protected, pure virtual]

Implemented in OMK::Vis::AwarenessAnimator< Type >, OMK::Vis::HumanoAnimator, and OMK::Vis::MaterialAnimator< Type >.


Member Data Documentation

template<typename T>
AnimatorPlugT<T>* OMK::Vis::AnimatorT< T >::_plugValue [protected]

The plug to retrieve the value.

Definition at line 86 of file OMKAnimatorT.h.

Referenced by OMK::Vis::AnimatorT< T >::AnimatorT(), and OMK::Vis::AnimatorT< T >::selfProcessVis().


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007