SubmapIterator.cpp
Go to the documentation of this file.
1 /*
2  * SubmapIterator.hpp
3  *
4  * Created on: Sep 22, 2014
5  * Author: Péter Fankhauser
6  * Institute: ETH Zurich, ANYbotics
7  */
8 
11 
12 using namespace std;
13 
14 namespace grid_map {
15 
16 SubmapIterator::SubmapIterator(const grid_map::SubmapGeometry& submap)
17  : SubmapIterator(submap.getGridMap(), submap.getStartIndex(), submap.getSize())
18 {
19 }
20 
22  const grid_map::BufferRegion& bufferRegion)
23  : SubmapIterator(gridMap, bufferRegion.getStartIndex(), bufferRegion.getSize())
24 {
25 }
26 
27 
28 SubmapIterator::SubmapIterator(const grid_map::GridMap& gridMap, const Index& submapStartIndex,
29  const Size& submapSize)
30 {
31  size_ = gridMap.getSize();
32  startIndex_ = gridMap.getStartIndex();
33  index_ = submapStartIndex;
34  submapSize_ = submapSize;
35  submapStartIndex_ = submapStartIndex;
36  submapIndex_.setZero();
37  isPastEnd_ = false;
38 }
39 
41 {
42  size_ = other->size_;
43  startIndex_ = other->startIndex_;
44  submapSize_ = other->submapSize_;
46  index_ = other->index_;
47  submapIndex_ = other->submapIndex_;
48  isPastEnd_ = other->isPastEnd_;
49 }
50 
52 {
53  size_ = other.size_;
54  startIndex_ = other.startIndex_;
55  submapSize_ = other.submapSize_;
57  index_ = other.index_;
58  submapIndex_ = other.submapIndex_;
59  isPastEnd_ = other.isPastEnd_;
60  return *this;
61 }
62 
64 {
65  return (index_ != other.index_).any();
66 }
67 
69 {
70  return index_;
71 }
72 
74 {
75  return submapIndex_;
76 }
77 
79 {
82  return *this;
83 }
84 
86 {
87  return isPastEnd_;
88 }
89 
91 {
92  return submapSize_;
93 }
94 
95 } /* namespace grid_map */
96 
bool incrementIndexForSubmap(Index &submapIndex, Index &index, const Index &submapTopLeftIndex, const Size &submapBufferSize, const Size &bufferSize, const Index &bufferStartIndex=Index::Zero())
Eigen::Array2i Index
Definition: TypeDefs.hpp:22
bool isPastEnd_
Is iterator out of scope.
const Index & getStartIndex() const
Definition: GridMap.cpp:679
Index submapIndex_
Current index in the submap.
Index submapStartIndex_
Top left index of the submap.
Size submapSize_
Submap buffer size.
Eigen::Array2i Size
Definition: TypeDefs.hpp:23
Index startIndex_
Start index of the circular buffer.
SubmapIterator(const grid_map::SubmapGeometry &submap)
Size size_
Size of the buffer.
const Index & getSubmapIndex() const
Index index_
Current index.
SubmapIterator & operator++()
const Index & operator*() const
bool operator!=(const SubmapIterator &other) const
const Size & getSubmapSize() const
const Size & getSize() const
Definition: GridMap.cpp:670
SubmapIterator & operator=(const SubmapIterator &other)


grid_map_core
Author(s): Péter Fankhauser
autogenerated on Tue Jun 25 2019 20:02:08