OMK::DuplicatedAttributeExtension< AttributType, Type > Class Template Reference
[Extension feature]

Extension to add an offset to a Transform attribute of the object. More...

#include <OMKDuplicatedAttributeExtension.h>

Inheritance diagram for OMK::DuplicatedAttributeExtension< AttributType, Type >:

Inheritance graph
[legend]
Collaboration diagram for OMK::DuplicatedAttributeExtension< AttributType, Type >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~DuplicatedAttributeExtension ()
 Destructor.

Static Public Attributes

static Name OMK_CLASS_ID
 The id for the extension.
static const bool REGISTERED_IN_EXTENSION_FACTORY
 The registration in the extension factory.

Protected Member Functions

 DuplicatedAttributeExtension (ExtensibleSimulatedObject *owner, const Name &id)
 Constructor.
Configuration loaders
virtual bool loadExtensionParameters (const ConfigurationParameterDescriptor *node)
 Configuration parameters loader of Extension.

Protected Attributes

AttributeAccT< Type, AttributType > * _duplicatedAttribute
 The offset attribute.

Friends

class DuplicatedAttributeExtensionCreatorT< AttributType, Type >
 The creators are friend.

Detailed Description

template<typename AttributType, typename Type>
class OMK::DuplicatedAttributeExtension< AttributType, Type >

Extension to add an offset to a Transform attribute of the object.

Date:
2007-03-15
Author:
Benoît Chanclou
Defines an offset attribute for the object. The name of the attribute will be the same as the one of the extension. This attribute can be connected to the output of an another object. For this use #extensionName#Connect.

The offset can be done in the pre-compute or the post-compute step according to creation id. To choose one or the other use PreDuplicatedAttribute (uses to offset an input) or PostOffest (uses to offset an output), as class's name in the configuration. The configuration is:

myObject
{ 
  Class MyObject // with a "Position" attribute
  Extensions
  {     
    offset
    {
      Class PostDuplicatedAttribute // or PreDuplicatedAttribute
      Attribute Position // the name of the attribute to offset
      DuplicatedAttribute [[0 0 -100]] // the offset value (it is optional, the default is identity)
    }
  }
  UserParams
  {
    DuplicatedAttributeConnect [anotherObject aTransformOutput]
  }
}
 *

Definition at line 47 of file OMKDuplicatedAttributeExtension.h.


Constructor & Destructor Documentation

template<typename AttributType, typename Type>
OMK::DuplicatedAttributeExtension< AttributType, Type >::DuplicatedAttributeExtension ( ExtensibleSimulatedObject owner,
const Name id 
) [protected]

Constructor.

It is protected, because it is only called by the friend creators.

Definition at line 31 of file OMKDuplicatedAttributeExtension.inl.

00032 : OMK::ExtensionT< ExtensibleSimulatedObject >( owner, id ),
00033   _duplicatedAttribute( 0 )
00034 {
00035 }

template<typename AttributType, typename Type>
OMK::DuplicatedAttributeExtension< AttributType, Type >::~DuplicatedAttributeExtension (  )  [virtual]

Destructor.

Definition at line 38 of file OMKDuplicatedAttributeExtension.inl.

References OMK::DuplicatedAttributeExtension< AttributType, Type >::_duplicatedAttribute, OMK::ExtensionT< SimulatedObjectType >::_owner, and OMK::IAttribute::getId().

00039 {
00040   _owner->removeAttribute( _duplicatedAttribute->getId() ) ;
00041   delete _duplicatedAttribute ;
00042   _duplicatedAttribute = 0 ;
00043 }


Member Function Documentation

template<typename AttributType, typename Type>
bool OMK::DuplicatedAttributeExtension< AttributType, Type >::loadExtensionParameters ( const ConfigurationParameterDescriptor node  )  [protected, virtual]

Configuration parameters loader of Extension.

It retrieves, in the extension configuration, the offset and the name of the attribute to ofset.

Reimplemented from OMK::Extension.

Definition at line 46 of file OMKDuplicatedAttributeExtension.inl.

References OMK::DuplicatedAttributeExtension< AttributType, Type >::_duplicatedAttribute, OMK::ExtensionT< SimulatedObjectType >::_owner, and OMK::ParametersAccessor::get().

00047 {
00048         // Retrieve the visual objects
00049   bool ok = true ;
00050   // Attribute to offset
00051   std::string attributeName ;
00052   ok = ok && ParametersAccessor::get( node, "Attribute", attributeName, _owner ) ;
00053   if( ok )
00054   {
00055     Name id( attributeName + "_duplicated_" + typeid( Type ).name() ) ;
00056     ParametersAccessor::get( node, "Id", id ) ;
00057     IAccessorT< AttributType >* accessor = _owner->getBaseAttribute< AttributType >( Name( attributeName ) ) ;
00058     ok = accessor != 0 ;
00059     _duplicatedAttribute = new AttributeAccT< Type, AttributType >( id, accessor );
00060     _owner->addAttribute( *_duplicatedAttribute ) ;
00061   }
00062   return ok ;
00063 }


Friends And Related Function Documentation

template<typename AttributType, typename Type>
friend class DuplicatedAttributeExtensionCreatorT< AttributType, Type > [friend]

The creators are friend.

Definition at line 53 of file OMKDuplicatedAttributeExtension.h.


Member Data Documentation

template<typename AttributType, typename Type>
Name OMK::DuplicatedAttributeExtension< AttributType, Type >::OMK_CLASS_ID [static]

The id for the extension.

Definition at line 56 of file OMKDuplicatedAttributeExtension.h.

template<typename AttributType, typename Type>
const bool OMK::DuplicatedAttributeExtension< AttributType, Type >::REGISTERED_IN_EXTENSION_FACTORY [static]

The registration in the extension factory.

Definition at line 58 of file OMKDuplicatedAttributeExtension.h.

template<typename AttributType, typename Type>
AttributeAccT< Type, AttributType >* OMK::DuplicatedAttributeExtension< AttributType, Type >::_duplicatedAttribute [protected]

The offset attribute.

It can be defined by the configuration parameter named Offset.

Definition at line 78 of file OMKDuplicatedAttributeExtension.h.

Referenced by OMK::DuplicatedAttributeExtension< AttributType, Type >::loadExtensionParameters(), and OMK::DuplicatedAttributeExtension< AttributType, Type >::~DuplicatedAttributeExtension().


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007