version 3.3

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

#include <vrs/intervalmapper.h>

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

 IntervalMapper (TARGET_TYPE undefValue=TARGET_TYPE())
 Creates a new empty mapping table. Only the undef target value is defined.
 IntervalMapper (Iterator< IntervalInfo > *intervals, TARGET_TYPE undefValue=TARGET_TYPE())
 Creates a new mapping table containing given intervals.
 IntervalMapper (Iterator< SOURCE_TYPE > *sources, Iterator< TARGET_TYPE > *targets, bool interpolate=false, TARGET_TYPE undefValue=TARGET_TYPE())
void add (SOURCE_TYPE sourceValue, TARGET_TYPE targetValue)
 Define the target value for the given source value.
void add (SOURCE_TYPE sourceBegin, SOURCE_TYPE sourceEnd, TARGET_TYPE targetValue)
 Define the (constant) target value for the given source interval.
void add (SOURCE_TYPE sourceBegin, SOURCE_TYPE sourceEnd, TARGET_TYPE targetBegin, TARGET_TYPE targetEnd)
void remove (SOURCE_TYPE sourceBegin, SOURCE_TYPE sourceEnd, bool all=false)
void remove (const IntervalInfo &interval)
 Removes the given interval.
void removeAll ()
 Removes all intervals.
virtual TARGET_TYPE map (SOURCE_TYPE sourceValue)
Iterator< IntervalInfo > * insertedIntervals () const
Iterator< IntervalInfo > * mappingIntervals () const
 VRS_TYPEINFO (IntervalMapper, VRS_TEMPLATE_ARGS_2(TARGET_TYPE, SOURCE_TYPE, Mapper))
 VRS_SERIALIZABLE (IntervalMapper)

Classes

struct  IntervalInfo


Detailed Description

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

Class for mapping values of type SOURCE_TYPE to values of type TARGET_TYPE (e.g. double -> VRS::Color). operator<(SOURCE_TYPE, SOURCE_TYPE), operator*(double, TARGET_TYPE), and operator+(TARGET_TYPE, TARGET_TYPE) must be defined.

Constructor & Destructor Documentation

template<typename TARGET_TYPE, typename SOURCE_TYPE>
VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::IntervalMapper ( TARGET_TYPE  undefValue = TARGET_TYPE()  ) 

Creates a new empty mapping table. Only the undef target value is defined.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::IntervalMapper ( Iterator< IntervalInfo > *  intervals,
TARGET_TYPE  undefValue = TARGET_TYPE() 
)

Creates a new mapping table containing given intervals.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::IntervalMapper ( Iterator< SOURCE_TYPE > *  sources,
Iterator< TARGET_TYPE > *  targets,
bool  interpolate = false,
TARGET_TYPE  undefValue = TARGET_TYPE() 
)

Creates a new mapping table. The mappings for the given source and target values are inserted into an empty mapping table. The source values must be specified in increasing order. If interpolate is true, each source value is associated with the corresponding target value. If interpolate is false, the interval between two source values is associated with a (constant) target value; hence, the number of target values must be the number of source values minus one!


Member Function Documentation

template<typename TARGET_TYPE, typename SOURCE_TYPE>
void VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::add ( SOURCE_TYPE  sourceValue,
TARGET_TYPE  targetValue 
)

Define the target value for the given source value.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
void VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::add ( SOURCE_TYPE  sourceBegin,
SOURCE_TYPE  sourceEnd,
TARGET_TYPE  targetValue 
)

Define the (constant) target value for the given source interval.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
void VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::add ( SOURCE_TYPE  sourceBegin,
SOURCE_TYPE  sourceEnd,
TARGET_TYPE  targetBegin,
TARGET_TYPE  targetEnd 
)

Define the target values for the given source interval. During the mapping calculation the target values are interpolated linearly across the source interval. If the source interval overlaps with already existing mapping intervals, the mapping for the overlap is refined by this new interval. VRS::INF and -VRSINF can be used to denote infinity and minus infinity.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
void VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::remove ( SOURCE_TYPE  sourceBegin,
SOURCE_TYPE  sourceEnd,
bool  all = false 
)

Removes the interval with the given start and end points. If the all-flag is set to true, all matching intervals are removed; otherwise, only the last inserted interval matching these points is removed.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
void VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::remove ( const IntervalInfo interval  ) 

Removes the given interval.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
void VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::removeAll (  ) 

Removes all intervals.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
virtual TARGET_TYPE VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::map ( SOURCE_TYPE  sourceValue  )  [virtual]

Calculates the mapping for the given source value. If the given source value lies inside of a stored interval the mapped value is calculated by linear interpolation between the corresponding target values of the mapping interval. If the given source value is not contained in any mapping interval the undef target value is returned. If the given source value lies inside of more than one mapping interval the last inserted mapping interval is used for the mapping calculation!

Implements VRS::Mapper< TARGET_TYPE, SOURCE_TYPE >.

template<typename TARGET_TYPE, typename SOURCE_TYPE>
Iterator<IntervalInfo>* VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::insertedIntervals (  )  const

Returns all inserted mapping intervals in the order of insertion. Note: the intervals may overlap and are NOT sorted according their starting points!

template<typename TARGET_TYPE, typename SOURCE_TYPE>
Iterator<IntervalInfo>* VRS::IntervalMapper< TARGET_TYPE, SOURCE_TYPE >::mappingIntervals (  )  const

Returns the mapping intervals used for the mapping calculations. It is guaranteed that the returned intervals do not overlap and are sorted with respect to their starting points!

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

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


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

Generated on Sat May 25 06:00:24 2013 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact