sliceRange Class Reference

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

Classes

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

Public Types

typedef label value_type
 Type of values the range contains. More...
 
typedef label size_type
 The type that can represent the size of the range. More...
 

Public Member Functions

constexpr sliceRange () noexcept
 Default construct an empty slice (0,0,0) More...
 
constexpr sliceRange (const label beg, const label len, const label stride) noexcept
 Construct slice from start/size/stride, no checks. More...
 
 sliceRange (const FixedList< label, 3 > &coeffs)
 Construct slice from start/size/stride coefficients, enforce non-negative size and stride. More...
 
bool empty () const noexcept
 True if range is empty (zero-sized) More...
 
bool good () const noexcept
 True if range has size greater than zero. More...
 
label size () const noexcept
 The size of the range. More...
 
label & size () noexcept
 Non-const access to size of the range. More...
 
label start () const noexcept
 The (inclusive) lower value of the range. More...
 
label & start () noexcept
 Non-const access to start of the range. More...
 
label stride () const noexcept
 The stride for the range. More...
 
label & stride () noexcept
 Non-const access to the stride. More...
 
label min () const noexcept
 The (inclusive) lower value of the range, same as start() More...
 
label max () const noexcept
 The (inclusive) upper value of the range. Ill-defined for an empty range. More...
 
List< label > labels () const
 Return list of labels corresponding to the slice. More...
 
label operator[] (const label i) const noexcept
 Return element in the range, without bounds checking. More...
 
 operator bool () const noexcept
 True if range has size greater than zero. Same as good() More...
 
indexer generator () const
 Return a forward values generator. More...
 
const_iterator at (const label i) const
 Return const_iterator to a position within the range, with bounds checking. More...
 
const_iterator begin () const noexcept
 A const_iterator set to the beginning of the range. More...
 
const_iterator cbegin () const noexcept
 A const_iterator set to the beginning of the range. More...
 
const_iterator cend () const noexcept
 A const_iterator set to 1 beyond the end of the range. More...
 
const_iterator end () const noexcept
 A const_iterator set to 1 beyond the end of the range. More...
 
const_reverse_iterator rbegin () const noexcept
 A const_reverse_iterator set to 1 before the end of range. More...
 
const_reverse_iterator crbegin () const noexcept
 A const_reverse_iterator set to 1 before the end of range. More...
 
const_reverse_iterator rend () const noexcept
 A const_reverse_iterator set to 1 before the begin of range. More...
 
const_reverse_iterator crend () const noexcept
 A const_reverse_iterator set to 1 before the begin of range. More...
 

Detailed Description

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

Source files

Definition at line 54 of file sliceRange.H.

Member Typedef Documentation

◆ value_type

typedef label value_type

Type of values the range contains.

Definition at line 81 of file sliceRange.H.

◆ size_type

typedef label size_type

The type that can represent the size of the range.

Definition at line 86 of file sliceRange.H.

Constructor & Destructor Documentation

◆ sliceRange() [1/3]

constexpr sliceRange ( )
inlinenoexcept

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

Definition at line 23 of file sliceRangeI.H.

◆ sliceRange() [2/3]

constexpr sliceRange ( const label  beg,
const label  len,
const label  stride 
)
inlinenoexcept

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

Definition at line 32 of file sliceRangeI.H.

◆ sliceRange() [3/3]

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

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

Definition at line 31 of file sliceRange.C.

Member Function Documentation

◆ empty()

bool empty ( ) const
inlinenoexcept

True if range is empty (zero-sized)

Definition at line 133 of file sliceRange.H.

◆ good()

bool good ( ) const
inlinenoexcept

True if range has size greater than zero.

Definition at line 138 of file sliceRange.H.

◆ size() [1/2]

label size ( ) const
inlinenoexcept

The size of the range.

Definition at line 143 of file sliceRange.H.

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

Here is the caller graph for this function:

◆ size() [2/2]

label& size ( )
inlinenoexcept

Non-const access to size of the range.

Definition at line 148 of file sliceRange.H.

◆ start() [1/2]

label start ( ) const
inlinenoexcept

The (inclusive) lower value of the range.

Definition at line 153 of file sliceRange.H.

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

Here is the caller graph for this function:

◆ start() [2/2]

label& start ( )
inlinenoexcept

Non-const access to start of the range.

Definition at line 158 of file sliceRange.H.

◆ stride() [1/2]

label stride ( ) const
inlinenoexcept

The stride for the range.

Definition at line 163 of file sliceRange.H.

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

Here is the caller graph for this function:

◆ stride() [2/2]

label& stride ( )
inlinenoexcept

Non-const access to the stride.

Definition at line 168 of file sliceRange.H.

◆ min()

label min ( ) const
inlinenoexcept

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

Definition at line 174 of file sliceRange.H.

◆ max()

label max ( ) const
inlinenoexcept

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

Definition at line 180 of file sliceRange.H.

◆ labels()

Foam::List< Foam::label > labels ( ) const

Return list of labels corresponding to the slice.

Definition at line 41 of file sliceRange.C.

References UList< T >::begin(), stdFoam::cbegin(), stdFoam::cend(), UList< T >::end(), and UList< T >::size().

Here is the call graph for this function:

◆ operator[]()

label operator[] ( const label  i) const
inlinenoexcept

Return element in the range, without bounds checking.

Definition at line 193 of file sliceRange.H.

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

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

Definition at line 201 of file sliceRange.H.

◆ generator()

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

Return a forward values generator.

Definition at line 289 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 296 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 308 of file sliceRangeI.H.

◆ cbegin()

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

A const_iterator set to the beginning of the range.

Definition at line 315 of file sliceRangeI.H.

◆ cend()

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

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

Definition at line 329 of file sliceRangeI.H.

◆ end()

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

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

Definition at line 322 of file sliceRangeI.H.

◆ rbegin()

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

A const_reverse_iterator set to 1 before the end of range.

Definition at line 336 of file sliceRangeI.H.

◆ crbegin()

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

A const_reverse_iterator set to 1 before the end of range.

Definition at line 343 of file sliceRangeI.H.

◆ rend()

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

A const_reverse_iterator set to 1 before the begin of range.

Definition at line 350 of file sliceRangeI.H.

◆ crend()

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

A const_reverse_iterator set to 1 before the begin of range.

Definition at line 357 of file sliceRangeI.H.


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