Class GridMapIterator

Inheritance Relationships

Derived Type

Class Documentation

class GridMapIterator

Iterator class to iterate trough the entire grid map.

Subclassed by grid_map::SlidingWindowIterator

Public Functions

explicit GridMapIterator(const grid_map::GridMap &gridMap)

Constructor.

Parameters:

gridMap – the grid map to iterate on.

explicit GridMapIterator(const GridMapIterator *other)

Copy constructor.

Parameters:

other – the object to copy.

GridMapIterator &operator=(const GridMapIterator &other)

Assignment operator.

Parameters:

iterator – the iterator to copy data from.

Returns:

a reference to *this.

bool operator!=(const GridMapIterator &other) const

Compare to another iterator.

Returns:

whether the current iterator points to a different address than the other one.

const Index operator*() const

Dereference the iterator to return the regular index (2-dim.) of the cell to which the iterator is pointing at.

Returns:

the regular index (2-dim.) of the cell on which the iterator is pointing.

const size_t &getLinearIndex() const

Returns the the linear (1-dim.) index of the cell the iterator is pointing at. Note: Use this access for improved efficiency when working with large maps. Example: See runGridMapIteratorVersion3() of grid_map_demos/src/iterator_benchmark.cpp.

Returns:

the 1d linear index.

const Index getUnwrappedIndex() const

Retrieve the index as unwrapped index, i.e., as the corresponding index of a grid map with no circular buffer offset.

virtual GridMapIterator &operator++()

Increase the iterator to the next element.

Returns:

a reference to the updated iterator.

GridMapIterator end() const

Return the end iterator

Returns:

the end iterator (useful when performing normal iterator processing with ++).

bool isPastEnd() const

Indicates if iterator is past end.

Returns:

true if iterator is out of scope, false if end has not been reached.

Protected Attributes

Size size_

Size of the buffer.

Index startIndex_

Start index of the circular buffer.

size_t linearSize_

Linear size of the data.

size_t linearIndex_

Linear index.

bool isPastEnd_

Is iterator out of scope.