The minimum maximum values template class. More...
#include "murl_math_min_max.h"
Public Types | |
using | ValueType = DataType |
The template parameter value type. | |
Public Member Functions | |
MinMax () | |
The default constructor. More... | |
MinMax (const DataType &min, const DataType &max) | |
Constructor to initialize with a given minimum and maximum value. More... | |
MinMax (const Array< DataType > &values) | |
Constructor to initialize with given values. More... | |
void | Reset () |
Reset the minimum and maximum value. More... | |
void | Add (const DataType &value) |
Add a value. More... | |
void | Add (const Array< DataType > &values) |
Add values. More... | |
const DataType & | GetMin () const |
Get the minimum. More... | |
const DataType & | GetMax () const |
Get the maximum. More... | |
Bool | IsInRange (const DataType &value) const |
Check if a value is in minimum / maximum range. More... | |
Bool | IsInRangeEx (const DataType &value) const |
Check if a value is in minimum / maximum range excluding the bounds. More... | |
Bool | IsInRangeExMin (const DataType &value) const |
Check if a value is in minimum / maximum range excluding minimum. More... | |
Bool | IsInRangeExMax (const DataType &value) const |
Check if a value is in minimum / maximum range excluding maximum. More... | |
void | Unite (const MinMax &other) |
Unite this MinMax with another MinMax object. More... | |
void | SetMin (const DataType &min) |
Set the minimum. More... | |
void | SetMax (const DataType &max) |
Set the maximum. More... | |
void | Set (const DataType &min, const DataType &max) |
Set the minimum and the maximum. More... | |
String | ToString () const |
Get the string representation of the object. More... | |
Protected Attributes | |
DataType | mMin |
The minimum value. | |
DataType | mMax |
The maximum value. | |
Friends | |
bool | operator== (const MinMax &lhs, const MinMax &rhs) |
Equal to comparison operator. More... | |
bool | operator!= (const MinMax &lhs, const MinMax &rhs) |
Not equal to comparison operator. More... | |
Detailed Description
template<class DataType, class LimitsType = Limits<DataType>>
class Murl::Math::MinMax< DataType, LimitsType >
The minimum maximum values template class.
This template can be specialized with UInt32, SInt32, UInt64, SInt64, Float and Double, e.g:
Specialization of other datatypes require the LimitsType template parameter, e.g. use of System::Time:
- Template Parameters
-
DataType The minimum and maximum value datatype, must support being compared with operator<. LimitsType The datatype's limits type, must implement a static Min() and Max() method.
Constructor & Destructor Documentation
◆ MinMax() [1/3]
|
inline |
The default constructor.
Initialize the minimum with LimitsType::Max() and the maximum with LimitsType::Min().
◆ MinMax() [2/3]
|
inline |
Constructor to initialize with a given minimum and maximum value.
- Parameters
-
min The minimum value. max The maximum value.
◆ MinMax() [3/3]
|
inline |
Constructor to initialize with given values.
Initialize the minimum with LimitsType::Max() and the maximum with LimitsType::Min() and Add() values from an array.
- Parameters
-
values The values to add.
References Murl::Math::MinMax< DataType, LimitsType >::Add().
Member Function Documentation
◆ Reset()
|
inline |
Reset the minimum and maximum value.
Set the minimum to LimitsType::Max() and the maximum to LimitsType::Min().
References Murl::Math::Max(), Murl::Math::Min(), Murl::Math::MinMax< DataType, LimitsType >::mMax, and Murl::Math::MinMax< DataType, LimitsType >::mMin.
◆ Add() [1/2]
|
inline |
Add a value.
Set the minimum to the value if the value is less than the current minimum. Set the maximum to the value if the value is greater than the current maximum.
- Parameters
-
value The value to add.
References Murl::Math::MinMax< DataType, LimitsType >::mMax, and Murl::Math::MinMax< DataType, LimitsType >::mMin.
Referenced by Murl::Math::MinMax< DataType, LimitsType >::Add(), and Murl::Math::MinMax< DataType, LimitsType >::MinMax().
◆ Add() [2/2]
|
inline |
Add values.
Add() all values from an array.
- Parameters
-
values The values to add.
References Murl::Math::MinMax< DataType, LimitsType >::Add().
◆ GetMin()
|
inline |
◆ GetMax()
|
inline |
◆ IsInRange()
|
inline |
Check if a value is in minimum / maximum range.
- Parameters
-
value The value to check.
- Returns
- true if the value is greater or equal the minimum and less or equal the maximum.
References Murl::Math::MinMax< DataType, LimitsType >::mMax, and Murl::Math::MinMax< DataType, LimitsType >::mMin.
◆ IsInRangeEx()
|
inline |
Check if a value is in minimum / maximum range excluding the bounds.
- Parameters
-
value The value to check.
- Returns
- true if the value is greater the minimum and less the maximum.
References Murl::Math::MinMax< DataType, LimitsType >::mMax, and Murl::Math::MinMax< DataType, LimitsType >::mMin.
◆ IsInRangeExMin()
|
inline |
Check if a value is in minimum / maximum range excluding minimum.
- Parameters
-
value The value to check.
- Returns
- true if the value is greater the minimum and less or equal the maximum.
References Murl::Math::MinMax< DataType, LimitsType >::mMax, and Murl::Math::MinMax< DataType, LimitsType >::mMin.
◆ IsInRangeExMax()
|
inline |
Check if a value is in minimum / maximum range excluding maximum.
- Parameters
-
value The value to check.
- Returns
- true if the value is greater or equal the minimum and less the maximum.
References Murl::Math::MinMax< DataType, LimitsType >::mMax, and Murl::Math::MinMax< DataType, LimitsType >::mMin.
◆ Unite()
|
inline |
Unite this MinMax with another MinMax object.
- Parameters
-
other The other MinMax object to unite.
References Murl::Math::MinMax< DataType, LimitsType >::mMax, and Murl::Math::MinMax< DataType, LimitsType >::mMin.
◆ SetMin()
|
inline |
Set the minimum.
- Parameters
-
min The minimum to set.
References Murl::Math::MinMax< DataType, LimitsType >::mMin.
◆ SetMax()
|
inline |
Set the maximum.
- Parameters
-
max The maximum to set.
References Murl::Math::MinMax< DataType, LimitsType >::mMax.
◆ Set()
|
inline |
Set the minimum and the maximum.
- Parameters
-
min The maximum to set. max The maximum to set.
References Murl::Math::MinMax< DataType, LimitsType >::mMax, and Murl::Math::MinMax< DataType, LimitsType >::mMin.
◆ ToString()
|
inline |
Get the string representation of the object.
- Returns
- The string representation of the object.
References Murl::Math::MinMax< DataType, LimitsType >::mMax, Murl::Math::MinMax< DataType, LimitsType >::mMin, and Murl::Util::ValueToString().
Friends And Related Function Documentation
◆ operator==
|
friend |
Equal to comparison operator.
- Parameters
-
lhs The left hand side to compare. rhs The right hand side to compare.
- Returns
- true if minimum and maximum are the same.
◆ operator!=
|
friend |
Not equal to comparison operator.
- Parameters
-
lhs The left hand side vector to compare. rhs The right hand side vector to compare.
- Returns
- true if minimum and maximum are not the same.
The documentation for this class was generated from the following file:
- murl_math_min_max.h