Ocean
|
This class implements basic utility functions. More...
Public Member Functions | |
template<> | |
float | divideBy2 (const float &value) |
template<> | |
double | divideBy2 (const double &value) |
Static Public Member Functions | |
static std::vector< std::string > | separateValues (const std::string &values, const char delimiter=',', const bool removeQuotes=true, const bool trim=true) |
Separates a set of given values. More... | |
template<typename T > | |
static void | sortLowestToFront2 (T &value0, T &value1) |
Sorts two values so that the lowest value will finally be the first value. More... | |
template<typename T > | |
static void | sortLowestToFront3 (T &value0, T &value1, T &value2) |
Sorts three values so that the lowest value will finally be the first value. More... | |
template<typename T , typename TData > | |
static void | sortLowestToFront2 (T &value0, T &value1, TData &data0, TData &data1) |
Sorts two values so that the lowest value will finally be the first value. More... | |
template<typename T , typename TData > | |
static void | sortLowestToFront3 (T &value0, T &value1, T &value2, TData &data0, TData &data1, TData &data2) |
Sorts three values so that the lowest value will finally be the first value. More... | |
template<typename T > | |
static void | sortHighestToFront2 (T &value0, T &value1) |
Sorts two values so that the highest value will finally be the first value. More... | |
template<typename T > | |
static void | sortHighestToFront3 (T &value0, T &value1, T &value2) |
Sorts three values so that the highest value will finally be the first value. More... | |
template<typename T , typename TData > | |
static void | sortHighestToFront2 (T &value0, T &value1, TData &data0, TData &data1) |
Sorts two values so that the highest value will finally be the first value. More... | |
template<typename T , typename TData > | |
static void | sortHighestToFront3 (T &value0, T &value1, T &value2, TData &data0, TData &data1, TData &data2) |
Sorts three values so that the highest value will finally be the first value. More... | |
template<typename T > | |
static unsigned int | lowestValue (const T &value0, const T &value1, const T &value2) |
Returns the index of the lowest value, if two or more values have the lowest value the smallest index of the values will be returned. More... | |
template<typename T > | |
static unsigned int | highestValue (const T &value0, const T &value1, const T &value2) |
Returns the index of the highest value, if two or more values have the highest value the smallest index of the values will be returned. More... | |
template<typename T1 , typename T2 > | |
static bool | sortPairFirst (const std::pair< T1, T2 > &firstPair, const std::pair< T1, T2 > &secondPair) |
Compares two pair objects and returns whether the first value of the first pair is lesser than the first value of the second pair. More... | |
template<typename T > | |
static bool | sortPairFirst (const T &firstPair, const T &secondPair) |
Compares two pair objects and returns whether the first value of the first pair is lesser than the first value of the second pair. More... | |
template<typename T1 , typename T2 > | |
static bool | sortPairSecond (const std::pair< T1, T2 > &firstPair, const std::pair< T1, T2 > &secondPair) |
Compares two pair objects and returns whether the second value of the first pair is lesser than the second value of the second pair. More... | |
template<typename T > | |
static bool | sortPairSecond (const T &firstPair, const T &secondPair) |
Compares two pair objects and returns whether the second value of the first pair is lesser than the second value of the second pair. More... | |
template<typename T > | |
static T | divideBy2 (const T &value) |
This function divides a given value by two. More... | |
static unsigned char | divideBy255 (const unsigned int value) |
This function applies a fast division by 255 for unsigned integer values. More... | |
static bool | isPowerOfTwo (const unsigned int value) |
Returns whether a given value is a power of two. More... | |
static unsigned int | smallestPowerOfTwo (const unsigned int value) |
Returns the smallest power of two value that is equal or larger than a given value. More... | |
static void | multiply64 (const uint64_t left, const uint64_t right, uint64_t &resultHigh, uint64_t &resultLow) |
Multiplies the specified 64 bit integers and stores the 128 bit integer result in resultHigh (64 most significant bits) and resultLow (64 least significant bits). More... | |
static int | compareProducts (const uint64_t leftFactor1, const uint64_t leftFactor2, const uint64_t rightFactor1, const uint64_t rightFactor2) |
Compares the product specified by the first two factors with the product specified by the last two factors. More... | |
This class implements basic utility functions.
|
inlinestatic |
Compares the product specified by the first two factors with the product specified by the last two factors.
leftFactor1 | First factor of left operand |
leftFactor2 | Second factor of left operand |
rightFactor1 | First factor of right operand |
rightFactor2 | Second factor of right operand |
|
inline |
|
inline |
|
inlinestatic |
This function divides a given value by two.
Integer values are divided by two (bit shifting is no applied), floating point values are multiplied by 0.5.
value | The value to be divided |
T | The data type of the value |
|
inlinestatic |
This function applies a fast division by 255 for unsigned integer values.
value | The value that will be divided by 255, with range [0, 65534] |
|
static |
Returns the index of the highest value, if two or more values have the highest value the smallest index of the values will be returned.
value0 | The first value |
value1 | The second value |
value2 | The third value |
|
inlinestatic |
Returns whether a given value is a power of two.
Zero is not a power of two value.
value | The value to be checked, with range [0, infinity) |
|
static |
Returns the index of the lowest value, if two or more values have the lowest value the smallest index of the values will be returned.
value0 | The first value |
value1 | The second value |
value2 | The third value |
|
static |
Multiplies the specified 64 bit integers and stores the 128 bit integer result in resultHigh (64 most significant bits) and resultLow (64 least significant bits).
left | The left operand |
right | The right operand |
resultHigh | Receives the 64 most significant bits of the 128 bit result |
resultLow | Receives the 64 least significant bits of the 128 bit result |
|
static |
Separates a set of given values.
values | Set of values to be separated |
delimiter | The delimiter separating the individual values |
removeQuotes | State determining whether the beginning and ending quotes are removed for each value |
trim | State determining whether prefix and postfix blanks are removed for each value |
|
inlinestatic |
Returns the smallest power of two value that is equal or larger than a given value.
value | The value for that the smallest power of two value is determined, with range [0, 0x80000000] |
|
static |
Sorts two values so that the highest value will finally be the first value.
The sorting is not stable.
value0 | First value |
value1 | Second value |
T | Data type of the values to be sorted |
|
static |
Sorts two values so that the highest value will finally be the first value.
Each value has a connected payload data value that will be sorted accordingly.
The sorting is not stable.
value0 | First value |
value1 | Second value |
data0 | First data value |
data1 | Second data value |
T | Data type of the values to be sorted |
TData | Data type of the payload data value |
|
static |
Sorts three values so that the highest value will finally be the first value.
The sorting is not stable.
value0 | First value |
value1 | Second value |
value2 | Third value |
T | Data type of the values to be sorted |
|
static |
Sorts three values so that the highest value will finally be the first value.
Each value has a connected payload data value that will be sorted accordingly.
The sorting is not stable.
value0 | First value |
value1 | Second value |
value2 | Third value |
data0 | First data value |
data1 | Second data value |
data2 | Third data value |
T | Data type of the values to be sorted |
TData | Data type of the payload data value |
|
static |
Sorts two values so that the lowest value will finally be the first value.
The sorting is not stable.
value0 | First value |
value1 | Second value |
T | Data type of the values to be sorted |
|
static |
Sorts two values so that the lowest value will finally be the first value.
Each value has a connected data value that will be sorted accordingly.
The sorting is not stable.
value0 | First value |
value1 | Second value |
data0 | First data value |
data1 | Second data value |
T | Data type of the values to be sorted |
|
static |
Sorts three values so that the lowest value will finally be the first value.
The sorting is not stable.
value0 | First value |
value1 | Second value |
value2 | Third value |
T | Data type of the values to be sorted |
|
static |
Sorts three values so that the lowest value will finally be the first value.
Each value has a connected data value that will be sorted accordingly.
The sorting is not stable.
value0 | First value |
value1 | Second value |
value2 | Third value |
data0 | First data value |
data1 | Second data value |
data2 | Third data value |
T | Data type of the values to be sorted |
|
inlinestatic |
Compares two pair objects and returns whether the first value of the first pair is lesser than the first value of the second pair.
firstPair | First pair object |
secondPair | Second pair object |
T1 | The data type of the first value of the pair objects |
T2 | The data type of the second value of the pair objects |
|
inlinestatic |
Compares two pair objects and returns whether the first value of the first pair is lesser than the first value of the second pair.
firstPair | First pair object |
secondPair | Second pair object |
T | The data type of the std::pair object |
|
inlinestatic |
Compares two pair objects and returns whether the second value of the first pair is lesser than the second value of the second pair.
firstPair | First pair object |
secondPair | Second pair object |
T1 | The data type of the first value of the pair objects |
T2 | The data type of the second value of the pair objects |
|
inlinestatic |
Compares two pair objects and returns whether the second value of the first pair is lesser than the second value of the second pair.
firstPair | First pair object |
secondPair | Second pair object |
T | The data type of the std::pair object |