OMKIConvertor.h File Reference

#include <vector>
#include <map>
#include "OBTPrototypeFactory.h"
#include "OMKName.h"
#include "OMKInteraction.h"
#include "OMKTransform.h"
#include "OMKException.h"
#include "OMKConfigurationParameterDescriptor.h"
#include "OMKIConvertor.inl"

Include dependency graph for OMKIConvertor.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  OMK
namespace  OMK::Iii

Classes

class  OMK::Iii::IConvertorT< TypeOut, TypeIn >
 The interface class for convertor. More...
class  OMK::Iii::IConvertorCreator< TypeOut, TypeIn >
 Ancestor of every convertor creator class used by the PrototypeFactory. More...
class  OMK::Iii::ConvertorCreatorT< TypeOut, TypeIn, ConvertorType >
 Convertor creator class to be parametrized by the descendants of IConvertorT. More...
class  OMK::Iii::ConvertorFactoryT< TypeIn, TypeOut >
 The factory of the average object. More...

Defines

Macros to declare and define registration of convertors.
Two of these macros are for declare and two are for define registration of convertors class.

  • The declare macros are used in the class declaration. They declare the class id for the factory, the static method to register the class in the factory, the contructor, the destructor, and the convert method.
  • The register macros are used in the class implementation. They define the class id for the factory, the static method to register the class in the factory.
By using this macros the user is sure of the declaration and has less job to do. See exampleof use in average and integrator.

#define DECLARE_TEMPLATE_CONVERTOR_FACTORY(ConvertorClass, TypeOut, TypeIn)
 Macro to declare a template convertor class.
#define DECLARE_CONVERTOR_FACTORY(ConvertorClass, TypeOut, TypeIn)
 Macro to declare a convertor class.
#define REGISTER_TEMPLATE_CONVERTOR_FACTORY(ConvertorClass, TypeOut, TypeIn, Id)
 Macro to define the registration of a template convertor class.
#define REGISTER_CONVERTOR_FACTORY(ConvertorClass, TypeOut, TypeIn, Id)
 Macro to define the registration of a convertor class.


Define Documentation

#define DECLARE_CONVERTOR_FACTORY ( ConvertorClass,
TypeOut,
TypeIn   ) 

Value:

public: \ \
  friend class OMK::Iii::ConvertorCreatorT< TypeOut, TypeIn, ConvertorClass > ; \ \
  static OMK::Name OMK_CLASS_ID ;                             \ \
  static const bool REGISTERED_IN_CONVERTOR_FACTORY ; \
protected: \ \
  ConvertorClass( const OMK::ConfigurationParameterDescriptor* node ) ;  \
public: \
  virtual ~ConvertorClass() ; \
  virtual void convert(  TypeOut& value, const TypeIn& newValue )
Macro to declare a convertor class.

This macro is used in the class declaration. It declares the class id for the factory, the static method to register the class in the factory, the contructor, the destructor, and the convert method.

Example of use:

class FahrenheitToCelsius : public OMK::Iii::IConvertorT< float, float >
{
  DECLARE_CONVERTOR_FACTORY( FahrenheitToCelsius, float, float ) ;
} ;

See also REGISTER_CONVERTOR_FACTORY for registration.

Definition at line 104 of file OMKIConvertor.h.

#define DECLARE_TEMPLATE_CONVERTOR_FACTORY ( ConvertorClass,
TypeOut,
TypeIn   ) 

Value:

public: \ \
  friend class OMK::Iii::ConvertorCreatorT< TypeOut, TypeIn, ConvertorClass< TypeOut > > ; \ \
  static OMK::Name OMK_CLASS_ID ; \ \
  static const bool REGISTERED_IN_CONVERTOR_FACTORY ; \
protected: \ \
        ConvertorClass( const ConfigurationParameterDescriptor* node ) ; \
public: \
        virtual ~ConvertorClass() ; \
  virtual void convert( TypeOut& value, const TypeIn& newValue )
Macro to declare a template convertor class.

This macro is used in the class declaration. It declares the class id for the factory, the static method to register the class in the factory, the contructor, the destructor, and the convert method.

Example of use:

template< typename Type >
class MyConvertorT : public OMK::Iii::IConvertorT< Type, Type >
{
  DECLARE_TEMPLATE_CONVERTOR_FACTORY( MyConvertorT, Type, Type ) ;
} ;
See also usage in average and integrator.

See also REGISTER_TEMPLATE_CONVERTOR_FACTORY for registration.

Definition at line 74 of file OMKIConvertor.h.

#define REGISTER_CONVERTOR_FACTORY ( ConvertorClass,
TypeOut,
TypeIn,
Id   ) 

Value:

/* Factory */ \
  OMK::Name ConvertorClass::OMK_CLASS_ID( Id ) ;                        \
  const bool ConvertorClass::REGISTERED_IN_CONVERTOR_FACTORY( OBT::Singleton< OMK::Iii::ConvertorFactoryT< TypeOut, TypeIn > >::getInstance().registerCreator< OMK::Iii::ConvertorCreatorT< TypeOut, TypeIn, ConvertorClass > >( Id ) )
Macro to define the registration of a convertor class.

This macros is used in the class implementation. It defines the class id for the factory, the static method to register the class in the factory.

This macro is use in the implementation to create and register the class.

Example of use:
In the .cpp file which implementes the class.

REGISTER_CONVERTOR_FACTORY( FahrenheitToCelsius, float, float, FahrenheitToCelsius ) ;
and in the main function
FahrenheitToCelsius::registerInFactory() ;

See also DECLARE_CONVERTOR_FACTORY for declaration.

Definition at line 164 of file OMKIConvertor.h.

#define REGISTER_TEMPLATE_CONVERTOR_FACTORY ( ConvertorClass,
TypeOut,
TypeIn,
Id   ) 

Value:

/* Factory */ \
  template <> OMK::Name ConvertorClass::OMK_CLASS_ID( Id ) ;                \
  template <> const bool ConvertorClass::REGISTERED_IN_CONVERTOR_FACTORY( OBT::Singleton< OMK::Iii::ConvertorFactoryT< TypeOut, TypeIn > >::getInstance().registerCreator< OMK::Iii::ConvertorCreatorT< TypeOut, TypeIn, ConvertorClass > >( Id ) )
Macro to define the registration of a template convertor class.

This macros is used in the class implementation. It defines the class id for the factory, the static method to register the class in the factory.

This macro is use in the main to create and register the class.

Example of use:
Before the main function (it must be in the main file because it is a template class and the class doesn't know with which arguments it will be used)

REGISTER_TEMPLATE_CONVERTOR_FACTORY( MyConvertorT, int, int, MyConvertorInt ) ;
REGISTER_TEMPLATE_CONVERTOR_FACTORY( MyConvertorT, float, float, MyConvertorFloat ) ;
and in the main function
bool ok = MyConvertorT< int   >::REGISTERED_IN_CONVERTOR_FACTORY 
       && MyConvertorT< float >::REGISTERED_IN_CONVERTOR_FACTORY ;
See also usage in average and integrator.

See also DECLARE_TEMPLATE_CONVERTOR_FACTORY for declaration.

Definition at line 142 of file OMKIConvertor.h.


logo OpenMask

Documentation generated on Mon Jun 9 11:45:58 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007