sliceRange Class Reference

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

Classes

class  const_iterator
 Forward 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

 sliceRange (const sliceRange &)=default
 Default copy construct. More...
 
 sliceRange (sliceRange &&)=default
 Default move construct. More...
 
constexpr sliceRange () noexcept
 An empty slice (0,0,0) More...
 
 sliceRange (label start, label size, label stride) noexcept
 
 sliceRange (const FixedList< label, 3 > &coeffs)
 
bool empty () const noexcept
 Is the range empty? More...
 
bool valid () const noexcept
 Is the range non-empty? More...
 
constexpr label start () const noexcept
 The (inclusive) lower value of the range. More...
 
constexpr label size () const noexcept
 The size of the range. More...
 
constexpr label stride () const noexcept
 The stride for the range. More...
 
constexpr label first () const noexcept
 The (inclusive) lower value of the range - same as start() More...
 
label last () const noexcept
 The (inclusive) upper value of the range. More...
 
List< labellabels () const
 Return the slice as a list of labels. More...
 
sliceRangeoperator= (const sliceRange &)=default
 Default copy assignment. More...
 
sliceRangeoperator= (sliceRange &&)=default
 Default move assignment. More...
 
label operator[] (const label i) const noexcept
 Return element in the range, without bounds checking. More...
 
const_iterator begin () const
 A const_iterator set to the beginning of the range. More...
 
const_iterator cbegin () const
 A const_iterator set to the beginning of the range. More...
 
const const_iterator cend () const
 A const_iterator set to 1 beyond the end of the range. More...
 
const const_iterator end () const
 A const_iterator set to 1 beyond the end of the range. More...
 
indexer generator () const
 Return a forward values generator. More...
 
const_iterator at (const label i) const
 

Protected Attributes

label start_
 The start point for the interval. More...
 
label size_
 The length of the interval. More...
 
label stride_
 The stride within the interval. More...
 

Detailed Description

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

Source files

Definition at line 56 of file sliceRange.H.

Member Typedef Documentation

◆ value_type

typedef label value_type

Type of values the range contains.

Definition at line 77 of file sliceRange.H.

◆ size_type

typedef label size_type

The type that can represent the size of the range.

Definition at line 80 of file sliceRange.H.

Constructor & Destructor Documentation

◆ sliceRange() [1/5]

sliceRange ( const sliceRange )
default

Default copy construct.

◆ sliceRange() [2/5]

sliceRange ( sliceRange &&  )
default

Default move construct.

◆ sliceRange() [3/5]

constexpr sliceRange ( )
inlineconstexprnoexcept

An empty slice (0,0,0)

Definition at line 32 of file sliceRangeI.H.

◆ sliceRange() [4/5]

sliceRange ( label  start,
label  size,
label  stride 
)
inlinenoexcept

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

Definition at line 41 of file sliceRangeI.H.

◆ sliceRange() [5/5]

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

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

Definition at line 36 of file sliceRange.C.

Member Function Documentation

◆ empty()

bool empty ( ) const
inlinenoexcept

Is the range empty?

Definition at line 109 of file sliceRange.H.

References sliceRange::size_.

◆ valid()

bool valid ( ) const
inlinenoexcept

Is the range non-empty?

Definition at line 115 of file sliceRange.H.

References sliceRange::size_.

◆ start()

constexpr label start ( ) const
inlineconstexprnoexcept

The (inclusive) lower value of the range.

Definition at line 121 of file sliceRange.H.

References sliceRange::start_.

◆ size()

constexpr label size ( ) const
inlineconstexprnoexcept

The size of the range.

Definition at line 127 of file sliceRange.H.

References sliceRange::size_.

◆ stride()

constexpr label stride ( ) const
inlineconstexprnoexcept

The stride for the range.

Definition at line 133 of file sliceRange.H.

References sliceRange::stride_.

◆ first()

constexpr label first ( ) const
inlineconstexprnoexcept

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

Definition at line 139 of file sliceRange.H.

References sliceRange::start_.

◆ last()

label last ( ) const
inlinenoexcept

The (inclusive) upper value of the range.

Definition at line 145 of file sliceRange.H.

References sliceRange::size_, sliceRange::start_, and sliceRange::stride_.

◆ labels()

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

Return the slice as a list of labels.

Definition at line 46 of file sliceRange.C.

References stdFoam::cbegin(), and stdFoam::cend().

Here is the call graph for this function:

◆ operator=() [1/2]

sliceRange& operator= ( const sliceRange )
default

Default copy assignment.

◆ operator=() [2/2]

sliceRange& operator= ( sliceRange &&  )
default

Default move assignment.

◆ operator[]()

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

Return element in the range, without bounds checking.

Definition at line 204 of file sliceRangeI.H.

◆ begin()

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

A const_iterator set to the beginning of the range.

The value returned is guaranteed to be the same as start()

Definition at line 165 of file sliceRangeI.H.

◆ cbegin()

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

A const_iterator set to the beginning of the range.

The value returned is guaranteed to be the same as start()

Definition at line 171 of file sliceRangeI.H.

◆ cend()

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

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

The value returned is the same as after()

Definition at line 183 of file sliceRangeI.H.

◆ end()

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

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

The value returned is the same as after()

Definition at line 177 of file sliceRangeI.H.

◆ generator()

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

Return a forward values generator.

Definition at line 189 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 196 of file sliceRangeI.H.

Member Data Documentation

◆ start_

label start_
protected

The start point for the interval.

Definition at line 63 of file sliceRange.H.

Referenced by sliceRange::first(), sliceRange::last(), and sliceRange::start().

◆ size_

label size_
protected

The length of the interval.

Definition at line 66 of file sliceRange.H.

Referenced by sliceRange::empty(), sliceRange::last(), sliceRange::size(), and sliceRange::valid().

◆ stride_

label stride_
protected

The stride within the interval.

Definition at line 69 of file sliceRange.H.

Referenced by sliceRange::last(), and sliceRange::stride().


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