Go to the documentation of this file.
12 template<
class Cell, const
bool debug=false>
class Array2D{
14 Array2D(
int xsize=0,
int ysize=0);
19 void resize(
int xmin,
int ymin,
int xmax,
int ymax);
22 inline bool isInside(
int x,
int y)
const;
23 inline const Cell&
cell(
int x,
int y)
const;
24 inline Cell&
cell(
int x,
int y);
43 template <
class Cell, const
bool debug>
49 if (m_xsize>0 && m_ysize>0){
50 m_cells=
new Cell*[m_xsize];
51 for (
int i=0; i<m_xsize; i++)
52 m_cells[i]=
new Cell[m_ysize];
59 std::cerr << __func__ << std::endl;
60 std::cerr <<
"m_xsize= " << m_xsize<< std::endl;
61 std::cerr <<
"m_ysize= " << m_ysize<< std::endl;
65 template <
class Cell, const
bool debug>
68 for (
int i=0; i<m_xsize; i++)
73 m_cells=
new Cell*[m_xsize];
74 for (
int i=0; i<m_xsize; i++)
75 m_cells[i]=
new Cell[m_ysize];
77 for (
int x=0; x<m_xsize; x++)
78 for (
int y=0; y<m_ysize; y++)
82 std::cerr << __func__ << std::endl;
83 std::cerr <<
"m_xsize= " << m_xsize<< std::endl;
84 std::cerr <<
"m_ysize= " << m_ysize<< std::endl;
89 template <
class Cell, const
bool debug>
93 m_cells=
new Cell*[m_xsize];
94 for (
int x=0; x<m_xsize; x++){
95 m_cells[x]=
new Cell[m_ysize];
96 for (
int y=0; y<m_ysize; y++)
100 std::cerr << __func__ << std::endl;
101 std::cerr <<
"m_xsize= " << m_xsize<< std::endl;
102 std::cerr <<
"m_ysize= " << m_ysize<< std::endl;
106 template <
class Cell, const
bool debug>
109 std::cerr << __func__ << std::endl;
110 std::cerr <<
"m_xsize= " << m_xsize<< std::endl;
111 std::cerr <<
"m_ysize= " << m_ysize<< std::endl;
113 for (
int i=0; i<m_xsize; i++){
114 delete [] m_cells[i];
121 template <
class Cell, const
bool debug>
124 std::cerr << __func__ << std::endl;
125 std::cerr <<
"m_xsize= " << m_xsize<< std::endl;
126 std::cerr <<
"m_ysize= " << m_ysize<< std::endl;
128 for (
int i=0; i<m_xsize; i++){
129 delete [] m_cells[i];
139 template <
class Cell, const
bool debug>
143 Cell ** newcells=
new Cell *[xsize];
144 for (
int x=0; x<xsize; x++){
145 newcells[x]=
new Cell[ysize];
147 int dx= xmin < 0 ? 0 : xmin;
148 int dy= ymin < 0 ? 0 : ymin;
149 int Dx=xmax<this->m_xsize?xmax:this->m_xsize;
150 int Dy=ymax<this->m_ysize?ymax:this->m_ysize;
151 for (
int x=dx; x<Dx; x++){
152 for (
int y=dy; y<Dy; y++){
153 newcells[x-xmin][y-ymin]=this->m_cells[x][y];
155 delete [] this->m_cells[x];
157 delete [] this->m_cells;
158 this->m_cells=newcells;
163 template <
class Cell, const
bool debug>
165 return x>=0 && y>=0 && x<m_xsize && y<m_ysize;
168 template <
class Cell, const
bool debug>
170 assert(isInside(x,y));
171 return m_cells[x][y];
175 template <
class Cell, const
bool debug>
177 assert(isInside(x,y));
178 return m_cells[x][y];
void resize(int xmin, int ymin, int xmax, int ymax)
const Cell & cell(const IntPoint &p) const
const Cell & cell(int x, int y) const
AccessibilityState cellState(const IntPoint &p) const
AccessibilityState cellState(int x, int y) const
bool isInside(int x, int y) const
Array2D(int xsize=0, int ysize=0)
Array2D & operator=(const Array2D &)
Cell & cell(const IntPoint &p)
bool isInside(const IntPoint &p) const
int getPatchMagnitude() const
openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Thu Oct 19 2023 02:25:51