labelRange Class Reference

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...
 
labelRangeoperator+= (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_iteratorcend () 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_iteratorend () const
 const_iterator set to beyond the end of the range More...
 

Static Public Attributes

static int debug
 

Friends

Istreamoperator>> (Istream &, labelRange &)
 
Ostreamoperator<< (Ostream &, const labelRange &)
 

Detailed Description

A label range specifier.

Source files

Definition at line 57 of file labelRange.H.

Constructor & Destructor Documentation

◆ labelRange() [1/3]

labelRange ( )
inline

Construct an empty range.

Definition at line 29 of file labelRangeI.H.

Referenced by labelRange::join(), and labelRange::less::operator()().

Here is the caller graph for this function:

◆ labelRange() [2/3]

labelRange ( const label  start,
const label  size 
)
inline

Construct a range.

A negative size is automatically changed to zero.

Definition at line 36 of file labelRangeI.H.

References labelRange::clear().

Here is the call graph for this function:

◆ labelRange() [3/3]

labelRange ( Istream is)

Construct from Istream.

Definition at line 39 of file labelRange.C.

References labelRange::intersects().

Here is the call graph for this function:

Member Function Documentation

◆ clear()

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

Here is the caller graph for this function:

◆ empty()

bool empty ( ) const
inline

Is the range empty?

Definition at line 149 of file labelRangeI.H.

Referenced by labelRanges::add(), labelRange::less::operator()(), and labelRanges::remove().

Here is the caller graph for this function:

◆ size()

Foam::label size ( ) const
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++().

Here is the caller graph for this function:

◆ first()

Foam::label first ( ) const
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().

Here is the caller graph for this function:

◆ last()

Foam::label last ( ) const
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().

Here is the caller graph for this function:

◆ contains()

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

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

◆ intersects()

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

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

◆ join()

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

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

◆ operator[]()

Foam::label operator[] ( const label  i) const
inline

Return element in range, no bounds checking.

Definition at line 181 of file labelRangeI.H.

Referenced by labelRange::less::operator()().

Here is the caller graph for this function:

◆ operator<()

bool operator< ( const labelRange rhs) const
inline

Comparison function for sorting, compares the start.

Definition at line 187 of file labelRangeI.H.

References labelRange::first().

Referenced by labelRange::less::operator()().

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

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

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

◆ operator==()

bool operator== ( const labelRange rhs) const
inline

Definition at line 193 of file labelRangeI.H.

Referenced by labelRange::less::operator()().

Here is the caller graph for this function:

◆ operator!=()

bool operator!= ( const labelRange rhs) const
inline

Definition at line 199 of file labelRangeI.H.

References labelRange::const_iterator::operator==().

Referenced by labelRange::less::operator()().

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

◆ cbegin()

Foam::labelRange::const_iterator cbegin ( ) const
inline

const_iterator set to the beginning of the range

Definition at line 117 of file labelRangeI.H.

References labelRange::const_iterator::const_iterator().

Here is the call graph for this function:

◆ cend()

const Foam::labelRange::const_iterator & cend ( ) const
inline

const_iterator set to beyond the end of the range

Definition at line 123 of file labelRangeI.H.

◆ begin()

Foam::labelRange::const_iterator begin ( ) const
inline

const_iterator set to the beginning of the range

Definition at line 129 of file labelRangeI.H.

References labelRange::const_iterator::const_iterator().

Here is the call graph for this function:

◆ end()

const Foam::labelRange::const_iterator & end ( ) const
inline

const_iterator set to beyond the end of the range

Definition at line 135 of file labelRangeI.H.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
labelRange  
)
friend

◆ operator<<

Ostream& operator<< ( Ostream ,
const labelRange  
)
friend

Member Data Documentation

◆ debug

int debug
static

Definition at line 66 of file labelRange.H.

Referenced by labelRanges::remove().


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