IDS peak IPL v1.17.1
Loading...
Searching...
No Matches
peak::common::detail::IntervalT< T > Class Template Reference

Represents a continuous numeric interval with inclusive lower and upper bounds. More...

#include <peak_common/types/peak_common_interval.hpp>

Inheritance diagram for peak::common::detail::IntervalT< T >:
peak::common::detail::RangeT< uint8_t > peak::common::detail::RangeT< T >

Public Types

using type = T

Public Member Functions

constexpr IntervalT (T minimum, T maximum)
 Constructs an interval with the given lower and upper bounds.
PEAK_COMMON_NO_DISCARD constexpr T GetMinimum () const
 Returns the lower boundary of the interval.
PEAK_COMMON_NO_DISCARD constexpr T GetMaximum () const
 Returns the upper boundary of the interval.
template<typename H>
constexpr bool operator== (const IntervalT< H > &rhs) const
 Compares two intervals for equality (integral types).
template<typename H>
constexpr bool operator== (const IntervalT< H > &rhs) const
 Compares two intervals for approximate equality (floating-point types).
constexpr bool operator!= (const IntervalT &rhs) const
 Inequality comparison operator.
PEAK_COMMON_NO_DISCARD std::string ToString () const
 Returns a string representation of the interval.

Friends

std::ostream & operator<< (std::ostream &os, IntervalT interval)
 Outputs the interval as a human-readable string to a stream.

Detailed Description

template<typename T>
class peak::common::detail::IntervalT< T >

Represents a continuous numeric interval with inclusive lower and upper bounds.

The interval is defined by two values: a minimum and a maximum. These values must satisfy the condition: minimum <= maximum.

Template Parameters
TMust be an arithmetic type (integer or floating point).
Since
ids_peak_common 1.0

Member Typedef Documentation

◆ type

template<typename T>
using peak::common::detail::IntervalT< T >::type = T

Constructor & Destructor Documentation

◆ IntervalT()

template<typename T>
peak::common::detail::IntervalT< T >::IntervalT ( T minimum,
T maximum )
inlineconstexpr

Constructs an interval with the given lower and upper bounds.

Parameters
minimumThe lower boundary (inclusive).
maximumThe upper boundary (inclusive).
Exceptions
InvalidParameterExceptionIf the minimum is greater than the maximum.
Since
ids_peak_common 1.0

Member Function Documentation

◆ GetMaximum()

template<typename T>
PEAK_COMMON_NO_DISCARD constexpr T peak::common::detail::IntervalT< T >::GetMaximum ( ) const
inlineconstexpr

Returns the upper boundary of the interval.

Returns
The maximum value of the interval (inclusive).
Since
ids_peak_common 1.0

◆ GetMinimum()

template<typename T>
PEAK_COMMON_NO_DISCARD constexpr T peak::common::detail::IntervalT< T >::GetMinimum ( ) const
inlineconstexpr

Returns the lower boundary of the interval.

Returns
The minimum value of the interval (inclusive).
Since
ids_peak_common 1.0

◆ operator!=()

template<typename T>
bool peak::common::detail::IntervalT< T >::operator!= ( const IntervalT< T > & rhs) const
inlineconstexpr

Inequality comparison operator.

Parameters
rhsThe interval to compare with.
Returns
True if the intervals differ in either minimum or maximum value.
Since
ids_peak_common 1.0

◆ operator==() [1/2]

template<typename T>
template<typename H>
bool peak::common::detail::IntervalT< T >::operator== ( const IntervalT< H > & rhs) const
inlineconstexpr

Compares two intervals for equality (integral types).

Checks whether the minimum and maximum values of both intervals are exactly the same.

Parameters
rhsThe interval to compare against.
Returns
true if both intervals have the same minimum and maximum values; otherwise, false.
Since
ids_peak_common 1.0

◆ operator==() [2/2]

template<typename T>
template<typename H>
bool peak::common::detail::IntervalT< T >::operator== ( const IntervalT< H > & rhs) const
inlineconstexpr

Compares two intervals for approximate equality (floating-point types).

Determines whether two intervals are approximately equal by comparing their minimum and maximum values using a tolerance defined in ULPs (Units in the Last Place).

Parameters
rhsThe interval to compare against.
Returns
true if both intervals have approximately equal minimum and maximum values; otherwise, false.
Since
ids_peak_common 1.0

◆ ToString()

template<typename T>
PEAK_COMMON_NO_DISCARD std::string peak::common::detail::IntervalT< T >::ToString ( ) const
inline

Returns a string representation of the interval.

Returns
A formatted string showing the minimum and maximum values.
Since
ids_peak_common 1.0

◆ operator<<

template<typename T>
std::ostream & operator<< ( std::ostream & os,
IntervalT< T > interval )
friend

Outputs the interval as a human-readable string to a stream.

Parameters
osThe output stream.
intervalThe interval to print.
Returns
Reference to the stream.
Since
ids_peak_common 1.0

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