labelRanges Class Reference

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...
 
labelRangesoperator= (const labelRanges &)=default
 Default copy assignment. More...
 
labelRangesoperator= (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>
labelRangeemplace_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...
 
IstreamreadList (Istream &is)
 Read List of labelRange from Istream, discarding contents. More...
 
OstreamwriteList (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::labelRangeemplace_back (Args &&... args)
 

Friends

Istreamoperator>> (Istream &is, labelRanges &list)
 Use the readList() method to read contents from Istream. More...
 
Ostreamoperator<< (Ostream &os, const labelRanges &list)
 Write to Ostream. Uses the writeList() method. More...
 

Detailed Description

A list of labelRange with constrained list capabilities.

Source files

Definition at line 54 of file labelRanges.H.

Member Typedef Documentation

◆ value_type

The value type the list contains.

Definition at line 83 of file labelRanges.H.

Constructor & Destructor Documentation

◆ labelRanges() [1/8]

labelRanges ( )
default

Default construct.

◆ labelRanges() [2/8]

labelRanges ( const labelRanges )
default

Default copy construct.

◆ labelRanges() [3/8]

labelRanges ( labelRanges &&  )
default

Default move construct.

◆ labelRanges() [4/8]

labelRanges ( const label  initialCapacity)
inlineexplicit

Construct an empty list with given initial capacity.

Definition at line 24 of file labelRangesI.H.

◆ labelRanges() [5/8]

labelRanges ( const UList< labelRange > &  list)
inlineexplicit

Copy construct from list of ranges.

Definition at line 30 of file labelRangesI.H.

◆ labelRanges() [6/8]

labelRanges ( List< labelRange > &&  list)
inline

Move construct from list of ranges.

Definition at line 36 of file labelRangesI.H.

◆ labelRanges() [7/8]

labelRanges ( DynamicList< labelRange, AnySizeMin > &&  list)
inline

Move construct from list of ranges.

Definition at line 44 of file labelRangesI.H.

◆ labelRanges() [8/8]

labelRanges ( Istream is)
explicit

Construct from Istream.

Definition at line 120 of file labelRanges.C.

Member Function Documentation

◆ operator=() [1/2]

labelRanges& operator= ( const labelRanges )
default

Default copy assignment.

◆ operator=() [2/2]

labelRanges& operator= ( labelRanges &&  )
default

Default move assignment.

◆ ranges()

const UList<labelRange>& ranges ( ) const
inlinenoexcept

The list of ranges.

Definition at line 153 of file labelRanges.H.

◆ clear()

void clear ( )
inlinenoexcept

Clear the addressable list of ranges.

Definition at line 158 of file labelRanges.H.

References DynamicList< T, SizeMin >::clear().

Here is the call graph for this function:

◆ empty()

bool empty ( ) const
inlinenoexcept

True if list of ranges is empty.

Definition at line 163 of file labelRanges.H.

References UList< T >::empty().

Here is the call graph for this function:

◆ reserve()

void reserve ( const label  len)
inline

Reserve space for at least this size.

Definition at line 168 of file labelRanges.H.

References DynamicList< T, SizeMin >::reserve().

Here is the call graph for this function:

◆ totalSize()

Foam::label totalSize ( ) const
inlinenoexcept

The linear size (sum of all the element sizes)

Definition at line 129 of file labelRangesI.H.

References range.

◆ contains()

bool contains ( const label  value) const
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().

Here is the caller graph for this function:

◆ add()

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().

Here is the call graph for this function:

◆ remove()

bool remove ( const labelRange range)

◆ emplace_back() [1/2]

labelRange& emplace_back ( Args &&...  args)
inline

Construct a range element at the end of the list, return reference to the new element.

◆ sort()

void sort ( )
inline

Inplace sort of the range elements.

Definition at line 164 of file labelRangesI.H.

References Foam::sort().

Here is the call graph for this function:

◆ labels()

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.

Here is the call graph for this function:

◆ operator[]()

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.

◆ cbegin() [1/2]

Foam::labelRanges::const_iterator cbegin ( ) const
inlinenoexcept

A const_iterator set to the beginning of the list.

Definition at line 173 of file labelRangesI.H.

◆ cend()

const Foam::labelRanges::const_iterator cend ( ) const
inlinenoexcept

A const_iterator set to beyond the end of the list.

Definition at line 180 of file labelRangesI.H.

◆ begin() [1/2]

Foam::labelRanges::const_iterator begin ( ) const
inlinenoexcept

A const_iterator set to the beginning of the list.

Definition at line 187 of file labelRangesI.H.

◆ end()

const Foam::labelRanges::const_iterator end ( ) const
inlinenoexcept

A const_iterator set to beyond the end of the list.

Definition at line 194 of file labelRangesI.H.

◆ cbegin() [2/2]

Foam::labelRanges::const_iterator cbegin ( const label  i) const
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.

Here is the call graph for this function:

◆ begin() [2/2]

Foam::labelRanges::const_iterator begin ( const label  i) const
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().

Here is the call graph for this function:

◆ readList()

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>>().

Here is the caller graph for this function:

◆ writeList()

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<<().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ found()

bool found ( const label  value) const
inline

Same as contains()

Definition at line 339 of file labelRanges.H.

References labelRanges::contains().

Here is the call graph for this function:

◆ emplace_back() [2/2]

Foam::labelRange& emplace_back ( Args &&...  args)
inline

Definition at line 158 of file labelRangesI.H.

References args.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream is,
labelRanges list 
)
friend

Use the readList() method to read contents from Istream.

◆ operator<<

Ostream& operator<< ( Ostream os,
const labelRanges list 
)
friend

Write to Ostream. Uses the writeList() method.


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