CellModules
Grid2D::CellGrid< cell_t > Class Template Reference

Template class representing a 2D grid of cell pointers. More...

#include <CellGrid.hpp>

Public Member Functions

void resizeGrid (int size)
 Set the grid size to a square of given size. More...
 
void resizeGrid (int w, int h)
 Set the grid size to given width and height. More...
 
void setToreX (bool b)
 Set the toreX property. More...
 
void setToreY (bool b)
 Set the toreY property. More...
 
void setTore (bool x, bool y)
 Set both toreX and toreY properties. More...
 
 CellGrid ()
 Default constructor initializing the grid with default width and height. More...
 

Public Attributes

vector< vector< vector< cell_t * > > > grid
 
bool toreX = false
 
bool toreY = false
 
int height = 10
 
int width = 10
 

Detailed Description

template<typename cell_t>
class Grid2D::CellGrid< cell_t >

Template class representing a 2D grid of cell pointers.

Template Parameters
cell_tType of the cell stored in the grid.

Definition at line 52 of file CellGrid.hpp.

Constructor & Destructor Documentation

◆ CellGrid()

template<typename cell_t >
Grid2D::CellGrid< cell_t >::CellGrid ( )
inline

Default constructor initializing the grid with default width and height.

Definition at line 102 of file CellGrid.hpp.

Member Function Documentation

◆ resizeGrid() [1/2]

template<typename cell_t >
void Grid2D::CellGrid< cell_t >::resizeGrid ( int  size)
inline

Set the grid size to a square of given size.

Parameters
sizeSize of the grid (both width and height)

Definition at line 64 of file CellGrid.hpp.

◆ resizeGrid() [2/2]

template<typename cell_t >
void Grid2D::CellGrid< cell_t >::resizeGrid ( int  w,
int  h 
)
inline

Set the grid size to given width and height.

Parameters
wWidth of the grid
hHeight of the grid

Definition at line 73 of file CellGrid.hpp.

◆ setTore()

template<typename cell_t >
void Grid2D::CellGrid< cell_t >::setTore ( bool  x,
bool  y 
)
inline

Set both toreX and toreY properties.

Parameters
xBoolean value to set toreX
yBoolean value to set toreY

Definition at line 97 of file CellGrid.hpp.

◆ setToreX()

template<typename cell_t >
void Grid2D::CellGrid< cell_t >::setToreX ( bool  b)
inline

Set the toreX property.

Parameters
bBoolean value to set toreX

Definition at line 84 of file CellGrid.hpp.

◆ setToreY()

template<typename cell_t >
void Grid2D::CellGrid< cell_t >::setToreY ( bool  b)
inline

Set the toreY property.

Parameters
bBoolean value to set toreY

Definition at line 90 of file CellGrid.hpp.

Member Data Documentation

◆ grid

template<typename cell_t >
vector<vector<vector<cell_t *> > > Grid2D::CellGrid< cell_t >::grid

3D vector containing vectors of cell pointers

Definition at line 53 of file CellGrid.hpp.

◆ height

template<typename cell_t >
int Grid2D::CellGrid< cell_t >::height = 10

Height of the grid

Definition at line 57 of file CellGrid.hpp.

◆ toreX

template<typename cell_t >
bool Grid2D::CellGrid< cell_t >::toreX = false

Boolean property indicating if the grid wraps around on the X-axis

Definition at line 55 of file CellGrid.hpp.

◆ toreY

template<typename cell_t >
bool Grid2D::CellGrid< cell_t >::toreY = false

Boolean property indicating if the grid wraps around on the Y-axis

Definition at line 56 of file CellGrid.hpp.

◆ width

template<typename cell_t >
int Grid2D::CellGrid< cell_t >::width = 10

Width of the grid

Definition at line 58 of file CellGrid.hpp.


The documentation for this class was generated from the following file: