Radium Engine  1.5.20
Loading...
Searching...
No Matches
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.

Constructor & Destructor Documentation

◆ Iterator()

template<typename T , uint D>
Ra::Core::Grid< T, D >::Iterator::Iterator ( const Grid< T, D > & grid,
uint startIdx = 0 )
inlineexplicit

Constructor from grid and linear index.

Definition at line 391 of file Grid.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ cast()

template<typename T , uint D>
template<typename T2 >
Grid< T2, D >::Iterator Ra::Core::Grid< T, D >::Iterator::cast ( ) const

Cast to the an iterator in a different type grid.

Definition at line 522 of file Grid.hpp.

◆ getGridSize()

template<typename T , uint D>
const Grid< T, D >::IdxVector & Ra::Core::Grid< T, D >::Iterator::getGridSize ( ) const
inline

Get the associated grid size.

Definition at line 516 of file Grid.hpp.

◆ getLinear()

template<typename T , uint D>
uint Ra::Core::Grid< T, D >::Iterator::getLinear ( ) const
inline

Get the current linear index.

Definition at line 418 of file Grid.hpp.

◆ getVector()

template<typename T , uint D>
Grid< T, D >::IdxVector Ra::Core::Grid< T, D >::Iterator::getVector ( ) const
inline

Get the current vector index.

Definition at line 423 of file Grid.hpp.

◆ isIn()

template<typename T , uint D>
bool Ra::Core::Grid< T, D >::Iterator::isIn ( ) const
inline

Returns true if the current index is inside the grid.

Definition at line 433 of file Grid.hpp.

◆ isOut()

template<typename T , uint D>
bool Ra::Core::Grid< T, D >::Iterator::isOut ( ) const
inline

Returns true if the current index is out of the grid.

Definition at line 428 of file Grid.hpp.

◆ 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 527 of file Grid.hpp.

◆ operator!=()

template<typename T , uint D>
bool Ra::Core::Grid< T, D >::Iterator::operator!= ( const Iterator & rhs) const
inline

Definition at line 156 of file Grid.hpp.

◆ operator++() [1/2]

template<typename T , uint D>
Grid< T, D >::Iterator & Ra::Core::Grid< T, D >::Iterator::operator++ ( )
inline

Advance the iterator to the next-element.

Definition at line 442 of file Grid.hpp.

◆ operator++() [2/2]

template<typename T , uint D>
Grid< T, D >::Iterator Ra::Core::Grid< T, D >::Iterator::operator++ ( int )
inline

Definition at line 454 of file Grid.hpp.

◆ operator+=()

template<typename T , uint D>
Grid< T, D >::Iterator & Ra::Core::Grid< T, D >::Iterator::operator+= ( uint i)
inline

Advance the iterator with an offset of i elements.

Definition at line 468 of file Grid.hpp.

◆ operator--() [1/2]

template<typename T , uint D>
Grid< T, D >::Iterator & Ra::Core::Grid< T, D >::Iterator::operator-- ( )
inline

Move the iterator back to the previous element.

Definition at line 448 of file Grid.hpp.

◆ operator--() [2/2]

template<typename T , uint D>
Grid< T, D >::Iterator Ra::Core::Grid< T, D >::Iterator::operator-- ( int )
inline

Definition at line 461 of file Grid.hpp.

◆ operator-=()

template<typename T , uint D>
Grid< T, D >::Iterator & Ra::Core::Grid< T, D >::Iterator::operator-= ( uint i)
inline

Rewind the iterator with an offset of i elements.

Definition at line 474 of file Grid.hpp.

◆ operator<()

template<typename T , uint D>
bool Ra::Core::Grid< T, D >::Iterator::operator< ( const Iterator & other) const
inline

Definition at line 510 of file Grid.hpp.

◆ operator<=()

template<typename T , uint D>
bool Ra::Core::Grid< T, D >::Iterator::operator<= ( const Iterator & rhs) const
inline

Definition at line 158 of file Grid.hpp.

◆ operator==()

template<typename T , uint D>
bool Ra::Core::Grid< T, D >::Iterator::operator== ( const Iterator & other) const
inline

Definition at line 504 of file Grid.hpp.

◆ operator>()

template<typename T , uint D>
bool Ra::Core::Grid< T, D >::Iterator::operator> ( const Iterator & rhs) const
inline

Definition at line 157 of file Grid.hpp.

◆ operator>=()

template<typename T , uint D>
bool Ra::Core::Grid< T, D >::Iterator::operator>= ( const Iterator & rhs) const
inline

Definition at line 159 of file Grid.hpp.

◆ setFromLinear()

template<typename T , uint D>
void Ra::Core::Grid< T, D >::Iterator::setFromLinear ( uint idx)
inline

Set an existing iterator to a linear index value.

Definition at line 408 of file Grid.hpp.

◆ setFromVector()

template<typename T , uint D>
void Ra::Core::Grid< T, D >::Iterator::setFromVector ( const IdxVector & idx)
inline

Set an existing iterator to a vector index value.

Definition at line 413 of file Grid.hpp.

Friends And Related Symbol Documentation

◆ operator+ [1/3]

template<typename T , uint D>
Iterator operator+ ( const Iterator & it,
const IdxVector & idx )
friend

Definition at line 142 of file Grid.hpp.

◆ operator+ [2/3]

template<typename T , uint D>
Iterator operator+ ( const Iterator & it,
const OffsetVector & idx )
friend

Definition at line 150 of file Grid.hpp.

◆ operator+ [3/3]

template<typename T , uint D>
Iterator operator+ ( const Iterator & it,
uint i )
friend

Definition at line 134 of file Grid.hpp.

◆ operator- [1/2]

template<typename T , uint D>
Iterator operator- ( const Iterator & it,
const IdxVector & idx )
friend

Definition at line 146 of file Grid.hpp.

◆ operator- [2/2]

template<typename T , uint D>
Iterator operator- ( const Iterator & it,
uint i )
friend

Definition at line 138 of file Grid.hpp.


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