OMK::Iii::IConvertorT< TypeOut, TypeIn > Class Template Reference
[Attribute feature]

The interface class for convertor. More...

#include <OMKIConvertor.h>

Inheritance diagram for OMK::Iii::IConvertorT< TypeOut, TypeIn >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual ~IConvertorT ()
virtual void convert (TypeOut &value, const TypeIn &newValue)=0
 Set the value.

Static Public Member Functions

static IConvertorT< TypeOut,
TypeIn > * 
create (const ConfigurationParameterDescriptor *node)
 Helper method to create a convertor dynamically.

Detailed Description

template<typename TypeOut, typename TypeIn>
class OMK::Iii::IConvertorT< TypeOut, TypeIn >

The interface class for convertor.

Date:
2007-01-19
Author:
Benoît Chanclou
This class defines a simple interface class which defines convertion of a value into an other value. The values can be of differents types.

This interface is a template class, the parameters are:

Every convertor which wants to be dynamically created must be registered in this factory. Use the macros to do this registration, see REGISTER_TEMPLATE_CONVERTOR_FACTORY and REGISTER_CONVERTOR_FACTORY for registration and DECLARE_TEMPLATE_CONVERTOR_FACTORY and for declaration DECLARE_CONVERTOR_FACTORY.

It is used in shared connectors.

Definition at line 195 of file OMKIConvertor.h.


Constructor & Destructor Documentation

template<typename TypeOut, typename TypeIn>
virtual OMK::Iii::IConvertorT< TypeOut, TypeIn >::~IConvertorT (  )  [inline, virtual]

Definition at line 198 of file OMKIConvertor.h.

Referenced by OMK::Iii::IConvertorT< Type, std::vector< Type > >::~IConvertorT().

00198 { 


Member Function Documentation

template<typename TypeOut, typename TypeIn>
virtual void OMK::Iii::IConvertorT< TypeOut, TypeIn >::convert ( TypeOut &  value,
const TypeIn &  newValue 
) [pure virtual]

Set the value.

Parameters:
[out] The output value set to its new value.
[in] newValue The input value.

Referenced by OMK::Iii::SharedConnectorT< Type >::updateParameter(), and OMK::Iii::IConvertorT< Type, std::vector< Type > >::~IConvertorT().

template<typename TypeOut, typename TypeIn>
IConvertorT< TypeOut, TypeIn > * OMK::Iii::IConvertorT< TypeOut, TypeIn >::create ( const ConfigurationParameterDescriptor node  )  [static]

Helper method to create a convertor dynamically.

Parameters:
[in] node The configuration node where to find the informations.

Definition at line 36 of file OMKIConvertor.inl.

References OMK::ParametersAccessor::get(), OMK::ConfigurationParameterDescriptor::getSubDescriptorByName(), and OMASSERTM.

Referenced by OMK::Iii::IConvertorT< Type, std::vector< Type > >::~IConvertorT().

00037 {
00038   IConvertorT< TypeOut, TypeIn >* convertor = 0 ;
00039   std::string convertorClassId ;
00040   const MultipleConfigurationParameter* convertorNode = dynamic_cast< const MultipleConfigurationParameter* >( node->getSubDescriptorByName( "Convertor" ) ) ;
00041   if( !convertorNode && ParametersAccessor::get( node, "Convertor", convertorClassId ) )
00042   {
00043     convertor = OBT::Singleton< ConvertorFactoryT< TypeOut, TypeIn > >::getInstance().create( convertorClassId )( node ) ;
00044     OMASSERTM( convertor, "Unable to create the convertor \"" << convertorClassId << "\", may be not registered !" ) ;
00045   }
00046   else if( convertorNode )
00047   { 
00048     if( ParametersAccessor::get( convertorNode, "Class", convertorClassId ) )
00049     {
00050       convertor = OBT::Singleton< ConvertorFactoryT< TypeOut, TypeIn > >::getInstance().create( convertorClassId )( convertorNode ) ;
00051       OMASSERTM( convertor, "Unable to create the convertor \"" << convertorClassId << "\", may be not registered !" ) ;
00052     }
00053     else
00054     {
00055       OMASSERTM( false, "Unable to create the convertor because the \"Class\" cannot be found in the \"Convertor\" node of" << std::endl << *node ) ;
00056     }
00057   }
00058   return convertor ;
00059 }


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007