|
Ocean
|
This class implements an interpolation map allowing to determine an interplated value between several individual key values. More...
#include <Interpolation.h>
Public Types | |
| using | ValueMap = std::map< TKey, TValue > |
| Definition of a map mapping keys to values. | |
| using | LinearInterpolationFunction = TValue(*)(const TValue &, const TValue &, const TFactor &) |
| Definition of a function pointer for a function providing a linear interpolation. | |
Public Member Functions | |
| InterpolationMap () | |
| Default constructor. | |
| InterpolationMap (const InterpolationMap< TKey, TValue, TFactor > &interpolationMap) | |
| Copy constructor for interpolation maps. | |
| InterpolationMap (InterpolationMap< TKey, TValue, TFactor > &&interpolationMap) noexcept | |
| Move constructor for interpolation maps. | |
| InterpolationMap (const ValueMap &valueMap) | |
| Creates a new interpolation map object by a given value map. | |
| InterpolationMap (ValueMap &&valueMap) | |
| Creates a new interpolation map object by a given value map. | |
| size_t | size () const |
| Returns the number of elements (pairs of keys and values) of this interpolation map. | |
| bool | isEmpty () const |
| Returns whether this interpolation map object is empty. | |
| void | clear () |
| Clears all elements (pairs of keys and values) of this interpolation map object. | |
| const ValueMap & | interpolationMap () const |
| Returns the entire internal interpolation map. | |
| void | setInterpolationMap (const ValueMap &interpolationMap) |
| Sets or changes the entire internal interpolation map. | |
| void | setInterpolationMap (ValueMap &&interpolationMap) |
| Sets or changes the entire internal interpolation map. | |
| bool | hasValue (const TKey &key) const |
| Returns whether this interpolation map object holds a value for a specified key. | |
| TValue & | value (const TKey &key) |
| Returns the value of this interpolation map object defined by a corresponding key. | |
| bool | remove (const TKey &key) |
| Removes an elements (pair of key and value) from this interpolation map object. | |
| bool | insert (const TKey &key, const TValue &value, const bool forceOverwrite=false) |
| Inserts a new pair of key and value to this map object. | |
| bool | insert (const TKey &key, TValue &&value, const bool forceOverwrite=false) |
| Inserts a new pair of key and value to this map object. | |
| TValue | linear (const TKey &key) const |
| Returns the linear interpolation of the stored values for a given key. | |
| 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. | |
| InterpolationMap< TKey, TValue, TFactor > & | operator= (const InterpolationMap< TKey, TValue, TFactor > &object) |
| Assign operator. | |
| InterpolationMap< TKey, TValue, TFactor > & | operator= (InterpolationMap< TKey, TValue, TFactor > &&object) noexcept |
| Move operator. | |
| bool | operator== (const InterpolationMap< TKey, TValue, TFactor > &object) const |
| Returns whether two interpolation objects are equal. | |
| bool | operator!= (const InterpolationMap< TKey, TValue, TFactor > &object) const |
| Returns whether two interpolation objects are not equal. | |
| TValue & | operator[] (const TKey &key) |
| Returns the value of this interpolation map object defined by a corresponding key. | |
Static Public Member Functions | |
| static TValue | linear (const ValueMap &valueMap, const TKey &key) |
| Returns the linear interpolation of given values for a given key. | |
| 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. | |
Protected Attributes | |
| ValueMap | interpolationValueMap |
| Map mapping keys to values. | |
This class implements an interpolation map allowing to determine an interplated value between several individual key values.
| TKey | The data type of the stored keys |
| TValue | The data type of the stored values |
| TFactor | The data type of the interpolation factor |
| using Ocean::InterpolationMap< TKey, TValue, TFactor >::LinearInterpolationFunction = TValue (*)(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].
| using Ocean::InterpolationMap< TKey, TValue, TFactor >::ValueMap = std::map<TKey, TValue> |
Definition of a map mapping keys to values.
|
inline |
Default constructor.
|
inline |
Copy constructor for interpolation maps.
| interpolationMap | The interpolation map to copy |
|
inlinenoexcept |
Move constructor for interpolation maps.
| interpolationMap | The interpolation map to move |
|
inline |
Creates a new interpolation map object by a given value map.
| valueMap | The value map that will be stored in this object |
|
inline |
Creates a new interpolation map object by a given value map.
| valueMap | The value map that will be moved to this object |
|
inline |
Clears all elements (pairs of keys and values) of this interpolation map object.
|
inline |
Returns whether this interpolation map object holds a value for a specified key.
| key | Key which is checked |
|
inline |
Inserts a new pair of key and value to this map object.
| key | New key to be inserted |
| value | Corresponding value to be instered |
| forceOverwrite | True, if an already existing pair with same key will be overwritten by the given pair |
|
inline |
Inserts a new pair of key and value to this map object.
| key | New key to be inserted |
| value | Corresponding value to be moved |
| forceOverwrite | True, if an already existing pair with same key will be overwritten by the given pair |
|
inline |
Returns the entire internal interpolation map.
|
inline |
Returns whether this interpolation map object is empty.
|
inline |
Returns the linear interpolation of the stored values for a given key.
| key | The key of the value that will be (interpolated and) returned |
|
inline |
Returns the linear interpolation of the stored values for a given key and a given interpolation function.
| key | The key of the value that will be (interpolated and) returned |
| interpolationFunction | An explicit interpolation function that is applied |
|
static |
Returns the linear interpolation of given values for a given key.
| valueMap | The map of values that are used for interpolation |
| key | The key of the value that will be (interpolated and) returned |
|
static |
Returns the linear interpolation of given values for a given key and a given interpolation function.
| valueMap | The map of values that are used for interpolation |
| key | The key of the value that will be (interpolated and) returned |
| interpolationFunction | An explicit interpolation function that is applied |
|
inline |
Returns whether two interpolation objects are not equal.
| object | Second interpoation object |
|
inline |
Assign operator.
| object | The interpolation map object which will be assigned to this object |
|
inlinenoexcept |
Move operator.
| object | The interpolation map object which will be moved to this object |
|
inline |
Returns whether two interpolation objects are equal.
| object | Second interpoation object |
|
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.
| key | Key for that the value is returned |
|
inline |
Removes an elements (pair of key and value) from this interpolation map object.
| key | The key of the element to be removed |
|
inline |
Sets or changes the entire internal interpolation map.
| interpolationMap | The interpolation map that will replace the current one |
|
inline |
Sets or changes the entire internal interpolation map.
| interpolationMap | The interpolation map that will be moved to this object |
|
inline |
Returns the number of elements (pairs of keys and values) of this interpolation map.
|
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.
| key | Key for that the value is returned |
|
protected |
Map mapping keys to values.