CVB++ 14.1
ValueRange< T > Class Template Referencefinal

Container for range definitions. More...

#include <cvb/value_range.hpp>

Public Member Functions

 ValueRange () noexcept=default
 Creates a default value range e.g. from 0 to 0. More...
 
 ValueRange (T min, T max)
 Initializes a ValueRange object. More...
 
Min () const noexcept
 Gets the minimum value. More...
 
void SetMin (T min)
 Sets the minimum value. More...
 
Max () const noexcept
 Gets the maximum value. More...
 
void SetMax (T max)
 Sets the maximum value. More...
 
bool Contains (T value) const noexcept
 Checks if a value is within the range. More...
 
bool IntersectsWith (ValueRange< T > other) const noexcept
 Checks if this value range intersects with another value range. More...
 
bool operator== (const ValueRange< T > &valueRange) const noexcept
 Compares to an other value range. More...
 
bool operator!= (const ValueRange< T > &valueRange) const noexcept
 Compares to an other value range. More...
 
template<class C >
 operator ValueRange< C > () const noexcept
 Enable casting.
 

Detailed Description

template<class T>
class Cvb::ValueRange< T >

Container for range definitions.

Constructor & Destructor Documentation

◆ ValueRange() [1/2]

ValueRange ( )
defaultnoexcept

Creates a default value range e.g. from 0 to 0.

Exceptions
Doesnot throw any exception.

◆ ValueRange() [2/2]

ValueRange ( min,
max 
)
inline

Initializes a ValueRange object.

Parameters
[in]minMinimum value.
[in]maxMaximum value.
Exceptions
Anyexception derived from std::exception including CvbException.

Member Function Documentation

◆ Contains()

bool Contains ( value) const
inlinenoexcept

Checks if a value is within the range.

Parameters
[in]valueValue to be checked.
Returns
True if the value is within the range (border included), false otherwise.
Exceptions
Doesnot throw any exception.

◆ IntersectsWith()

bool IntersectsWith ( ValueRange< T >  other) const
inlinenoexcept

Checks if this value range intersects with another value range.

Parameters
[in]otherRange for intersection test.
Returns
True if this range and the other range have at least one value in common, false otherwise.
Exceptions
Doesnot throw any exception.

◆ Max()

T Max ( ) const
inlinenoexcept

Gets the maximum value.

Returns
The minimum value.
Exceptions
Doesnot throw any exception.

◆ Min()

T Min ( ) const
inlinenoexcept

Gets the minimum value.

Returns
The minimum value.
Exceptions
Doesnot throw any exception.

◆ operator!=()

bool operator!= ( const ValueRange< T > &  valueRange) const
inlinenoexcept

Compares to an other value range.

Parameters
[in]valueRangeOther value range.
Returns
True if not equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator==()

bool operator== ( const ValueRange< T > &  valueRange) const
inlinenoexcept

Compares to an other value range.

Parameters
[in]valueRangeOther value range.
Returns
True if equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ SetMax()

void SetMax ( max)
inline

Sets the maximum value.

Parameters
[in]maxNew maximum value, must be greater or equal than the current minimum value.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ SetMin()

void SetMin ( min)
inline

Sets the minimum value.

Parameters
[in]minNew minimum value, must be less or equal than the current maximum value.
Exceptions
Anyexception derived from std::exception including CvbException.