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

Iterates over all of the valid indexes of a line. More...

#include <line.h>

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

Public Member Functions

 Line (const Line &other)
 Copy Constructor Required to ensure unique_ptr is set properly. More...
 
 Line (const nav_grid::NavGridInfo *info, double x0, double y0, double x1, double y1, bool include_last_index=true, bool bresenham=true)
 Public Constructor. More...
 
Lineoperator= (const Line &other)
 Assignment Operator Required to ensure unique_ptr is set properly. More...
 
Standard BaseIterator Interface
Line begin () const override
 
Line end () const override
 
void increment () override
 Increase the iterator to the next element. More...
 
bool fieldsEqual (const Line &other) override
 Additional check for whether fields of derived iterators are equal. More...
 
- Public Member Functions inherited from nav_grid_iterators::BaseIterator< Line >
 BaseIterator (const nav_grid::NavGridInfo &info)
 Public Constructor. Takes in a reference to the info and starts at the minimum index. More...
 
 BaseIterator (const nav_grid::NavGridInfo *info)
 Public Constructor. Takes in a pointer to the info and starts at the minimum index. More...
 
virtual Line begin () const=0
 Helper function for range-style iteration Equivalent to the above constructor. More...
 
virtual Line end () const=0
 Helper function for range-style iteration. More...
 
bool operator!= (const Line &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...
 
Lineoperator++ ()
 Increase the iterator to the next element. More...
 
bool operator== (const Line &other)
 Test if two iterators are equivalent. More...
 
virtual ~BaseIterator ()=default
 Destructor. More...
 

Protected Member Functions

void constructIterator ()
 
bool inBounds (const nav_grid::SignedIndex &sindex)
 Check if a SignedIndex is within the bounds of the NavGrid. More...
 
 Line (const nav_grid::NavGridInfo *info, const nav_grid::Index &index, double x0, double y0, double x1, double y1, bool include_last_index, bool bresenham, nav_grid::Index start_index, nav_grid::Index end_index)
 Protected constructor that takes in an arbitrary index and other internal parameters. More...
 
- Protected Member Functions inherited from nav_grid_iterators::BaseIterator< Line >
 BaseIterator (const nav_grid::NavGridInfo *info, const nav_grid::Index &index)
 Protected constructor that takes in an arbitrary index. More...
 

Protected Attributes

bool bresenham_
 
nav_grid::Index end_index_
 
bool include_last_index_
 
std::unique_ptr< AbstractLineIteratorinternal_iterator_
 
int signed_height_
 
int signed_width_
 
nav_grid::Index start_index_
 
double x0_
 
double x1_
 
double y0_
 
double y1_
 
- Protected Attributes inherited from nav_grid_iterators::BaseIterator< Line >
nav_grid::Index index_
 
const nav_grid::NavGridInfoinfo_
 

Additional Inherited Members

- Public Types inherited from nav_grid_iterators::BaseIterator< Line >
using difference_type = int
 
using iterator_category = std::input_iterator_tag
 
using pointer = nav_grid::Index *
 
using reference = nav_grid::Index &
 
using self_type = Line
 
using value_type = nav_grid::Index
 

Detailed Description

Iterates over all of the valid indexes of a line.

Definition at line 48 of file line.h.

Constructor & Destructor Documentation

◆ Line() [1/3]

nav_grid_iterators::Line::Line ( const nav_grid::NavGridInfo info,
double  x0,
double  y0,
double  x1,
double  y1,
bool  include_last_index = true,
bool  bresenham = true 
)

Public Constructor.

Parameters
infoNavGridInfo for the grid to iterate over
x0Start x coordinate
y0Start y coordinate
x1End x coordinate
y1End y coordinate
include_last_indexIf true, will include the end coordinates.

Definition at line 42 of file line.cpp.

◆ Line() [2/3]

nav_grid_iterators::Line::Line ( const Line other)

Copy Constructor Required to ensure unique_ptr is set properly.

Definition at line 80 of file line.cpp.

◆ Line() [3/3]

nav_grid_iterators::Line::Line ( const nav_grid::NavGridInfo info,
const nav_grid::Index index,
double  x0,
double  y0,
double  x1,
double  y1,
bool  include_last_index,
bool  bresenham,
nav_grid::Index  start_index,
nav_grid::Index  end_index 
)
protected

Protected constructor that takes in an arbitrary index and other internal parameters.

Parameters
infoNavGridInfo for the grid to iterate over
indexInitial index
x0Start x coordinate
y0Start y coordinate
x1End x coordinate
y1End y coordinate
include_last_indexIf true, will include the end coordinates.
start_indexThe first valid index
end_indexThe first invalid index

Definition at line 86 of file line.cpp.

Member Function Documentation

◆ begin()

Line nav_grid_iterators::Line::begin ( ) const
override

Definition at line 136 of file line.cpp.

◆ constructIterator()

void nav_grid_iterators::Line::constructIterator ( )
protected

Definition at line 114 of file line.cpp.

◆ end()

Line nav_grid_iterators::Line::end ( ) const
override

Definition at line 141 of file line.cpp.

◆ fieldsEqual()

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

Additional check for whether fields of derived iterators are equal.

Helps make overriding the == operator easy.

Reimplemented from nav_grid_iterators::BaseIterator< Line >.

Definition at line 161 of file line.cpp.

◆ inBounds()

bool nav_grid_iterators::Line::inBounds ( const nav_grid::SignedIndex sindex)
protected

Check if a SignedIndex is within the bounds of the NavGrid.

Definition at line 131 of file line.cpp.

◆ increment()

void nav_grid_iterators::Line::increment ( )
overridevirtual

Increase the iterator to the next element.

Implements nav_grid_iterators::BaseIterator< Line >.

Definition at line 146 of file line.cpp.

◆ operator=()

Line & nav_grid_iterators::Line::operator= ( const Line other)

Assignment Operator Required to ensure unique_ptr is set properly.

Definition at line 96 of file line.cpp.

Member Data Documentation

◆ bresenham_

bool nav_grid_iterators::Line::bresenham_
protected

Definition at line 109 of file line.h.

◆ end_index_

nav_grid::Index nav_grid_iterators::Line::end_index_
protected

Definition at line 111 of file line.h.

◆ include_last_index_

bool nav_grid_iterators::Line::include_last_index_
protected

Definition at line 108 of file line.h.

◆ internal_iterator_

std::unique_ptr<AbstractLineIterator> nav_grid_iterators::Line::internal_iterator_
protected

Definition at line 106 of file line.h.

◆ signed_height_

int nav_grid_iterators::Line::signed_height_
protected

Definition at line 110 of file line.h.

◆ signed_width_

int nav_grid_iterators::Line::signed_width_
protected

Definition at line 110 of file line.h.

◆ start_index_

nav_grid::Index nav_grid_iterators::Line::start_index_
protected

Definition at line 111 of file line.h.

◆ x0_

double nav_grid_iterators::Line::x0_
protected

Definition at line 107 of file line.h.

◆ x1_

double nav_grid_iterators::Line::x1_
protected

Definition at line 107 of file line.h.

◆ y0_

double nav_grid_iterators::Line::y0_
protected

Definition at line 107 of file line.h.

◆ y1_

double nav_grid_iterators::Line::y1_
protected

Definition at line 107 of file line.h.


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


nav_grid_iterators
Author(s):
autogenerated on Sun May 18 2025 02:47:32