Public Member Functions | Protected Attributes | List of all members
nav_grid_iterators::SubGrid Class Reference

Iterator for looping through every index within an aligned rectangular portion of the grid. More...

#include <sub_grid.h>

Inheritance diagram for nav_grid_iterators::SubGrid:
Inheritance graph
[legend]

Public Member Functions

 SubGrid (const nav_grid::NavGridInfo *info, unsigned int min_x, unsigned int min_y, unsigned int width, unsigned int height)
 Public Constructor. More...
 
 SubGrid (const nav_grid::NavGridInfo *info, const nav_core2::UIntBounds &bounds)
 Public Constructor using UIntBounds object. More...
 
 SubGrid (const nav_grid::NavGridInfo *info, const nav_grid::Index &index, unsigned int min_x, unsigned int min_y, unsigned int width, unsigned int height)
 Public constructor that takes in an arbitrary index. More...
 
 SubGrid (const nav_grid::NavGridInfo *info, const nav_grid::Index &index, const nav_core2::UIntBounds &bounds)
 Public constructor using UIntBounds object that takes in an arbitrary index. More...
 
Standard BaseIterator Interface
SubGrid begin () const override
 Helper function for range-style iteration Equivalent to the above constructor. More...
 
SubGrid end () const override
 Helper function for range-style iteration. More...
 
void increment () override
 Increase the iterator to the next element. More...
 
bool fieldsEqual (const SubGrid &other) override
 Additional check for whether fields of derived iterators are equal. More...
 
- Public Member Functions inherited from nav_grid_iterators::BaseIterator< SubGrid >
 BaseIterator (const nav_grid::NavGridInfo *info)
 Public Constructor. Takes in a pointer to the info and starts at the minimum index. More...
 
 BaseIterator (const nav_grid::NavGridInfo &info)
 Public Constructor. Takes in a reference to the info and starts at the minimum index. More...
 
bool operator!= (const SubGrid &other)
 Test if two iterators are not equivalent - required for testing if iterator is at the end. More...
 
const nav_grid::Indexoperator* () const
 Dereference the iterator. More...
 
SubGridoperator++ ()
 Increase the iterator to the next element. More...
 
bool operator== (const SubGrid &other)
 Test if two iterators are equivalent. More...
 
virtual ~BaseIterator ()=default
 Destructor. More...
 

Protected Attributes

unsigned int height_
 
unsigned int min_x_
 
unsigned int min_y_
 
unsigned int width_
 
- Protected Attributes inherited from nav_grid_iterators::BaseIterator< SubGrid >
nav_grid::Index index_
 
const nav_grid::NavGridInfoinfo_
 

Additional Inherited Members

- Public Types inherited from nav_grid_iterators::BaseIterator< SubGrid >
using difference_type = int
 
using iterator_category = std::input_iterator_tag
 
using pointer = nav_grid::Index *
 
using reference = nav_grid::Index &
 
using self_type = SubGrid
 
using value_type = nav_grid::Index
 
- Protected Member Functions inherited from nav_grid_iterators::BaseIterator< SubGrid >
 BaseIterator (const nav_grid::NavGridInfo *info, const nav_grid::Index &index)
 Protected constructor that takes in an arbitrary index. More...
 

Detailed Description

Iterator for looping through every index within an aligned rectangular portion of the grid.

Definition at line 47 of file sub_grid.h.

Constructor & Destructor Documentation

nav_grid_iterators::SubGrid::SubGrid ( const nav_grid::NavGridInfo info,
unsigned int  min_x,
unsigned int  min_y,
unsigned int  width,
unsigned int  height 
)
inline

Public Constructor.

Parameters
infoNavGridInfo for the grid to iterate over
min_xMinimum index (x coordinate)
min_yMinimum index (y coordinate)
widthNumber of indexes in the x direction
heightNumber of indexes in the y direction

Definition at line 58 of file sub_grid.h.

nav_grid_iterators::SubGrid::SubGrid ( const nav_grid::NavGridInfo info,
const nav_core2::UIntBounds bounds 
)
inline

Public Constructor using UIntBounds object.

Parameters
infoNavGridInfo for the grid to iterate over
boundsUIntBounds

Definition at line 67 of file sub_grid.h.

nav_grid_iterators::SubGrid::SubGrid ( const nav_grid::NavGridInfo info,
const nav_grid::Index index,
unsigned int  min_x,
unsigned int  min_y,
unsigned int  width,
unsigned int  height 
)

Public constructor that takes in an arbitrary index.

Parameters
infoNavGridInfo for the grid to iterate over
indexInitial index
min_xMinimum index (x coordinate)
min_yMinimum index (y coordinate)
widthNumber of indexes in the x direction
heightNumber of indexes in the y direction

Definition at line 39 of file sub_grid.cpp.

nav_grid_iterators::SubGrid::SubGrid ( const nav_grid::NavGridInfo info,
const nav_grid::Index index,
const nav_core2::UIntBounds bounds 
)
inline

Public constructor using UIntBounds object that takes in an arbitrary index.

Parameters
infoNavGridInfo for the grid to iterate over
indexInitial index
boundsUIntBounds

Definition at line 88 of file sub_grid.h.

Member Function Documentation

SubGrid nav_grid_iterators::SubGrid::begin ( ) const
overridevirtual

Helper function for range-style iteration Equivalent to the above constructor.

Returns
Iterator representing beginning of the iteration

Implements nav_grid_iterators::BaseIterator< SubGrid >.

Definition at line 68 of file sub_grid.cpp.

SubGrid nav_grid_iterators::SubGrid::end ( ) const
overridevirtual

Helper function for range-style iteration.

Returns
Iterator representing end of the iteration, with an invalid index

Implements nav_grid_iterators::BaseIterator< SubGrid >.

Definition at line 73 of file sub_grid.cpp.

bool nav_grid_iterators::SubGrid::fieldsEqual ( const SubGrid other)
overridevirtual

Additional check for whether fields of derived iterators are equal.

Helps make overriding the == operator easy.

Reimplemented from nav_grid_iterators::BaseIterator< SubGrid >.

Definition at line 88 of file sub_grid.cpp.

void nav_grid_iterators::SubGrid::increment ( )
overridevirtual

Increase the iterator to the next element.

Implements nav_grid_iterators::BaseIterator< SubGrid >.

Definition at line 78 of file sub_grid.cpp.

Member Data Documentation

unsigned int nav_grid_iterators::SubGrid::height_
protected

Definition at line 100 of file sub_grid.h.

unsigned int nav_grid_iterators::SubGrid::min_x_
protected

Definition at line 100 of file sub_grid.h.

unsigned int nav_grid_iterators::SubGrid::min_y_
protected

Definition at line 100 of file sub_grid.h.

unsigned int nav_grid_iterators::SubGrid::width_
protected

Definition at line 100 of file sub_grid.h.


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


nav_grid_iterators
Author(s):
autogenerated on Sun Jan 10 2021 04:08:42