PLCnext API Documentation 25.0.2.69
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
Arp::Base::Core::Range< T > Class Template Reference

This class represents a range of values of any comparable type. More...

#include <Range.hxx>

Public Types

using Value = T
 

Public Member Functions

 Range (const Value &min, const Value &max)
 Constructs an Range instance. More...
 
const Value & GetMin (void) const
 Gets the lower bound of this range. More...
 
const Value & GetMax (void) const
 Gets the upper bound of this range. More...
 
bool IsEmpty (void) const
 Determines if this range is empty. More...
 
bool Contains (const Value &value) const
 Determines of the supplied value is inside this range. More...
 
bool IsDisjointTo (const Range &other, bool strictDisjoint=false) const
 Determines if the supplied other range is disjoint to this range. More...
 

Static Public Member Functions

template<std::input_iterator InputIt>
static bool AreDisjoint (InputIt begin, InputIt end, bool strictDisjoint=false)
 Checks if all ranges in the sequence determined by begin and end a disjointed More...
 

Friends

auto operator<=> (const Range &lhs, const Range &rhs)=default
 

Detailed Description

template<RangeValue T>
class Arp::Base::Core::Range< T >

This class represents a range of values of any comparable type.

Template Parameters
TThe type of the range values. This type shall be comparable.

Constructor & Destructor Documentation

◆ Range()

template<RangeValue T>
Arp::Base::Core::Range< T >::Range ( const Value &  min,
const Value &  max 
)
inline

Constructs an Range instance.

Template Parameters
TThe data type of the range values.
Parameters
minThe lower bound of the range.
maxThe upper bound of the range.

Member Function Documentation

◆ AreDisjoint()

template<RangeValue T>
template<std::input_iterator InputIt>
bool Arp::Base::Core::Range< T >::AreDisjoint ( InputIt  begin,
InputIt  end,
bool  strictDisjoint = false 
)
static

Checks if all ranges in the sequence determined by begin and end a disjointed

Parameters
beginIterator to the beginning of the sequence
endIterator past the end of the sequence
strictDisjointDetermines ranges may share borders
Returns
true, if a all ranges are disjoint or the sequence is empty or contains only one element. Otherwise false

◆ Contains()

template<RangeValue T>
bool Arp::Base::Core::Range< T >::Contains ( const Value &  value) const
inline

Determines of the supplied value is inside this range.

Template Parameters
TThe data type of the range values.
Parameters
valueThe value to check, if it is contained in this range.
Returns
true if the supplied value is inside this range, otherwise false.

◆ GetMax()

template<RangeValue T>
const T & Arp::Base::Core::Range< T >::GetMax ( void  ) const
inline

Gets the upper bound of this range.

Template Parameters
TThe data type of the range values.
Returns
The upper bound of this range.

◆ GetMin()

template<RangeValue T>
const T & Arp::Base::Core::Range< T >::GetMin ( void  ) const
inline

Gets the lower bound of this range.

Template Parameters
TThe data type of the range values.
Returns
The lower bound of this range.

◆ IsDisjointTo()

template<RangeValue T>
bool Arp::Base::Core::Range< T >::IsDisjointTo ( const Range< T > &  other,
bool  strictDisjoint = false 
) const
inline

Determines if the supplied other range is disjoint to this range.

Template Parameters
TThe data type of the range values.
Parameters
otherThe range to check, if it is disjoint to this range.
strictDisjointDetermines ranges may share borders
Returns
true if the supplied other range is disjoint to this range, otherwise false.

The result of this operation depends on the parameter strictDisjoint, if it is true this operation returns this->GetMax() < other.GetMin() || this->GetMin() > other.GetMax(). if strictDisjoint is false this->GetMax() <= other.GetMin() || this->GetMin() >= other.GetMax() is returned.

◆ IsEmpty()

template<RangeValue T>
bool Arp::Base::Core::Range< T >::IsEmpty ( void  ) const
inline

Determines if this range is empty.

Template Parameters
TThe data type of the range values.
Returns
true if this range is empty, i.e GetMin() == GetMax() otherwise false.

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