35 #ifndef NAV_GRID_ITERATORS_BASE_ITERATOR_H 36 #define NAV_GRID_ITERATORS_BASE_ITERATOR_H 43 template<
class Derived>
69 virtual Derived
begin()
const = 0;
75 virtual Derived
end()
const = 0;
88 bool operator!=(
const Derived& other) {
return !(*
this == other); }
95 virtual bool fieldsEqual(
const Derived& other) {
return true; }
110 return *
static_cast<Derived*
>(
this);
139 #endif // NAV_GRID_ITERATORS_BASE_ITERATOR_H const nav_grid::Index & operator*() const
Dereference the iterator.
virtual Derived begin() const =0
Helper function for range-style iteration Equivalent to the above constructor.
virtual void increment()=0
Increase the iterator to the next element.
virtual Derived end() const =0
Helper function for range-style iteration.
GenericIndex< unsigned int > Index
virtual ~BaseIterator()=default
Destructor.
const nav_grid::NavGridInfo * info_
BaseIterator(const nav_grid::NavGridInfo &info)
Public Constructor. Takes in a reference to the info and starts at the minimum index.
BaseIterator(const nav_grid::NavGridInfo *info)
Public Constructor. Takes in a pointer to the info and starts at the minimum index.
bool operator==(const Derived &other)
Test if two iterators are equivalent.
BaseIterator(const nav_grid::NavGridInfo *info, const nav_grid::Index &index)
Protected constructor that takes in an arbitrary index.
Iterates over all of the valid indexes that lie within an arbitrary polygon in row major order...
std::input_iterator_tag iterator_category
bool operator!=(const Derived &other)
Test if two iterators are not equivalent - required for testing if iterator is at the end...
Derived & operator++()
Increase the iterator to the next element.
virtual bool fieldsEqual(const Derived &other)
Additional check for whether fields of derived iterators are equal.