A range or interval of labels defined by a start and a size. More...
#include <labelRange.H>


Public Types | |
| typedef label | value_type |
| Type of values the range contains. | |
| typedef label | size_type |
| The type that can represent the size of the range. | |
| Public Types inherited from IntRange< label > | |
| typedef label | value_type |
| Type of values the range contains. | |
| typedef label | size_type |
| The type that can represent the size of the range. | |
| using | const_iterator |
| Input iterator with const access. | |
| using | const_reverse_iterator |
| Reverse input iterator with const access. | |
Public Member Functions | |
| labelRange (const labelRange &) noexcept=default | |
| Copy construct. | |
| labelRange (labelRange &&) noexcept=default | |
| Move construct. | |
| labelRange & | operator= (const labelRange &) noexcept=default |
| Copy assignment. | |
| labelRange & | operator= (labelRange &&) noexcept=default |
| Move assignment. | |
| constexpr | labelRange () noexcept |
| Default construct an empty range (0,0). | |
| constexpr | labelRange (label len) noexcept |
| Construct a range with specified length, starting at zero (0,len). | |
| labelRange (label beg, label len) noexcept | |
| Construct a range from start/length. Applies clamp on length. | |
| labelRange (label beg, label len, bool adjustStart) noexcept | |
| Construct a range from start/size, enforces non-negative size. | |
| labelRange (const MinMax< label > &range) noexcept | |
| Construct from a min/max range (both inclusive), enforces non-negative size. | |
| labelRange (const Pair< label > &start_end) noexcept | |
| Construct from start (inclusive) and end (exclusive) values, enforces non-negative size. | |
| template<class IntT, class = std::enable_if_t <std::is_integral_v<IntT> && (sizeof(IntT) <= sizeof(value_type))>> | |
| labelRange (const IntRange< IntT > &rhs) noexcept | |
| Implicit construct from an IntRange with the same or lower representation (no checks for signed vs unsigned). | |
| labelRange (Istream &is) | |
| Construct from Istream. Read a bracketed (start size) tuple. | |
| void | adjust () noexcept |
| Adjust the start to avoid negative indices. | |
| void | reset (label beg, label len, bool adjustStart) noexcept |
| Reset start and length, enforces non-negative size. | |
| bool | overlaps (const labelRange &range, bool touches=false) const |
| Return true if the ranges overlap. | |
| labelRange | join (const labelRange &range) const |
| Return a joined range, squashing any gaps in between. | |
| labelRange | subset (const labelRange &range) const |
| Calculate the intersection of the range with another. | |
| labelRange | subset (label start, label size) const |
| Calculate the intersection with the given start/size range. | |
| labelRange | subset0 (label len) const |
| Calculate the intersection with the given 0/size range. | |
| template<class IntT, class = std::enable_if_t <std::is_integral_v<IntT> && (sizeof(IntT) <= sizeof(value_type))>> | |
| void | operator= (const IntRange< IntT > &rhs) noexcept |
| Assign from an IntRange with the same or lower representation (no checks for signed vs unsigned). | |
| bool | valid () const noexcept |
| Deprecated(2020-09) True if range has size greater than zero. | |
| Public Member Functions inherited from IntRange< label > | |
| constexpr | IntRange () noexcept |
| Default construct an empty range (0,0). | |
| bool | empty () const noexcept |
| True if range is empty (zero-sized). | |
| bool | good () const noexcept |
| True if range has size greater than zero. | |
| label | size () const noexcept |
| The size of the range. | |
| label | start () const noexcept |
| The (inclusive) lower value of the range. | |
| label | min () const noexcept |
| The (inclusive) lower value of the range, same as start(), begin_value(). | |
| label | max () const noexcept |
| The (inclusive) upper value of the range, same as rbegin_value(). Ill-defined for an empty range. | |
| void | clear () noexcept |
| Reset to (0,0). | |
| void | reset () noexcept |
| Reset to (0,0). | |
| void | setStart (label i) noexcept |
| Set the start position, no checks. | |
| void | setSize (label n) noexcept |
| Change the size, no checks. Identical to resize(). | |
| void | resize (label n) noexcept |
| Change the size, no checks. Identical to setSize(). | |
| void | clampSize () noexcept |
| Enforce non-negative size. | |
| bool | contains (label value) const noexcept |
| True if the (global) value is within the range. | |
| bool | found (label val) const noexcept |
| True if the (global) value is within the range. | |
| const_iterator | at (label i) const |
| Return const_iterator to a position within the range, with bounds checking. | |
| constexpr label | operator[] (label i) const noexcept |
| Offset dereference, without bounds checking. | |
| bool | operator() (label i) const noexcept |
| True if the global value is located within the range. | |
| label | operator++ () noexcept |
| Increase the size by 1. | |
| label | operator+= (label n) noexcept |
| Increase the size by n. | |
| label | operator-- () noexcept |
| Decrease the size by 1, but never below 0. | |
| label | operator-= (label n) noexcept |
| Decrease the size by n, but never below 0. | |
| operator bool () const noexcept | |
| True if range has size greater than zero. Same as good(). | |
| label | begin_value () const noexcept |
| The value at the beginning of the range - same as min(), start(). | |
| label | end_value () const noexcept |
| The value 1 beyond the end of the range. | |
| label | rbegin_value () const noexcept |
| The max value of the range. | |
| label | rend_value () const noexcept |
| The value 1 before the begin of range. | |
| const_iterator | begin () const noexcept |
| A const_iterator set to the beginning of the range. | |
| const_iterator | cbegin () const noexcept |
| A const_iterator set to the beginning of the range. | |
| const_iterator | cend () const noexcept |
| A const_iterator set to 1 beyond the end of the range. | |
| const_iterator | end () const noexcept |
| A const_iterator set to 1 beyond the end of the range. | |
| const_reverse_iterator | rbegin () const noexcept |
| A const_reverse_iterator set to 1 before the end of range. | |
| const_reverse_iterator | crbegin () const noexcept |
| A const_reverse_iterator set to 1 before the end of range. | |
| const_reverse_iterator | rend () const noexcept |
| A const_reverse_iterator set to 1 before the begin of range. | |
| const_reverse_iterator | crend () const noexcept |
| A const_reverse_iterator set to 1 before the begin of range. | |
Static Public Attributes | |
| static int | debug |
| Debugging. | |
A range or interval of labels defined by a start and a size.
Definition at line 63 of file labelRange.H.
| typedef label value_type |
Type of values the range contains.
Definition at line 74 of file labelRange.H.
| typedef label size_type |
The type that can represent the size of the range.
Definition at line 79 of file labelRange.H.
|
defaultnoexcept |
Copy construct.
References labelRange().
Referenced by join(), labelRange(), labelRange(), labelRange(), labelRange(), labelRange(), operator=(), operator=(), overlaps(), subset(), and subset().


|
defaultnoexcept |
Move construct.
References labelRange(), and Foam::noexcept.

|
inlineconstexprnoexcept |
Default construct an empty range (0,0).
Definition at line 24 of file labelRangeI.H.
References IntRange< label >::IntRange(), and Foam::noexcept.

|
inlineexplicitconstexprnoexcept |
Construct a range with specified length, starting at zero (0,len).
Definition at line 30 of file labelRangeI.H.
References IntRange< label >::IntRange(), and Foam::noexcept.

|
inlinenoexcept |
Construct a range from start/length. Applies clamp on length.
Definition at line 36 of file labelRangeI.H.
References IntRange< label >::clampSize(), IntRange< label >::IntRange(), and Foam::noexcept.

|
inlinenoexcept |
Construct a range from start/size, enforces non-negative size.
Optionally adjust the start to avoid any negative indices.
Definition at line 44 of file labelRangeI.H.
References adjust(), IntRange< label >::clampSize(), IntRange< label >::IntRange(), and Foam::noexcept.

|
explicitnoexcept |
Construct from a min/max range (both inclusive), enforces non-negative size.
Passing an invalid range results in an empty labelRange
References labelRange(), Foam::noexcept, and range.

|
explicitnoexcept |
Construct from start (inclusive) and end (exclusive) values, enforces non-negative size.
Passing an invalid range results in an empty labelRange
References labelRange(), and Foam::noexcept.

|
inlinenoexcept |
Implicit construct from an IntRange with the same or lower representation (no checks for signed vs unsigned).
Definition at line 174 of file labelRange.H.
References IntRange< label >::IntRange(), labelRange(), Foam::noexcept, Foam::rhs(), IntRange< label >::size(), and IntRange< label >::start().

|
defaultnoexcept |
Copy assignment.
References labelRange(), and Foam::noexcept.

|
defaultnoexcept |
Move assignment.
References labelRange(), and Foam::noexcept.

|
noexcept |
Adjust the start to avoid negative indices.
The size is decreased accordingly, but will never become negative. Eg, adjusting (-10, 15) becomes (0,5). adjusting (-20, 15) becomes (0,0)
References IntRange< label >::IntRange(), Foam::noexcept, and reset().
Referenced by labelRange(), reset(), Foam::BitOps::set(), Foam::BitOps::set(), and bitSet::set().


|
inlinenoexcept |
Reset start and length, enforces non-negative size.
Optionally adjust the start to avoid any negative indices.
Definition at line 66 of file labelRangeI.H.
References adjust(), IntRange< label >::clampSize(), and IntRange< IntType >::reset().
Referenced by adjust().


| bool overlaps | ( | const labelRange & | range, |
| bool | touches = false ) const |
Return true if the ranges overlap.
Optional test for ranges that also just touch each other
References labelRange(), overlaps(), and range.
Referenced by overlaps().


| labelRange join | ( | const labelRange & | range | ) | const |
Return a joined range, squashing any gaps in between.
A prior overlaps() check can be used to avoid squashing gaps.
References join(), labelRange(), and range.
Referenced by join().


| labelRange subset | ( | const labelRange & | range | ) | const |
Calculate the intersection of the range with another.
If there is no intersection, it returns an empty range with zero for start/size.
References labelRange(), range, and subset().
Referenced by subset(), and subset().


| labelRange subset | ( | label | start, |
| label | size ) const |
Calculate the intersection with the given start/size range.
If there is no intersection, it returns an empty range with zero for start/size.
References labelRange(), IntRange< label >::size(), IntRange< label >::start(), subset(), and subset0().

|
inline |
Calculate the intersection with the given 0/size range.
If there is no intersection, it returns an empty range with zero for start/size.
Definition at line 87 of file labelRangeI.H.
References Foam::subset().
Referenced by subset(), Foam::subsetAdjacency(), and UList< T >::validateRange().


|
inlinenoexcept |
Assign from an IntRange with the same or lower representation (no checks for signed vs unsigned).
Definition at line 264 of file labelRange.H.
References IntRange< label >::IntRange(), Foam::noexcept, IntRange< IntType >::reset(), and Foam::rhs().

|
inlinenoexcept |
Deprecated(2020-09) True if range has size greater than zero.
Definition at line 278 of file labelRange.H.
References IntRange< label >::good(), and Foam::noexcept.

|
static |
Debugging.
Definition at line 97 of file labelRange.H.