A list of labelRange with constrained list capabilities. More...
Classes | |
class | const_iterator |
Forward input iterator with const access. More... | |
Public Types | |
typedef labelRange | value_type |
The value type the list contains. More... | |
Public Member Functions | |
labelRanges ()=default | |
Default construct. More... | |
labelRanges (const labelRanges &)=default | |
Default copy construct. More... | |
labelRanges (labelRanges &&)=default | |
Default move construct. More... | |
labelRanges & | operator= (const labelRanges &)=default |
Default copy assignment. More... | |
labelRanges & | operator= (labelRanges &&)=default |
Default move assignment. More... | |
labelRanges (const label initialCapacity) | |
Construct an empty list with given initial capacity. More... | |
labelRanges (const UList< labelRange > &list) | |
Copy construct from list of ranges. More... | |
labelRanges (List< labelRange > &&list) | |
Move construct from list of ranges. More... | |
template<int AnySizeMin> | |
labelRanges (DynamicList< labelRange, AnySizeMin > &&list) | |
Move construct from list of ranges. More... | |
labelRanges (Istream &is) | |
Construct from Istream. More... | |
const UList< labelRange > & | ranges () const noexcept |
The list of ranges. More... | |
void | clear () noexcept |
Clear the addressable list of ranges. More... | |
bool | empty () const noexcept |
True if list of ranges is empty. More... | |
void | reserve (const label len) |
Reserve space for at least this size. More... | |
label | totalSize () const noexcept |
The linear size (sum of all the element sizes) More... | |
bool | contains (const label value) const noexcept |
True if the value is contained within any of the sub-ranges. More... | |
bool | add (const labelRange &range) |
Add the range to the list. More... | |
bool | remove (const labelRange &range) |
Remove the range from the list. More... | |
template<class... Args> | |
labelRange & | emplace_back (Args &&... args) |
Construct a range element at the end of the list, return reference to the new element. More... | |
void | sort () |
Inplace sort of the range elements. More... | |
List< label > | labels () const |
Return flattened list of all range labels. More... | |
label | operator[] (const label i) const |
Return the value at linear index 'i', -1 for out-of-range. More... | |
const_iterator | cbegin () const noexcept |
A const_iterator set to the beginning of the list. More... | |
const const_iterator | cend () const noexcept |
A const_iterator set to beyond the end of the list. More... | |
const_iterator | begin () const noexcept |
A const_iterator set to the beginning of the list. More... | |
const const_iterator | end () const noexcept |
A const_iterator set to beyond the end of the list. More... | |
const_iterator | cbegin (const label i) const |
Return const_iterator at linear offset i from begin, clamped to [0,size] range. More... | |
const_iterator | begin (const label i) const |
Return const_iterator at linear offset i from begin, clamped to [0,size] range. More... | |
Istream & | readList (Istream &is) |
Read List of labelRange from Istream, discarding contents. More... | |
Ostream & | writeList (Ostream &os, const label shortLen=0) const |
Write List of labelRange, with line-breaks in ASCII when length exceeds shortLen. More... | |
bool | found (const label value) const |
Same as contains() More... | |
template<class... Args> | |
Foam::labelRange & | emplace_back (Args &&... args) |
Friends | |
Istream & | operator>> (Istream &is, labelRanges &list) |
Use the readList() method to read contents from Istream. More... | |
Ostream & | operator<< (Ostream &os, const labelRanges &list) |
Write to Ostream. Uses the writeList() method. More... | |
A list of labelRange with constrained list capabilities.
Definition at line 54 of file labelRanges.H.
typedef labelRange value_type |
The value type the list contains.
Definition at line 83 of file labelRanges.H.
|
default |
Default construct.
|
default |
Default copy construct.
|
default |
Default move construct.
|
inlineexplicit |
Construct an empty list with given initial capacity.
Definition at line 24 of file labelRangesI.H.
|
inlineexplicit |
Copy construct from list of ranges.
Definition at line 30 of file labelRangesI.H.
|
inline |
Move construct from list of ranges.
Definition at line 36 of file labelRangesI.H.
|
inline |
Move construct from list of ranges.
Definition at line 44 of file labelRangesI.H.
|
explicit |
Construct from Istream.
Definition at line 120 of file labelRanges.C.
|
default |
Default copy assignment.
|
default |
Default move assignment.
|
inlinenoexcept |
The list of ranges.
Definition at line 153 of file labelRanges.H.
|
inlinenoexcept |
Clear the addressable list of ranges.
Definition at line 158 of file labelRanges.H.
References DynamicList< T, SizeMin >::clear().
|
inlinenoexcept |
True if list of ranges is empty.
Definition at line 163 of file labelRanges.H.
References UList< T >::empty().
|
inline |
Reserve space for at least this size.
Definition at line 168 of file labelRanges.H.
References DynamicList< T, SizeMin >::reserve().
|
inlinenoexcept |
The linear size (sum of all the element sizes)
Definition at line 129 of file labelRangesI.H.
References range.
|
inlinenoexcept |
True if the value is contained within any of the sub-ranges.
Definition at line 143 of file labelRangesI.H.
References range.
Referenced by labelRanges::found().
bool add | ( | const labelRange & | range | ) |
Add the range to the list.
Definition at line 128 of file labelRanges.C.
References forAll, labelRange::join(), labelRange::overlaps(), range, and labelRange::reset().
bool remove | ( | const labelRange & | range | ) |
Remove the range from the list.
Definition at line 188 of file labelRanges.C.
References IntRange< IntType >::clampSize(), labelRange::debug, Foam::endl(), forAll, Foam::Info, Foam::stringOps::lower(), IntRange< IntType >::max(), IntRange< IntType >::min(), Foam::printRange(), range, labelRange::reset(), and Foam::stringOps::upper().
|
inline |
Construct a range element at the end of the list, return reference to the new element.
|
inline |
Inplace sort of the range elements.
Definition at line 164 of file labelRangesI.H.
References Foam::sort().
Foam::List< Foam::label > labels | ( | ) | const |
Return flattened list of all range labels.
Definition at line 302 of file labelRanges.C.
References UList< T >::begin(), and range.
Foam::label operator[] | ( | const label | i | ) | const |
Return the value at linear index 'i', -1 for out-of-range.
Definition at line 340 of file labelRanges.C.
References range.
|
inlinenoexcept |
A const_iterator set to the beginning of the list.
Definition at line 173 of file labelRangesI.H.
|
inlinenoexcept |
A const_iterator set to beyond the end of the list.
Definition at line 180 of file labelRangesI.H.
|
inlinenoexcept |
A const_iterator set to the beginning of the list.
Definition at line 187 of file labelRangesI.H.
|
inlinenoexcept |
A const_iterator set to beyond the end of the list.
Definition at line 194 of file labelRangesI.H.
|
inline |
Return const_iterator at linear offset i from begin, clamped to [0,size] range.
Definition at line 201 of file labelRangesI.H.
References stdFoam::cbegin(), stdFoam::cend(), and range.
|
inline |
Return const_iterator at linear offset i from begin, clamped to [0,size] range.
Definition at line 229 of file labelRangesI.H.
References stdFoam::cbegin().
Foam::Istream & readList | ( | Istream & | is | ) |
Read List of labelRange from Istream, discarding contents.
Definition at line 364 of file labelRanges.C.
Referenced by Foam::operator>>().
Foam::Ostream & writeList | ( | Ostream & | os, |
const label | shortLen = 0 |
||
) | const |
Write List of labelRange, with line-breaks in ASCII when length exceeds shortLen.
Using '0' suppresses line-breaks entirely.
Definition at line 371 of file labelRanges.C.
References os().
Referenced by Foam::operator<<().
|
inline |
Same as contains()
Definition at line 339 of file labelRanges.H.
References labelRanges::contains().
|
inline |
Definition at line 158 of file labelRangesI.H.
References args.
|
friend |
Use the readList() method to read contents from Istream.
|
friend |
Write to Ostream. Uses the writeList() method.