version 3.3

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

#include <vrs/discretemapper.h>

Inheritance diagram for VRS::DiscreteMapper< 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

 DiscreteMapper ()
 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 (DiscreteMapper, VRS_TEMPLATE_ARGS_2(TARGET_TYPE, SOURCE_TYPE, Mapper))
 VRS_SERIALIZABLE (DiscreteMapper)


Detailed Description

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

Mapper class for mapping values to discrete target values. The < operator must be defined for the type SOURCE_TYPE.

Constructor & Destructor Documentation

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

Creates an empty mapping table.


Member Function Documentation

template<typename TARGET_TYPE, typename SOURCE_TYPE>
bool VRS::DiscreteMapper< 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::DiscreteMapper< 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::DiscreteMapper< TARGET_TYPE, SOURCE_TYPE >::map ( SOURCE_TYPE  source  )  [inline, virtual]

The resulting target value is calculated by finding the greatest source value in the table that is less than or equal to the given source value and returning the corresponding target value stored in the mapping table. 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.

Implements VRS::Mapper< TARGET_TYPE, SOURCE_TYPE >.

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

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


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

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