Loading...
Searching...
No Matches
sliceRange Class Reference

A set of labels defined by a start, a length and a stride. More...

#include <sliceRange.H>

Classes

class  indexer
 A value indexer, for iteration or generation. More...
class  const_iterator
 Bidirectional input iterator with const access. More...
class  const_reverse_iterator
 Bidirectional reverse input iterator with const access. More...

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 Member Functions

constexpr sliceRange () noexcept
 Default construct an empty slice (0,0,0).
constexpr sliceRange (const label beg, const label len, const label stride) noexcept
 Construct slice from start/size/stride, no checks.
 sliceRange (const FixedList< label, 3 > &coeffs)
 Construct slice from start/size/stride coefficients, enforce non-negative size and stride.
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 & size () noexcept
 Non-const access to size of the range.
label start () const noexcept
 The (inclusive) lower value of the range.
label & start () noexcept
 Non-const access to start of the range.
label stride () const noexcept
 The stride for the range.
label & stride () noexcept
 Non-const access to the stride.
label min () const noexcept
 The (inclusive) lower value of the range, same as start().
label max () const noexcept
 The (inclusive) upper value of the range. Ill-defined for an empty range.
bool equals (const sliceRange &b) const noexcept
 Test equality of start/size/stride.
int compare (const sliceRange &b) const noexcept
 Compare start/size/stride in that order.
label operator[] (const label i) const noexcept
 Return element in the range, without bounds checking.
 operator bool () const noexcept
 True if range has size greater than zero. Same as good().
indexer generator () const
 Return a forward values generator.
const_iterator at (const label i) const
 Return const_iterator to a position within the range, with bounds checking.
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.

Detailed Description

A set of labels defined by a start, a length and a stride.

Source files

Definition at line 64 of file sliceRange.H.

Member Typedef Documentation

◆ value_type

typedef label value_type

Type of values the range contains.

Definition at line 91 of file sliceRange.H.

◆ size_type

typedef label size_type

The type that can represent the size of the range.

Definition at line 96 of file sliceRange.H.

Constructor & Destructor Documentation

◆ sliceRange() [1/3]

sliceRange ( )
inlineconstexprnoexcept

Default construct an empty slice (0,0,0).

Definition at line 23 of file sliceRangeI.H.

References Foam::noexcept.

Referenced by compare(), equals(), and sliceRange().

Here is the caller graph for this function:

◆ sliceRange() [2/3]

sliceRange ( const label beg,
const label len,
const label stride )
inlineconstexprnoexcept

Construct slice from start/size/stride, no checks.

Definition at line 31 of file sliceRangeI.H.

References Foam::noexcept, and stride().

Here is the call graph for this function:

◆ sliceRange() [3/3]

sliceRange ( const FixedList< label, 3 > & coeffs)
explicit

Construct slice from start/size/stride coefficients, enforce non-negative size and stride.

References sliceRange().

Here is the call graph for this function:

Member Function Documentation

◆ empty()

bool empty ( ) const
inlinenoexcept

True if range is empty (zero-sized).

Definition at line 143 of file sliceRange.H.

References empty(), and Foam::noexcept.

Referenced by empty().

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

◆ good()

bool good ( ) const
inlinenoexcept

True if range has size greater than zero.

Definition at line 148 of file sliceRange.H.

References Foam::noexcept.

◆ size() [1/2]

label size ( ) const
inlinenoexcept

The size of the range.

Definition at line 153 of file sliceRange.H.

References Foam::noexcept.

◆ size() [2/2]

label & size ( )
inlinenoexcept

Non-const access to size of the range.

Definition at line 158 of file sliceRange.H.

References Foam::noexcept.

◆ start() [1/2]

label start ( ) const
inlinenoexcept

The (inclusive) lower value of the range.

Definition at line 163 of file sliceRange.H.

References Foam::noexcept.

◆ start() [2/2]

label & start ( )
inlinenoexcept

Non-const access to start of the range.

Definition at line 168 of file sliceRange.H.

References Foam::noexcept.

◆ stride() [1/2]

label stride ( ) const
inlinenoexcept

The stride for the range.

Definition at line 173 of file sliceRange.H.

References Foam::noexcept.

Referenced by sliceRange().

Here is the caller graph for this function:

◆ stride() [2/2]

label & stride ( )
inlinenoexcept

Non-const access to the stride.

Definition at line 178 of file sliceRange.H.

References Foam::noexcept.

◆ min()

label min ( ) const
inlinenoexcept

The (inclusive) lower value of the range, same as start().

Definition at line 184 of file sliceRange.H.

References Foam::noexcept.

◆ max()

label max ( ) const
inlinenoexcept

The (inclusive) upper value of the range. Ill-defined for an empty range.

Definition at line 190 of file sliceRange.H.

References Foam::noexcept.

◆ equals()

bool equals ( const sliceRange & b) const
inlinenoexcept

Test equality of start/size/stride.

Definition at line 46 of file sliceRangeI.H.

References b, and sliceRange().

Referenced by Foam::operator!=(), and Foam::operator==().

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

◆ compare()

int compare ( const sliceRange & b) const
inlinenoexcept

Compare start/size/stride in that order.

Returns
-1,0,+1

Definition at line 62 of file sliceRangeI.H.

References b, and sliceRange().

Referenced by Foam::operator<(), Foam::operator<=(), Foam::operator>(), and Foam::operator>=().

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

◆ operator[]()

label operator[] ( const label i) const
inlinenoexcept

Return element in the range, without bounds checking.

Definition at line 213 of file sliceRange.H.

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

True if range has size greater than zero. Same as good().

Definition at line 221 of file sliceRange.H.

References Foam::noexcept.

◆ generator()

Foam::sliceRange::indexer generator ( ) const
inline

Return a forward values generator.

Definition at line 327 of file sliceRangeI.H.

◆ at()

Foam::sliceRange::const_iterator at ( const label i) const
inline

Return const_iterator to a position within the range, with bounds checking.

Returns
iterator at the requested position, or end() for out-of-bounds

Definition at line 334 of file sliceRangeI.H.

◆ begin()

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

A const_iterator set to the beginning of the range.

Definition at line 346 of file sliceRangeI.H.

References Foam::noexcept.

◆ cbegin()

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

A const_iterator set to the beginning of the range.

Definition at line 353 of file sliceRangeI.H.

References Foam::noexcept.

◆ cend()

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

A const_iterator set to 1 beyond the end of the range.

Definition at line 367 of file sliceRangeI.H.

References Foam::noexcept.

◆ end()

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

A const_iterator set to 1 beyond the end of the range.

Definition at line 360 of file sliceRangeI.H.

References Foam::noexcept.

◆ rbegin()

Foam::sliceRange::const_reverse_iterator rbegin ( ) const
inlinenoexcept

A const_reverse_iterator set to 1 before the end of range.

Definition at line 374 of file sliceRangeI.H.

References Foam::noexcept.

◆ crbegin()

Foam::sliceRange::const_reverse_iterator crbegin ( ) const
inlinenoexcept

A const_reverse_iterator set to 1 before the end of range.

Definition at line 381 of file sliceRangeI.H.

References Foam::noexcept.

◆ rend()

Foam::sliceRange::const_reverse_iterator rend ( ) const
inlinenoexcept

A const_reverse_iterator set to 1 before the begin of range.

Definition at line 388 of file sliceRangeI.H.

References Foam::noexcept.

◆ crend()

Foam::sliceRange::const_reverse_iterator crend ( ) const
inlinenoexcept

A const_reverse_iterator set to 1 before the begin of range.

Definition at line 395 of file sliceRangeI.H.

References Foam::noexcept.


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