A label range specifier. More...
Classes | |
class | const_iterator |
An STL const_iterator. More... | |
class | less |
Less function class for sorting labelRange. More... | |
Public Member Functions | |
labelRange () | |
Construct an empty range. More... | |
labelRange (const label start, const label size) | |
Construct a range. More... | |
labelRange (Istream &) | |
Construct from Istream. More... | |
void | clear () |
Reset to zero size. More... | |
bool | empty () const |
Is the range empty? More... | |
label | size () const |
Return the effective size of the range. More... | |
label | first () const |
The (inclusive) lower value of the range. More... | |
label | last () const |
The (inclusive) upper value of the range. More... | |
bool | contains (const label) const |
Return true if the value is within the range. More... | |
bool | intersects (const labelRange &, const bool touches=false) const |
Return true if the ranges intersect. More... | |
labelRange | join (const labelRange &) const |
Return a joined range, squashing any gaps in between. More... | |
label | operator[] (const label) const |
Return element in range, no bounds checking. More... | |
bool | operator< (const labelRange &rhs) const |
Comparison function for sorting, compares the start. More... | |
labelRange & | operator+= (const labelRange &) |
Join ranges, squashing any gaps in between. More... | |
bool | operator== (const labelRange &) const |
bool | operator!= (const labelRange &) const |
const_iterator | cbegin () const |
const_iterator set to the beginning of the range More... | |
const const_iterator & | cend () const |
const_iterator set to beyond the end of the range More... | |
const_iterator | begin () const |
const_iterator set to the beginning of the range More... | |
const const_iterator & | end () const |
const_iterator set to beyond the end of the range More... | |
Static Public Attributes | |
static int | debug |
Friends | |
Istream & | operator>> (Istream &, labelRange &) |
Ostream & | operator<< (Ostream &, const labelRange &) |
|
inline |
Construct an empty range.
Definition at line 29 of file labelRangeI.H.
Referenced by labelRange::join(), and labelRange::less::operator()().
|
inline |
Construct a range.
A negative size is autmatically changed to zero.
Definition at line 36 of file labelRangeI.H.
References labelRange::clear().
labelRange | ( | Istream & | is | ) |
Construct from Istream.
Definition at line 39 of file labelRange.C.
References labelRange::intersects().
|
inline |
Reset to zero size.
Definition at line 143 of file labelRangeI.H.
Referenced by labelRanges::add(), labelRange::labelRange(), labelRange::less::operator()(), and Foam::operator>>().
|
inline |
Is the range empty?
Definition at line 149 of file labelRangeI.H.
Referenced by labelRanges::add(), labelRange::less::operator()(), and labelRanges::remove().
|
inline |
Return the effective size of the range.
Definition at line 155 of file labelRangeI.H.
Referenced by labelRange::intersects(), labelRange::less::operator()(), and labelRange::const_iterator::operator++().
|
inline |
The (inclusive) lower value of the range.
Definition at line 161 of file labelRangeI.H.
Referenced by labelRange::contains(), labelRange::intersects(), labelRange::join(), labelRange::less::operator()(), labelRange::operator+=(), labelRange::operator<(), and labelRanges::remove().
|
inline |
The (inclusive) upper value of the range.
Definition at line 167 of file labelRangeI.H.
Referenced by labelRange::contains(), labelRange::intersects(), labelRange::join(), labelRange::less::operator()(), labelRange::operator+=(), and labelRanges::remove().
|
inline |
Return true if the value is within the range.
Definition at line 173 of file labelRangeI.H.
References labelRange::first(), and labelRange::last().
Referenced by labelRange::less::operator()().
bool intersects | ( | const labelRange & | range, |
const bool | touches = false |
||
) | const |
Return true if the ranges intersect.
Optional test for ranges that also just touch each other
Definition at line 51 of file labelRange.C.
References labelRange::first(), labelRange::last(), and labelRange::size().
Referenced by labelRanges::add(), labelRange::labelRange(), and labelRange::less::operator()().
Foam::labelRange join | ( | const labelRange & | range | ) | const |
Return a joined range, squashing any gaps in between.
A prior intersects() check can be used to avoid squashing gaps.
Definition at line 78 of file labelRange.C.
References labelRange::first(), labelRange::labelRange(), labelRange::last(), Foam::max(), Foam::min(), and range.
Referenced by labelRange::less::operator()().
|
inline |
Return element in range, no bounds checking.
Definition at line 181 of file labelRangeI.H.
Referenced by labelRange::less::operator()().
|
inline |
Comparison function for sorting, compares the start.
Definition at line 187 of file labelRangeI.H.
References labelRange::first().
Referenced by labelRange::less::operator()().
Foam::labelRange & operator+= | ( | const labelRange & | rhs | ) |
Join ranges, squashing any gaps in between.
A prior intersects() check can be used to avoid squashing gaps.
Definition at line 100 of file labelRange.C.
References labelRange::first(), labelRange::last(), Foam::max(), and Foam::min().
Referenced by labelRange::less::operator()().
|
inline |
Definition at line 193 of file labelRangeI.H.
Referenced by labelRange::less::operator()().
|
inline |
Definition at line 199 of file labelRangeI.H.
References labelRange::const_iterator::operator==().
Referenced by labelRange::less::operator()().
|
inline |
const_iterator set to the beginning of the range
Definition at line 117 of file labelRangeI.H.
References labelRange::const_iterator::const_iterator().
|
inline |
const_iterator set to beyond the end of the range
Definition at line 123 of file labelRangeI.H.
|
inline |
const_iterator set to the beginning of the range
Definition at line 129 of file labelRangeI.H.
References labelRange::const_iterator::const_iterator().
|
inline |
const_iterator set to beyond the end of the range
Definition at line 135 of file labelRangeI.H.
|
friend |
|
friend |
|
static |
Definition at line 65 of file labelRange.H.
Referenced by labelRanges::remove().