UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
ufo::Range< T > Struct Template Reference

Represents a closed interval [lower, upper] of a scalar type. More...

#include <lib/core/include/ufo/core/range.hpp>

Classes

struct  Comparator
 Comparator for interval ordering in associative containers. More...
 

Public Types

using value_type = T
 Scalar type of the interval bounds.
 

Public Member Functions

constexpr bool contains (Range const &other) const noexcept
 Checks if another range is fully contained within this interval.
 
constexpr bool contains (value_type value) const noexcept
 Checks if a value is contained within the interval.
 
constexpr bool overlaps (Range const &other) const noexcept
 Checks if this interval overlaps with another range.
 

Public Attributes

value_type lower
 Lower bound of the interval (inclusive).
 
value_type upper
 Upper bound of the interval (inclusive).
 

Friends

constexpr bool operator< (Range const &lhs, Range const &rhs) noexcept
 Interval ordering: [a, b] < [c, d] iff b < c.
 
constexpr bool operator< (Range const &lhs, value_type rhs) noexcept
 Range-scalar ordering: [a, b] < t iff b < t.
 
constexpr bool operator< (value_type lhs, Range const &rhs) noexcept
 Scalar-range ordering: t < [a, b] iff t < a.
 
constexpr bool operator<= (Range const &lhs, Range const &rhs) noexcept
 Interval ordering: [a, b] <= [c, d] iff b <= c.
 
constexpr bool operator<= (Range const &lhs, value_type rhs) noexcept
 Range-scalar ordering: [a, b] <= t iff b <= t.
 
constexpr bool operator<= (value_type lhs, Range const &rhs) noexcept
 Scalar-range ordering: t <= [a, b] iff t <= a.
 
constexpr bool operator== (Range const &lhs, Range const &rhs) noexcept=default
 Equality comparison.
 
constexpr bool operator== (Range const &lhs, value_type rhs) noexcept
 Equality comparison with scalar: [a, b] == t iff a == t && b == t.
 
constexpr bool operator== (value_type lhs, Range const &rhs) noexcept
 Equality comparison with scalar: t == [a, b] iff t == a && t == b.
 
constexpr bool operator> (Range const &lhs, Range const &rhs) noexcept
 Interval ordering: [a, b] > [c, d] iff a > d.
 
constexpr bool operator> (Range const &lhs, value_type rhs) noexcept
 Range-scalar ordering: [a, b] > t iff a > t.
 
constexpr bool operator> (value_type lhs, Range const &rhs) noexcept
 Scalar-range ordering: t > [a, b] iff t > b.
 
constexpr bool operator>= (Range const &lhs, Range const &rhs) noexcept
 Interval ordering: [a, b] >= [c, d] iff a >= d.
 
constexpr bool operator>= (Range const &lhs, value_type rhs) noexcept
 Range-scalar ordering: [a, b] >= t iff a >= t.
 
constexpr bool operator>= (value_type lhs, Range const &rhs) noexcept
 Scalar-range ordering: t >= [a, b] iff t >= b.
 

Detailed Description

template<typename T>
struct ufo::Range< T >

Represents a closed interval [lower, upper] of a scalar type.

Template Parameters
TScalar type (e.g., int, float, double).

Provides interval operations, ordering, and containment checks.

Definition at line 66 of file range.hpp.

Member Typedef Documentation

◆ value_type

template<typename T >
using ufo::Range< T >::value_type = T

Scalar type of the interval bounds.

Definition at line 70 of file range.hpp.

Member Function Documentation

◆ contains() [1/2]

template<typename T >
constexpr bool ufo::Range< T >::contains ( Range< T > const &  other) const
inlineconstexprnoexcept

Checks if another range is fully contained within this interval.

Parameters
[in]otherRange to check.
Returns
True if other is in [lower, upper].

Definition at line 144 of file range.hpp.

◆ contains() [2/2]

template<typename T >
constexpr bool ufo::Range< T >::contains ( value_type  value) const
inlineconstexprnoexcept

Checks if a value is contained within the interval.

Parameters
[in]valueValue to check.
Returns
True if value is in [lower, upper].

Definition at line 133 of file range.hpp.

◆ overlaps()

template<typename T >
constexpr bool ufo::Range< T >::overlaps ( Range< T > const &  other) const
inlineconstexprnoexcept

Checks if this interval overlaps with another range.

Parameters
[in]otherRange to check.
Returns
True if the intervals overlap (i.e., they share any common values).

Definition at line 155 of file range.hpp.

Friends And Related Symbol Documentation

◆ operator< [1/3]

template<typename T >
constexpr bool operator< ( Range< T > const &  lhs,
Range< T > const &  rhs 
)
friend

Interval ordering: [a, b] < [c, d] iff b < c.

Parameters
[in]lhsLeft operand.
[in]rhsRight operand.
Returns
True if this interval is entirely before rhs.

Definition at line 177 of file range.hpp.

◆ operator< [2/3]

template<typename T >
constexpr bool operator< ( Range< T > const &  lhs,
value_type  rhs 
)
friend

Range-scalar ordering: [a, b] < t iff b < t.

Parameters
[in]lhsRange operand.
[in]rhsScalar operand.
Returns
True if upper < rhs.

Definition at line 242 of file range.hpp.

◆ operator< [3/3]

template<typename T >
constexpr bool operator< ( value_type  lhs,
Range< T > const &  rhs 
)
friend

Scalar-range ordering: t < [a, b] iff t < a.

Parameters
[in]lhsScalar operand.
[in]rhsRange operand.
Returns
True if lhs < rhs.lower.

Definition at line 305 of file range.hpp.

◆ operator<= [1/3]

template<typename T >
constexpr bool operator<= ( Range< T > const &  lhs,
Range< T > const &  rhs 
)
friend

Interval ordering: [a, b] <= [c, d] iff b <= c.

Parameters
[in]lhsLeft operand.
[in]rhsRight operand.
Returns
True if this interval is before or touching rhs.

Definition at line 190 of file range.hpp.

◆ operator<= [2/3]

template<typename T >
constexpr bool operator<= ( Range< T > const &  lhs,
value_type  rhs 
)
friend

Range-scalar ordering: [a, b] <= t iff b <= t.

Parameters
[in]lhsRange operand.
[in]rhsScalar operand.
Returns
True if upper <= rhs.

Definition at line 254 of file range.hpp.

◆ operator<= [3/3]

template<typename T >
constexpr bool operator<= ( value_type  lhs,
Range< T > const &  rhs 
)
friend

Scalar-range ordering: t <= [a, b] iff t <= a.

Parameters
[in]lhsScalar operand.
[in]rhsRange operand.
Returns
True if lhs <= rhs.lower.

Definition at line 317 of file range.hpp.

◆ operator== [1/3]

template<typename T >
constexpr bool operator== ( Range< T > const &  lhs,
Range< T > const &  rhs 
)
friend

Equality comparison.

Parameters
[in]lhsLeft operand.
[in]rhsRight operand.
Returns
True if both bounds are equal.

◆ operator== [2/3]

template<typename T >
constexpr bool operator== ( Range< T > const &  lhs,
value_type  rhs 
)
friend

Equality comparison with scalar: [a, b] == t iff a == t && b == t.

Parameters
[in]lhsRange operand.
[in]rhsScalar operand.
Returns
True if both bounds equal rhs.

Definition at line 229 of file range.hpp.

◆ operator== [3/3]

template<typename T >
constexpr bool operator== ( value_type  lhs,
Range< T > const &  rhs 
)
friend

Equality comparison with scalar: t == [a, b] iff t == a && t == b.

Parameters
[in]lhsScalar operand.
[in]rhsRange operand.
Returns
True if both bounds equal lhs.

Definition at line 292 of file range.hpp.

◆ operator> [1/3]

template<typename T >
constexpr bool operator> ( Range< T > const &  lhs,
Range< T > const &  rhs 
)
friend

Interval ordering: [a, b] > [c, d] iff a > d.

Parameters
[in]lhsLeft operand.
[in]rhsRight operand.
Returns
True if this interval is entirely after rhs.

Definition at line 203 of file range.hpp.

◆ operator> [2/3]

template<typename T >
constexpr bool operator> ( Range< T > const &  lhs,
value_type  rhs 
)
friend

Range-scalar ordering: [a, b] > t iff a > t.

Parameters
[in]lhsRange operand.
[in]rhsScalar operand.
Returns
True if lower > rhs.

Definition at line 267 of file range.hpp.

◆ operator> [3/3]

template<typename T >
constexpr bool operator> ( value_type  lhs,
Range< T > const &  rhs 
)
friend

Scalar-range ordering: t > [a, b] iff t > b.

Parameters
[in]lhsScalar operand.
[in]rhsRange operand.
Returns
True if lhs > rhs.upper.

Definition at line 330 of file range.hpp.

◆ operator>= [1/3]

template<typename T >
constexpr bool operator>= ( Range< T > const &  lhs,
Range< T > const &  rhs 
)
friend

Interval ordering: [a, b] >= [c, d] iff a >= d.

Parameters
[in]lhsLeft operand.
[in]rhsRight operand.
Returns
True if this interval is after or touching rhs.

Definition at line 216 of file range.hpp.

◆ operator>= [2/3]

template<typename T >
constexpr bool operator>= ( Range< T > const &  lhs,
value_type  rhs 
)
friend

Range-scalar ordering: [a, b] >= t iff a >= t.

Parameters
[in]lhsRange operand.
[in]rhsScalar operand.
Returns
True if lower >= rhs.

Definition at line 279 of file range.hpp.

◆ operator>= [3/3]

template<typename T >
constexpr bool operator>= ( value_type  lhs,
Range< T > const &  rhs 
)
friend

Scalar-range ordering: t >= [a, b] iff t >= b.

Parameters
[in]lhsScalar operand.
[in]rhsRange operand.
Returns
True if lhs >= rhs.upper.

Definition at line 342 of file range.hpp.

Member Data Documentation

◆ lower

template<typename T >
value_type ufo::Range< T >::lower

Lower bound of the interval (inclusive).

Definition at line 75 of file range.hpp.

◆ upper

template<typename T >
value_type ufo::Range< T >::upper

Upper bound of the interval (inclusive).

Definition at line 80 of file range.hpp.


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