Class SubmapIterator

Class Documentation

class SubmapIterator

Iterator class to iterate through a rectangular part of the map (submap). Before using this iterator, make sure that the requested submap is actually contained in the grid map.

Public Functions

explicit SubmapIterator(const grid_map::SubmapGeometry &submap)

Constructor.

Parameters:

submap – the submap geometry to iterate over.

SubmapIterator(const grid_map::GridMap &gridMap, const grid_map::BufferRegion &bufferRegion)

Constructor.

Parameters:

submap – the buffer region of a grid map to iterate over.

SubmapIterator(const grid_map::GridMap &gridMap, const Index &submapStartIndex, const Size &submapSize)

Constructor.

Parameters:
  • gridMap – the grid map to iterate on.

  • submapStartIndex – the start index of the submap, typically top-left index.

  • submapSize – the size of the submap to iterate on.

explicit SubmapIterator(const SubmapIterator *other)

Copy constructor.

Parameters:

other – the object to copy.

SubmapIterator &operator=(const SubmapIterator &other)

Assignment operator.

Parameters:

iterator – the iterator to copy data from.

Returns:

a reference to *this.

bool operator!=(const SubmapIterator &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 with const.

Returns:

the value to which the iterator is pointing.

const Index &getSubmapIndex() const

Get the current index in the submap.

Returns:

the current index in the submap.

SubmapIterator &operator++()

Increase the iterator to the next element.

Returns:

a reference to the updated iterator.

bool isPastEnd() const

Indicates if iterator is past end.

Returns:

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

const Size &getSubmapSize() const

Returns the size of the submap covered by the iterator.

Returns:

the size of the submap covered by the iterator.