OMK::Type::AddAnimatorPrm Class Reference

Event processed by the visualisation to add a animator to a visual object. More...

#include <OMKAddAnimatorPrm.h>

Inheritance diagram for OMK::Type::AddAnimatorPrm:

Inheritance graph
[legend]
Collaboration diagram for OMK::Type::AddAnimatorPrm:

Collaboration graph
[legend]
List of all members.

Reset and loaders

virtual void resetDefaultValues ()
 Reset the default values of AddAnimatorPrm.
virtual bool loadParameters (const ConfigurationParameterDescriptor *node, const std::string &prefix="", SimulatedObject *p=0)
 Configuration parameters loader of AddAnimatorPrm.
bool innerParametersLoader (const ConfigurationParameterDescriptor *node, const std::string &prefix="", SimulatedObject *p=0)
 Protected loader, does not reset the default values.

Public Member Functions

Accessors to attributes.
void setObjectName (const Name &objectName)
 Set the objectName value of AddVisualObjectPrm.
const NamegetObjectName () const
 Return the objectName value of AddVisualObjectPrm.
void setClassId (const Name &classId)
 Set the classId value of AddAnimatorPrm.
const NamegetClassId () const
 Return the classId value of AddAnimatorPrm.
void setVisualObjectName (const Name &visualObjectName)
 Set the visualObjectName value of AddAnimatorPrm.
const NamegetVisualObjectName () const
 Return the visualObjectName value of AddAnimatorPrm.
void setVisuName (const Name &VisuName)
 Set the VisuName value of AddAnimatorPrm.
const NamegetVisuName () const
 Return the VisuName value of AddAnimatorPrm.
void setConfigParam (const ConfigurationParameterDescriptor *configParam)
 Set the configParam value of AddAnimatorPrm.
const ConfigurationParameterDescriptorgetConfigParam () const
 Return the configParam value of AddAnimatorPrm.
Operators.
bool operator== (const AddAnimatorPrm &ref) const
 Comparison operator for equality.
bool operator!= (const AddAnimatorPrm &ref) const
 Comparison operator for difference.
AddAnimatorPrmoperator= (const AddAnimatorPrm &ref)
 Copy operator.
Packable, Flowable, OMKType interfaces.
virtual void insertInStream (std::ostream &=std::cout) const
 Insert datas in an output stream.
virtual void extract (std::istream &=std::cin)
 Extract datas from an input stream.
virtual void pack (OutgoingSynchronisationMessage &out) const
 Pack datas in the message.
virtual void unpack (IncomingSynchronisationMessage &in)
 Unpack datas from the message.
virtual PolatorNTcreatePolator ()
 Default polator creator.

Protected Member Functions

void _copy (const AddAnimatorPrm &ref)
 Copy methods call by constructor and operator.

Protected Attributes

Datas
Name _objectName
 This member holds the ObjectName value of AddVisualObjectPrm.
Name _classId
 This member holds the Class value of AddAnimatorPrm.
Name _visualObjectName
 This member holds the VisualObjectName value of AddAnimatorPrm.
Name _visuName
 This member holds the VisuName value of AddAnimatorPrm.
const ConfigurationParameterDescriptor_configParam
 This member holds the configParam value of AddAnimatorPrm.

Detailed Description

Event processed by the visualisation to add a animator to a visual object.

Date:
generated the 2006-07-26 at 17:35:11
Module description :
Use it by derivation to add the necessary methods.
This event can be send to the visualisation to add an animator to a specific visual object.
Configuration parameters :

xxx is a prefix that you can add to call to loadParameters to differentiate parameters when two AddAnimatorPrm are used in the same object, see examples.

Optional parameters
The following parameters are optional and if one is missing in the configuration parameters calls to loadParameters always return true and never display message.
Needed parameters
The following parameters are needed and if one is missing in the configuration parameters calls to loadParameters return false and display a message.
Configuration examples
There is two ways to get the configuration parameters in the tree, the one with a prefix and the hierarchical one. The second one is the better.

With prefix
The following sample of configuration parameters shows way with the prefix
 myObject
 {
   Class ObjectWhichUsesAddAnimatorPrm
   Scheduling
   {
     Frequency 75
     Process processA
   }
   UserParams
   {
     // Optional parameters
     firstVisualObjectName <Name>
     firstVisuName <Name>
     firstConfigParam <ConfigurationParameterDescriptor>
     // Needed parameters
     firstClass <Name>
     secondClass <Name>

     //... other object parameters
   }
 }

To use these configuration parameters with prefix use the following codes:
In the header:
 class ObjectWhichUsesAddAnimatorPrm : public SimulatedObject
 {
   //...
  protected:
   AddAnimatorPrm _addAnimatorPrm1 ;
   AddAnimatorPrm _addAnimatorPrm2 ;
 } ;
In the source:
 void ObjectWhichUsesAddAnimatorPrm::init()
 {
   //...
   _addAnimatorPrm1.loadParameters( getConfigurationParameters(), "first" ) ;
   _addAnimatorPrm2.loadParameters( getConfigurationParameters(), "second" ) ;
 }

Hierarchical (better)
The hierarchical way is better because each node in the configuration tree create a name space. This avoids names conflicts with inherited parameters. It is easier to create configuration with multiple instances of AddAnimatorPrm by copying pasting the node
The following sample of configuration parameters shows hierarchical way
 myObject
 {
   Class ObjectWhichUsesAddAnimatorPrm
   Scheduling
   {
     Frequency 75
     Process processA
   }
   UserParams
   {
     firstAddAnimatorPrm
     {
       // Optional parameters
       VisualObjectName <Name>
       VisuName <Name>
       ConfigParam <ConfigurationParameterDescriptor>
       // Needed parameters
       Class <Name>
     }
     secondAddAnimatorPrm
     {
       // Optional parameters
       // Needed parameters
       Class <Name>
     }
     //... other object parameters
   }
 }

To use these hierarchical configuration parameters use the following codes:
The header is the same and in the source:
 void ObjectWhichUsesAddAnimatorPrm::init()
 {
   //...
   const ConfigurationParameterDescriptor* node = getConfigurationParameters();
   _addAnimatorPrm1.loadParameters( node ? node->getSubDescriptorByName( "firstAddAnimatorPrm"  ) : 0, "", this ) ;
   _addAnimatorPrm2.loadParameters( node ? node->getSubDescriptorByName( "secondAddAnimatorPrm" ) : 0, "", this ) ;
 }

Definition at line 159 of file OMKAddAnimatorPrm.h.


Constructor & Destructor Documentation

AddAnimatorPrm::AddAnimatorPrm (  ) 

Default constructor ofAddAnimatorPrm.

Definition at line 35 of file OMKAddAnimatorPrm.cpp.

00036 : Base(),
00037   _objectName() ,
00038   _classId(),
00039   _visualObjectName(),
00040   _visuName(),
00041   _configParam( 0 )
00042 {
00043 }

AddAnimatorPrm::AddAnimatorPrm ( const AddAnimatorPrm ref  ) 

Copy constructor of AddAnimatorPrm.

Definition at line 47 of file OMKAddAnimatorPrm.cpp.

References _copy().

00048 : Base(),
00049 _configParam( 0 )
00050 {
00051   _copy( ref ) ;
00052 }

AddAnimatorPrm::AddAnimatorPrm ( const Name objectName,
const Name classId,
const Name visualObjectName,
const Name VisuName,
const ConfigurationParameterDescriptor configParam 
)

Constructor of AddAnimatorPrm with all the parameters.

Definition at line 56 of file OMKAddAnimatorPrm.cpp.

00061 : Base(),
00062   _objectName( objectName ) ,
00063   _classId( classId ) ,
00064   _visualObjectName( visualObjectName ) ,
00065   _visuName( VisuName ) ,
00066   _configParam( configParam ? configParam->clone() : 0 ) 
00067 {
00068 }

AddAnimatorPrm::~AddAnimatorPrm (  )  [virtual]

Destructor of AddAnimatorPrm.

Definition at line 72 of file OMKAddAnimatorPrm.cpp.

References _configParam.

00073 {
00074   delete _configParam ;
00075 }

AddAnimatorPrm::AddAnimatorPrm (  ) 

Default constructor ofAddAnimatorPrm.

Definition at line 35 of file OMKAddAnimatorPrm.cpp.

00036 : Base(),
00037   _objectName() ,
00038   _classId(),
00039   _visualObjectName(),
00040   _visuName(),
00041   _configParam( 0 )
00042 {
00043 }

AddAnimatorPrm::AddAnimatorPrm ( const AddAnimatorPrm ref  ) 

Copy constructor of AddAnimatorPrm.

Definition at line 47 of file OMKAddAnimatorPrm.cpp.

References _copy().

00048 : Base(),
00049 _configParam( 0 )
00050 {
00051   _copy( ref ) ;
00052 }

AddAnimatorPrm::AddAnimatorPrm ( const Name objectName,
const Name classId,
const Name visualObjectName,
const Name VisuName,
const ConfigurationParameterDescriptor configParam 
)

Constructor of AddAnimatorPrm with all the parameters.

Definition at line 56 of file OMKAddAnimatorPrm.cpp.

00061 : Base(),
00062   _objectName( objectName ) ,
00063   _classId( classId ) ,
00064   _visualObjectName( visualObjectName ) ,
00065   _visuName( VisuName ) ,
00066   _configParam( configParam ? configParam->clone() : 0 ) 
00067 {
00068 }

AddAnimatorPrm::~AddAnimatorPrm (  )  [virtual]

Destructor of AddAnimatorPrm.

Definition at line 72 of file OMKAddAnimatorPrm.cpp.

References _configParam.

00073 {
00074   delete _configParam ;
00075 }


Member Function Documentation

void AddAnimatorPrm::resetDefaultValues (  )  [virtual]

Reset the default values of AddAnimatorPrm.

Definition at line 79 of file OMKAddAnimatorPrm.cpp.

References _classId, _configParam, _visualObjectName, and _visuName.

Referenced by loadParameters().

00080 {
00081   //=== Reset default parameters
00082   _classId = Name() ;
00083   _visualObjectName = Name() ;
00084   _visuName = Name() ;
00085   delete _configParam ;
00086   _configParam = 0 ;
00087 }

bool AddAnimatorPrm::loadParameters ( const ConfigurationParameterDescriptor node,
const std::string &  prefix = "",
SimulatedObject p = 0 
) [virtual]

Configuration parameters loader of AddAnimatorPrm.

Parameters:
[in] node the root node of the configuration parameter
[in] prefix the text that prefix the parameters name. No prefix by default. For example the parameter named "position" by default is loaded in the configuration parameters under the name "Position" (first is upper case), and with the prefix "first" will be loaded under the name "firstPosition" (could start with a lower case).
[in] p the simulated object use by the OMKParameterAccessor to display error messages.
Returns:
true if all needed parameters can be read else false.
Reads in the configuration node the values to set the attributs.

Definition at line 91 of file OMKAddAnimatorPrm.cpp.

References innerParametersLoader(), and resetDefaultValues().

Referenced by OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::initAnimator(), and OMK::Vis::VisObjectExtension::loadAnimatorParameters().

00094 {
00095   resetDefaultValues() ;
00096   return innerParametersLoader( node, prefix, p );
00097 }

bool AddAnimatorPrm::innerParametersLoader ( const ConfigurationParameterDescriptor node,
const std::string &  prefix = "",
SimulatedObject p = 0 
) [protected]

Protected loader, does not reset the default values.

Definition at line 101 of file OMKAddAnimatorPrm.cpp.

References _classId, _configParam, _objectName, _visualObjectName, _visuName, OMK::ConfigurationParameterDescriptor::clone(), OMK::debugMsg(), OMK::ParametersAccessor::get(), and OMERROR.

Referenced by loadParameters().

00102 {
00103   // Tests the configuration parameter node
00104   if( !node )
00105   { // No valid node => display error message and return false
00106     std::ostringstream txt ;
00107     txt << "Error in AddAnimatorPrm::innerParametersLoader";
00108     if( p ) txt << " for " << OMK::debugMsg( p ) ;
00109     txt << std::endl << ">>> :-( Invalid node" << std::endl ; 
00110     OMERROR( txt.str() ) ;
00111     return false ;
00112   }
00113   // return value
00114   bool ok = true ;
00115 
00116   //=== The optional parameters => no test
00117   // Load the value of VisuName
00118   ParametersAccessor::get( node, prefix + "VisuName", _visuName ) ;
00119   // Load the value of ObjectName
00120   ParametersAccessor::get( node, prefix + "ObjectName", _objectName ) ;
00121   // Load the value of ObjectName
00122   ParametersAccessor::get( node, prefix + "VisualObjectName", _visualObjectName ) ;
00123 
00124   //=== The needed parameters => tested
00125   // Load the value of ClassId
00126   ok = ParametersAccessor::get( node, prefix + "Class", _classId, p ) && ok ;
00127   // store the value of ConfigParam
00128   _configParam = node->clone() ;
00129 
00130   return ok ;
00131 }

void OMK::Type::AddAnimatorPrm::setObjectName ( const Name objectName  )  [inline]

Set the objectName value of AddVisualObjectPrm.

Definition at line 209 of file OMKAddAnimatorPrm.h.

Referenced by OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::initAnimator(), and OMK::Vis::VisObjectExtension::loadAnimatorParameters().

00209 { _objectName = objectName ; }

const Name& OMK::Type::AddAnimatorPrm::getObjectName (  )  const [inline]

Return the objectName value of AddVisualObjectPrm.

Definition at line 211 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::initAnimator(), insertInStream(), operator!=(), and pack().

00211 { return _objectName ; }

void OMK::Type::AddAnimatorPrm::setClassId ( const Name classId  )  [inline]

Set the classId value of AddAnimatorPrm.

Definition at line 214 of file OMKAddAnimatorPrm.h.

00214 { _classId = classId ; }

const Name& OMK::Type::AddAnimatorPrm::getClassId (  )  const [inline]

Return the classId value of AddAnimatorPrm.

Definition at line 216 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), insertInStream(), operator!=(), and pack().

00216 { return _classId ; }

void OMK::Type::AddAnimatorPrm::setVisualObjectName ( const Name visualObjectName  )  [inline]

Set the visualObjectName value of AddAnimatorPrm.

Definition at line 219 of file OMKAddAnimatorPrm.h.

Referenced by OMK::Vis::VisObjectExtension::loadAnimatorParameters().

00219 { _visualObjectName = visualObjectName ; }

const Name& OMK::Type::AddAnimatorPrm::getVisualObjectName (  )  const [inline]

Return the visualObjectName value of AddAnimatorPrm.

Definition at line 221 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), insertInStream(), OMK::Vis::VisObjectExtension::loadAnimatorParameters(), operator!=(), and pack().

00221 { return _visualObjectName ; }

void OMK::Type::AddAnimatorPrm::setVisuName ( const Name VisuName  )  [inline]

Set the VisuName value of AddAnimatorPrm.

Definition at line 224 of file OMKAddAnimatorPrm.h.

00224 { _visuName = VisuName ; }

const Name& OMK::Type::AddAnimatorPrm::getVisuName (  )  const [inline]

Return the VisuName value of AddAnimatorPrm.

Definition at line 226 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), insertInStream(), OMK::Vis::VisObjectExtension::loadAnimatorParameters(), operator!=(), and pack().

00226 { return _visuName ; }

void OMK::Type::AddAnimatorPrm::setConfigParam ( const ConfigurationParameterDescriptor configParam  )  [inline]

Set the configParam value of AddAnimatorPrm.

Definition at line 229 of file OMKAddAnimatorPrm.h.

Referenced by OMK::IAttributeAnimatorT< PrmType, ModelType, AccessorType >::initAnimator().

00229 { _configParam = configParam ; }

const ConfigurationParameterDescriptor* OMK::Type::AddAnimatorPrm::getConfigParam (  )  const [inline]

Return the configParam value of AddAnimatorPrm.

Definition at line 231 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), insertInStream(), operator!=(), and pack().

00231 { return _configParam ; }

bool OMK::Type::AddAnimatorPrm::operator== ( const AddAnimatorPrm ref  )  const [inline]

Comparison operator for equality.

Definition at line 237 of file OMKAddAnimatorPrm.h.

00237 { return !( *this != ref ) ; } 

bool AddAnimatorPrm::operator!= ( const AddAnimatorPrm ref  )  const

Comparison operator for difference.

Definition at line 136 of file OMKAddAnimatorPrm.cpp.

References _classId, _configParam, _objectName, _visualObjectName, _visuName, getClassId(), getConfigParam(), getObjectName(), getVisualObjectName(), and getVisuName().

00137 {
00138   return _objectName != ref.getObjectName()
00139       || _classId != ref.getClassId()
00140       || _visualObjectName != ref.getVisualObjectName()
00141       || _visuName != ref.getVisuName()
00142       || _configParam != ref.getConfigParam() ;
00143 }

AddAnimatorPrm & AddAnimatorPrm::operator= ( const AddAnimatorPrm ref  ) 

Copy operator.

Definition at line 147 of file OMKAddAnimatorPrm.cpp.

References _copy().

00148 {
00149   if ( this != &ref ) 
00150   {
00151     _copy( ref ) ;
00152   }
00153   return *this ;
00154 }  

void AddAnimatorPrm::insertInStream ( std::ostream &  = std::cout  )  const [virtual]

Insert datas in an output stream.

Implements OMK::Flowable.

Definition at line 158 of file OMKAddAnimatorPrm.cpp.

References getClassId(), getConfigParam(), getObjectName(), getVisualObjectName(), and getVisuName().

00159 {
00160   out << getObjectName() << " "
00161       << getClassId() << " "
00162       << getVisualObjectName() << " "
00163       << getVisuName() << " "
00164             << *getConfigParam() << " "
00165       << " " ;
00166 }

void AddAnimatorPrm::extract ( std::istream &  = std::cin  )  [virtual]

Extract datas from an input stream.

Implements OMK::Flowable.

Definition at line 170 of file OMKAddAnimatorPrm.cpp.

References _classId, _configParam, _objectName, _visualObjectName, and _visuName.

00171 {
00172   in >> _objectName
00173      >> _classId
00174      >> _visualObjectName
00175      >> _visuName ;
00176   // At this step we must retrieve the configuration parameters
00177   // we assume that is a MultipleConfigurationParameter
00178   MultipleConfigurationParameter* configParamTmp = new MultipleConfigurationParameter ;
00179   in >> ( *configParamTmp ) ;
00180   delete _configParam ;
00181   _configParam = configParamTmp ;
00182 }

void AddAnimatorPrm::pack ( OutgoingSynchronisationMessage out  )  const [virtual]

Pack datas in the message.

Reimplemented from OMK::Flowable.

Definition at line 186 of file OMKAddAnimatorPrm.cpp.

References getClassId(), getConfigParam(), getObjectName(), getVisualObjectName(), and getVisuName().

00187 {
00188   out << getObjectName()
00189       << getClassId()
00190       << getVisualObjectName()
00191       << getVisuName()
00192           << *getConfigParam() ;
00193 }

void AddAnimatorPrm::unpack ( IncomingSynchronisationMessage in  )  [virtual]

Unpack datas from the message.

Reimplemented from OMK::Flowable.

Definition at line 197 of file OMKAddAnimatorPrm.cpp.

References _classId, _configParam, _objectName, _visualObjectName, and _visuName.

00198 {
00199   in >> _objectName
00200      >> _classId
00201      >> _visualObjectName
00202      >> _visuName ;
00203   // At this step we must retrieve the configuration parameters
00204   // we assume that is a MultipleConfigurationParameter
00205   MultipleConfigurationParameter* configParamTmp = new MultipleConfigurationParameter ;
00206   in >> ( *configParamTmp ) ;
00207   delete _configParam ;
00208   _configParam = configParamTmp ;
00209 }

PolatorNT * AddAnimatorPrm::createPolator (  )  [virtual]

Default polator creator.

Implements OMK::Type::Base.

Definition at line 213 of file OMKAddAnimatorPrm.cpp.

00214 {
00215   return new Polator<AddAnimatorPrm>() ;
00216 }

void AddAnimatorPrm::_copy ( const AddAnimatorPrm ref  )  [protected]

Copy methods call by constructor and operator.

Definition at line 220 of file OMKAddAnimatorPrm.cpp.

References _classId, _configParam, _objectName, _visualObjectName, _visuName, OMK::ConfigurationParameterDescriptor::clone(), getClassId(), getConfigParam(), getObjectName(), getVisualObjectName(), and getVisuName().

Referenced by AddAnimatorPrm(), and operator=().

00221 {
00222   _objectName = ref.getObjectName() ; 
00223   _classId = ref.getClassId() ; 
00224   _visualObjectName = ref.getVisualObjectName() ; 
00225   _visuName = ref.getVisuName() ; 
00226   delete _configParam ;
00227   _configParam = ref.getConfigParam() ? ref.getConfigParam()->clone() : 0 ; 
00228 }


Member Data Documentation

Name OMK::Type::AddAnimatorPrm::_objectName [protected]

This member holds the ObjectName value of AddVisualObjectPrm.

The name of the visual object

Definition at line 269 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), extract(), innerParametersLoader(), operator!=(), and unpack().

Name OMK::Type::AddAnimatorPrm::_classId [protected]

This member holds the Class value of AddAnimatorPrm.

The class id to identify the class of the animator and to create a new one

Definition at line 273 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), extract(), innerParametersLoader(), operator!=(), resetDefaultValues(), and unpack().

Name OMK::Type::AddAnimatorPrm::_visualObjectName [protected]

This member holds the VisualObjectName value of AddAnimatorPrm.

The name of the visual object which the animator will be added to

Definition at line 277 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), extract(), innerParametersLoader(), operator!=(), resetDefaultValues(), and unpack().

Name OMK::Type::AddAnimatorPrm::_visuName [protected]

This member holds the VisuName value of AddAnimatorPrm.

The name of the visualisation. If null the message will be broadcasted, if not only the specified visualisation will received the message.

Definition at line 281 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), extract(), innerParametersLoader(), operator!=(), resetDefaultValues(), and unpack().

const ConfigurationParameterDescriptor* OMK::Type::AddAnimatorPrm::_configParam [protected]

This member holds the configParam value of AddAnimatorPrm.

Informations to buid the animator

Definition at line 285 of file OMKAddAnimatorPrm.h.

Referenced by _copy(), extract(), innerParametersLoader(), operator!=(), resetDefaultValues(), unpack(), and ~AddAnimatorPrm().


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007