Ocean
Ocean::InterpolationMap< TKey, TValue, TFactor > Class Template Reference

This class implements an interpolation map allowing to determine an interplated value between several individual key values. More...

Public Types

typedef std::map< TKey, TValue > ValueMap
 Definition of a map mapping keys to values. More...
 
typedef TValue(* LinearInterpolationFunction) (const TValue &, const TValue &, const TFactor &)
 Definition of a function pointer for a function providing a linear interpolation. More...
 

Public Member Functions

 InterpolationMap ()
 Default constructor. More...
 
 InterpolationMap (const InterpolationMap< TKey, TValue, TFactor > &interpolationMap)
 Copy constructor for interpolation maps. More...
 
 InterpolationMap (InterpolationMap< TKey, TValue, TFactor > &&interpolationMap) noexcept
 Move constructor for interpolation maps. More...
 
 InterpolationMap (const ValueMap &valueMap)
 Creates a new interpolation map object by a given value map. More...
 
 InterpolationMap (ValueMap &&valueMap)
 Creates a new interpolation map object by a given value map. More...
 
size_t size () const
 Returns the number of elements (pairs of keys and values) of this interpolation map. More...
 
bool isEmpty () const
 Returns whether this interpolation map object is empty. More...
 
void clear ()
 Clears all elements (pairs of keys and values) of this interpolation map object. More...
 
const ValueMapinterpolationMap () const
 Returns the entire internal interpolation map. More...
 
void setInterpolationMap (const ValueMap &interpolationMap)
 Sets or changes the entire internal interpolation map. More...
 
void setInterpolationMap (ValueMap &&interpolationMap)
 Sets or changes the entire internal interpolation map. More...
 
bool hasValue (const TKey &key) const
 Returns whether this interpolation map object holds a value for a specified key. More...
 
TValue & value (const TKey &key)
 Returns the value of this interpolation map object defined by a corresponding key. More...
 
bool remove (const TKey &key)
 Removes an elements (pair of key and value) from this interpolation map object. More...
 
bool insert (const TKey &key, const TValue &value, const bool forceOverwrite=false)
 Inserts a new pair of key and value to this map object. More...
 
bool insert (const TKey &key, TValue &&value, const bool forceOverwrite=false)
 Inserts a new pair of key and value to this map object. More...
 
TValue linear (const TKey &key) const
 Returns the linear interpolation of the stored values for a given key. More...
 
TValue linear (const TKey &key, const LinearInterpolationFunction interpolationFunction) const
 Returns the linear interpolation of the stored values for a given key and a given interpolation function. More...
 
InterpolationMap< TKey, TValue, TFactor > & operator= (const InterpolationMap< TKey, TValue, TFactor > &object)
 Assign operator. More...
 
InterpolationMap< TKey, TValue, TFactor > & operator= (InterpolationMap< TKey, TValue, TFactor > &&object) noexcept
 Move operator. More...
 
bool operator== (const InterpolationMap< TKey, TValue, TFactor > &object) const
 Returns whether two interpolation objects are equal. More...
 
bool operator!= (const InterpolationMap< TKey, TValue, TFactor > &object) const
 Returns whether two interpolation objects are not equal. More...
 
TValue & operator[] (const TKey &key)
 Returns the value of this interpolation map object defined by a corresponding key. More...
 

Static Public Member Functions

static TValue linear (const ValueMap &valueMap, const TKey &key)
 Returns the linear interpolation of given values for a given key. More...
 
static TValue linear (const ValueMap &valueMap, const TKey &key, const LinearInterpolationFunction interpolationFunction)
 Returns the linear interpolation of given values for a given key and a given interpolation function. More...
 

Protected Attributes

ValueMap interpolationValueMap
 Map mapping keys to values. More...
 

Detailed Description

template<typename TKey, typename TValue, typename TFactor>
class Ocean::InterpolationMap< TKey, TValue, TFactor >

This class implements an interpolation map allowing to determine an interplated value between several individual key values.

Template Parameters
TKeyThe data type of the stored keys
TValueThe data type of the stored values
TFactorThe data type of the interpolation factor

Member Typedef Documentation

◆ LinearInterpolationFunction

template<typename TKey , typename TValue , typename TFactor >
typedef TValue(* Ocean::InterpolationMap< TKey, TValue, TFactor >::LinearInterpolationFunction) (const TValue &, const TValue &, const TFactor &)

Definition of a function pointer for a function providing a linear interpolation.

The first parameter defines the first interpolation value.
The second parameter defines the second interpolation value.
The third parameter defines the interpolation factor, with range [0, 1].

◆ ValueMap

template<typename TKey , typename TValue , typename TFactor >
typedef std::map<TKey, TValue> Ocean::InterpolationMap< TKey, TValue, TFactor >::ValueMap

Definition of a map mapping keys to values.

Constructor & Destructor Documentation

◆ InterpolationMap() [1/5]

template<typename TKey , typename TValue , typename TFactor >
Ocean::InterpolationMap< TKey, TValue, TFactor >::InterpolationMap
inline

Default constructor.

◆ InterpolationMap() [2/5]

template<typename TKey , typename TValue , typename TFactor >
Ocean::InterpolationMap< TKey, TValue, TFactor >::InterpolationMap ( const InterpolationMap< TKey, TValue, TFactor > &  interpolationMap)
inline

Copy constructor for interpolation maps.

Parameters
interpolationMapThe interpolation map to copy

◆ InterpolationMap() [3/5]

template<typename TKey , typename TValue , typename TFactor >
Ocean::InterpolationMap< TKey, TValue, TFactor >::InterpolationMap ( InterpolationMap< TKey, TValue, TFactor > &&  interpolationMap)
inlinenoexcept

Move constructor for interpolation maps.

Parameters
interpolationMapThe interpolation map to move

◆ InterpolationMap() [4/5]

template<typename TKey , typename TValue , typename TFactor >
Ocean::InterpolationMap< TKey, TValue, TFactor >::InterpolationMap ( const ValueMap valueMap)
inline

Creates a new interpolation map object by a given value map.

Parameters
valueMapThe value map that will be stored in this object

◆ InterpolationMap() [5/5]

template<typename TKey , typename TValue , typename TFactor >
Ocean::InterpolationMap< TKey, TValue, TFactor >::InterpolationMap ( ValueMap &&  valueMap)
inline

Creates a new interpolation map object by a given value map.

Parameters
valueMapThe value map that will be moved to this object

Member Function Documentation

◆ clear()

template<typename TKey , typename TValue , typename TFactor >
void Ocean::InterpolationMap< TKey, TValue, TFactor >::clear
inline

Clears all elements (pairs of keys and values) of this interpolation map object.

◆ hasValue()

template<typename TKey , typename TValue , typename TFactor >
bool Ocean::InterpolationMap< TKey, TValue, TFactor >::hasValue ( const TKey &  key) const
inline

Returns whether this interpolation map object holds a value for a specified key.

Parameters
keyKey which is checked
Returns
True, if so

◆ insert() [1/2]

template<typename TKey , typename TValue , typename TFactor >
bool Ocean::InterpolationMap< TKey, TValue, TFactor >::insert ( const TKey &  key,
const TValue &  value,
const bool  forceOverwrite = false 
)
inline

Inserts a new pair of key and value to this map object.

Parameters
keyNew key to be inserted
valueCorresponding value to be instered
forceOverwriteTrue, if an already existing pair with same key will be overwritten by the given pair
Returns
True, if the given pair has been inserted

◆ insert() [2/2]

template<typename TKey , typename TValue , typename TFactor >
bool Ocean::InterpolationMap< TKey, TValue, TFactor >::insert ( const TKey &  key,
TValue &&  value,
const bool  forceOverwrite = false 
)
inline

Inserts a new pair of key and value to this map object.

Parameters
keyNew key to be inserted
valueCorresponding value to be moved
forceOverwriteTrue, if an already existing pair with same key will be overwritten by the given pair
Returns
True, if the given pair has been inserted

◆ interpolationMap()

template<typename TKey , typename TValue , typename TFactor >
const InterpolationMap< TKey, TValue, TFactor >::ValueMap & Ocean::InterpolationMap< TKey, TValue, TFactor >::interpolationMap
inline

Returns the entire internal interpolation map.

Returns
Interpolation map of this object

◆ isEmpty()

template<typename TKey , typename TValue , typename TFactor >
bool Ocean::InterpolationMap< TKey, TValue, TFactor >::isEmpty
inline

Returns whether this interpolation map object is empty.

Returns
True, if so

◆ linear() [1/4]

template<typename TKey , typename TValue , typename TFactor >
TValue Ocean::InterpolationMap< TKey, TValue, TFactor >::linear ( const TKey &  key) const
inline

Returns the linear interpolation of the stored values for a given key.

Parameters
keyThe key of the value that will be (interpolated and) returned
Returns
Resulting interpolated value

◆ linear() [2/4]

template<typename TKey , typename TValue , typename TFactor >
TValue Ocean::InterpolationMap< TKey, TValue, TFactor >::linear ( const TKey &  key,
const LinearInterpolationFunction  interpolationFunction 
) const
inline

Returns the linear interpolation of the stored values for a given key and a given interpolation function.

Parameters
keyThe key of the value that will be (interpolated and) returned
interpolationFunctionAn explicit interpolation function that is applied
Returns
Resulting interpolated value

◆ linear() [3/4]

template<typename TKey , typename TValue , typename TFactor >
TValue Ocean::InterpolationMap< TKey, TValue, TFactor >::linear ( const ValueMap valueMap,
const TKey &  key 
)
static

Returns the linear interpolation of given values for a given key.

Parameters
valueMapThe map of values that are used for interpolation
keyThe key of the value that will be (interpolated and) returned
Returns
Resulting interpolated value

◆ linear() [4/4]

template<typename TKey , typename TValue , typename TFactor >
TValue Ocean::InterpolationMap< TKey, TValue, TFactor >::linear ( const ValueMap valueMap,
const TKey &  key,
const LinearInterpolationFunction  interpolationFunction 
)
static

Returns the linear interpolation of given values for a given key and a given interpolation function.

Parameters
valueMapThe map of values that are used for interpolation
keyThe key of the value that will be (interpolated and) returned
interpolationFunctionAn explicit interpolation function that is applied
Returns
Resulting interpolated value

◆ operator!=()

template<typename TKey , typename TValue , typename TFactor >
bool Ocean::InterpolationMap< TKey, TValue, TFactor >::operator!= ( const InterpolationMap< TKey, TValue, TFactor > &  object) const
inline

Returns whether two interpolation objects are not equal.

Parameters
objectSecond interpoation object
Returns
True, if so

◆ operator=() [1/2]

template<typename TKey , typename TValue , typename TFactor >
InterpolationMap< TKey, TValue, TFactor > & Ocean::InterpolationMap< TKey, TValue, TFactor >::operator= ( const InterpolationMap< TKey, TValue, TFactor > &  object)
inline

Assign operator.

Parameters
objectThe interpolation map object which will be assigned to this object
Returns
Reference to this object

◆ operator=() [2/2]

template<typename TKey , typename TValue , typename TFactor >
InterpolationMap< TKey, TValue, TFactor > & Ocean::InterpolationMap< TKey, TValue, TFactor >::operator= ( InterpolationMap< TKey, TValue, TFactor > &&  object)
inlinenoexcept

Move operator.

Parameters
objectThe interpolation map object which will be moved to this object
Returns
Reference to this object

◆ operator==()

template<typename TKey , typename TValue , typename TFactor >
bool Ocean::InterpolationMap< TKey, TValue, TFactor >::operator== ( const InterpolationMap< TKey, TValue, TFactor > &  object) const
inline

Returns whether two interpolation objects are equal.

Parameters
objectSecond interpoation object
Returns
True, if so

◆ operator[]()

template<typename TKey , typename TValue , typename TFactor >
TValue & Ocean::InterpolationMap< TKey, TValue, TFactor >::operator[] ( const TKey &  key)
inline

Returns the value of this interpolation map object defined by a corresponding key.

If no value exists for this key, the pair of key and value is inserted and the default value is returned.

Parameters
keyKey for that the value is returned
Returns
Value that corresponds to the specified key
See also
value(), hasValue().

◆ remove()

template<typename TKey , typename TValue , typename TFactor >
bool Ocean::InterpolationMap< TKey, TValue, TFactor >::remove ( const TKey &  key)
inline

Removes an elements (pair of key and value) from this interpolation map object.

Parameters
keyThe key of the element to be removed
Returns
True, if the element existed

◆ setInterpolationMap() [1/2]

template<typename TKey , typename TValue , typename TFactor >
void Ocean::InterpolationMap< TKey, TValue, TFactor >::setInterpolationMap ( const ValueMap interpolationMap)
inline

Sets or changes the entire internal interpolation map.

Parameters
interpolationMapThe interpolation map that will replace the current one

◆ setInterpolationMap() [2/2]

template<typename TKey , typename TValue , typename TFactor >
void Ocean::InterpolationMap< TKey, TValue, TFactor >::setInterpolationMap ( ValueMap &&  interpolationMap)
inline

Sets or changes the entire internal interpolation map.

Parameters
interpolationMapThe interpolation map that will be moved to this object

◆ size()

template<typename TKey , typename TValue , typename TFactor >
size_t Ocean::InterpolationMap< TKey, TValue, TFactor >::size
inline

Returns the number of elements (pairs of keys and values) of this interpolation map.

Returns
The number of stored elements

◆ value()

template<typename TKey , typename TValue , typename TFactor >
TValue & Ocean::InterpolationMap< TKey, TValue, TFactor >::value ( const TKey &  key)
inline

Returns the value of this interpolation map object defined by a corresponding key.

If no value exists for this key, the pair of key and value is inserted and the default value is returned.

Parameters
keyKey for that the value is returned
Returns
Value that corresponds to the specified key
See also
hasValue().

Field Documentation

◆ interpolationValueMap

template<typename TKey , typename TValue , typename TFactor >
ValueMap Ocean::InterpolationMap< TKey, TValue, TFactor >::interpolationValueMap
protected

Map mapping keys to values.


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