version 3.3

VRS::LinearMapper< TARGET_TYPE, SOURCE_TYPE > Class Template Reference

#include <vrs/linearmapper.h>

Inheritance diagram for VRS::LinearMapper< TARGET_TYPE, SOURCE_TYPE >:

VRS::Mapper< TARGET_TYPE, SOURCE_TYPE > VRS::CallbackR1< TARGET_TYPE, SOURCE_TYPE > VRS::CallbackBase VRS::SharedObj VRS::Visitable

List of all members.

Public Member Functions

 LinearMapper ()
 Creates an empty mapping table.
bool add (SOURCE_TYPE source, TARGET_TYPE target)
bool remove (SOURCE_TYPE source)
virtual TARGET_TYPE map (SOURCE_TYPE source)
 VRS_TYPEINFO (LinearMapper, VRS_TEMPLATE_ARGS_2(TARGET_TYPE, SOURCE_TYPE, Mapper))
 VRS_SERIALIZABLE (LinearMapper)


Detailed Description

template<typename TARGET_TYPE, typename SOURCE_TYPE>
class VRS::LinearMapper< TARGET_TYPE, SOURCE_TYPE >

Mapper class for mapping values to linearly interpolated target values. Operator < must be defined for the type SOURCE_TYPE. Operator - must be defined for the type SOURCE_TYPE. The result of operator - for the type SOURCE_TYPE must be convertable to type double. Operator * with type double must be defined for type TARGET_TYPE. Operator + must be defined for the type TARGET_TYPE.

Constructor & Destructor Documentation

template<typename TARGET_TYPE, typename SOURCE_TYPE>
VRS::LinearMapper< TARGET_TYPE, SOURCE_TYPE >::LinearMapper (  )  [inline]

Creates an empty mapping table.


Member Function Documentation

template<typename TARGET_TYPE, typename SOURCE_TYPE>
bool VRS::LinearMapper< TARGET_TYPE, SOURCE_TYPE >::add ( SOURCE_TYPE  source,
TARGET_TYPE  target 
) [inline]

Adds a new entry to the mapping table. Returns true, if there was not already a mapping from the specified source value to some target value.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
bool VRS::LinearMapper< TARGET_TYPE, SOURCE_TYPE >::remove ( SOURCE_TYPE  source  )  [inline]

Removes an existing entry from the mapping table. Returns true, if there was a mapping from the specified source value to some target value.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
TARGET_TYPE VRS::LinearMapper< TARGET_TYPE, SOURCE_TYPE >::map ( SOURCE_TYPE  source  )  [inline, virtual]

The resulting target value is calculated by linearly interpolate the target values which are stored in the mapping table for the greatest source value less than or equal to the given source value and the smallest source value greater than the given source value. If all source values stored in the mapping table are greater than the given source value then the target value for the smallest source value stored in the mapping table is returned. If all source values stored in the mapping table are smaller than the given source value then the target value for the greatest source value stored in the mapping table is returned.

Implements VRS::Mapper< TARGET_TYPE, SOURCE_TYPE >.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
VRS::LinearMapper< TARGET_TYPE, SOURCE_TYPE >::VRS_TYPEINFO ( LinearMapper< TARGET_TYPE, SOURCE_TYPE >  ,
VRS_TEMPLATE_ARGS_2(TARGET_TYPE, SOURCE_TYPE, Mapper  
)

template<typename TARGET_TYPE, typename SOURCE_TYPE>
VRS::LinearMapper< TARGET_TYPE, SOURCE_TYPE >::VRS_SERIALIZABLE ( LinearMapper< TARGET_TYPE, SOURCE_TYPE >   ) 


The documentation for this class was generated from the following file:

Generated on Mon May 21 06:00:19 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact