IDS peak ICV v1.4.0
Loading...
Searching...
No Matches
IntervalT< T > Class Template Reference

#include <peak_common/types/peak_common_interval.hpp>

Inheritance diagram for IntervalT< 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.
 
constexpr T GetMinimum () const
 Returns the lower boundary of the interval.
 
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.
 
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 type = T

Constructor & Destructor Documentation

◆ IntervalT()

template<typename 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 >
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 >
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 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 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 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 >
std::string 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

Friends And Related Symbol Documentation

◆ 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