Radium Engine  1.5.0
Ra::Core::Grid< T, D >::Iterator Class Reference

A vector of signed offsets. More...

#include <Core/Containers/Grid.hpp>

+ Collaboration diagram for Ra::Core::Grid< T, D >::Iterator:

Public Member Functions

 Iterator (const IdxVector &size, uint startIdx=0)
 Constructor from size and linear index.
 
 Iterator (const IdxVector &size, const IdxVector &startIdx)
 Constructor from size and vector index.
 
 Iterator (const Grid< T, D > &grid, uint startIdx=0)
 Constructor from grid and linear index.
 
 Iterator (const Grid< T, D > &grid, const IdxVector &startIdx)
 Constructor from grid and vector index.
 
 Iterator (const Iterator &other)=default
 Default copy constructor and assignment operator.
 
Iteratoroperator= (const Iterator &other)=default
 
template<typename T2 >
Grid< T2, D >::Iterator cast () const
 Cast to the an iterator in a different type grid.
 
void setFromLinear (uint idx)
 Set an existing iterator to a linear index value.
 
void setFromVector (const IdxVector &idx)
 Set an existing iterator to a vector index value.
 
uint getLinear () const
 Get the current linear index.
 
IdxVector getVector () const
 Get the current vector index.
 
const IdxVectorgetGridSize () const
 Get the associated grid size.
 
bool isOut () const
 Returns true if the current index is out of the grid.
 
bool isIn () const
 Returns true if the current index is inside the grid.
 
Iteratoroperator++ ()
 Advance the iterator to the next-element.
 
Iterator operator++ (int)
 
Iteratoroperator-- ()
 Move the iterator back to the previous element.
 
Iterator operator-- (int)
 
Iteratoroperator+= (uint i)
 Advance the iterator with an offset of i elements.
 
Iteratoroperator-= (uint i)
 Rewind the iterator with an offset of i elements.
 
Iteratoroperator+= (const IdxVector &idx)
 
Iteratoroperator-= (const IdxVector &idx)
 
Iteratoroperator+= (const OffsetVector &idx)
 
bool isValidOffset (const OffsetVector &idx)
 
bool operator== (const Iterator &other) const
 
bool operator< (const Iterator &other) const
 
bool operator!= (const Iterator &rhs) const
 
bool operator> (const Iterator &rhs) const
 
bool operator<= (const Iterator &rhs) const
 
bool operator>= (const Iterator &rhs) const
 

Friends

Iterator operator+ (const Iterator &it, uint i)
 
Iterator operator- (const Iterator &it, uint i)
 
Iterator operator+ (const Iterator &it, const IdxVector &idx)
 
Iterator operator- (const Iterator &it, const IdxVector &idx)
 
Iterator operator+ (const Iterator &it, const OffsetVector &idx)
 

Detailed Description

template<typename T, uint D>
class Ra::Core::Grid< T, D >::Iterator

A vector of signed offsets.

This class implements an iterator though elements of the grid that can be referenced with a linear index or a D-dimensional uint vector.

Definition at line 29 of file Grid.hpp.

Member Function Documentation

◆ isValidOffset()

template<typename T , uint D>
bool Ra::Core::Grid< T, D >::Iterator::isValidOffset ( const OffsetVector idx)

Returns true if adding offset idx with current iterator will act as expected and false if it will put it out of bounds.

Definition at line 538 of file Grid.hpp.


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