Representation of a simple grid. More...
#include <Grid.h>
Classes | |
struct | Cell |
Definition of a cell in this grid. More... | |
struct | EqualCoordPtr |
Equality operator for coordinate pointers. More... | |
struct | HashFunCoordPtr |
Hash function for coordinates. More... | |
struct | SortComponents |
Helper to sort components by size. More... | |
Public Types | |
typedef std::vector< Cell * > | CellArray |
The datatype for arrays of cells. | |
typedef std::vector< int > | Coord |
Definition of a coordinate within this grid. | |
typedef CoordHash::const_iterator | iterator |
We only allow const iterators. | |
Public Member Functions | |
virtual void | add (Cell *cell) |
Add an instantiated cell to the grid. | |
iterator | begin (void) const |
Return the begin() iterator for the grid. | |
virtual void | clear (void) |
Clear all cells in the grid. | |
std::vector< std::vector< Cell * > > | components (void) const |
Get the connected components formed by the cells in this grid (based on neighboring relation). | |
virtual Cell * | createCell (const Coord &coord, CellArray *nbh=NULL) |
virtual void | destroyCell (Cell *cell) const |
Clear the memory occupied by a cell; do not call this function unless remove() was called first. | |
bool | empty (void) const |
Check if the grid is empty. | |
iterator | end (void) const |
Return the end() iterator for the grid. | |
Cell * | getCell (const Coord &coord) const |
Get the cell at a specified coordinate. | |
void | getCells (CellArray &cells) const |
Get the set of instantiated cells in the grid. | |
void | getContent (std::vector< _T > &content) const |
Get the data stored in the cells we are aware of. | |
void | getCoordinates (std::vector< Coord * > &coords) const |
Get the set of coordinates where there are cells. | |
unsigned int | getDimension (void) const |
Return the dimension of the grid. | |
Grid (unsigned int dimension) | |
The constructor takes the dimension of the grid as argument. | |
bool | has (const Coord &coord) const |
Check if a cell exists at the specified coordinate. | |
void | neighbors (Coord &coord, CellArray &list) const |
Get the list of neighbors for a given coordinate. | |
void | neighbors (const Coord &coord, CellArray &list) const |
Get the list of neighbors for a given coordinate. | |
void | neighbors (const Cell *cell, CellArray &list) const |
Get the list of neighbors for a given cell. | |
void | printCoord (Coord &coord, std::ostream &out=std::cout) const |
Print the value of a coordinate to a stream. | |
virtual bool | remove (Cell *cell) |
void | setDimension (unsigned int dimension) |
unsigned int | size (void) const |
Check the size of the grid. | |
virtual void | status (std::ostream &out=std::cout) const |
Print information about the data in this grid structure. | |
virtual | ~Grid (void) |
Destructor. | |
Protected Types | |
typedef boost::unordered_map < Coord *, Cell *, HashFunCoordPtr, EqualCoordPtr > | CoordHash |
Define the datatype for the used hash structure. | |
Protected Member Functions | |
void | freeMemory (void) |
Free the allocated memory. | |
Protected Attributes | |
unsigned int | dimension_ |
The dimension of the grid. | |
CoordHash | hash_ |
The hash holding the cells. | |
unsigned int | maxNeighbors_ |
The maximum number of neighbors a cell can have (2 * dimension). |
Representation of a simple grid.
Definition at line 51 of file Grid.h.
typedef std::vector<Cell*> ompl::Grid< _T >::CellArray |
The datatype for arrays of cells.
Reimplemented in ompl::GridB< _T, LessThanExternal, LessThanInternal >, ompl::GridN< _T >, ompl::GridB< CellData *, OrderCellsByImportance >, and ompl::GridN< CellData * >.
typedef std::vector<int> ompl::Grid< _T >::Coord |
Definition of a coordinate within this grid.
Reimplemented in ompl::GridB< _T, LessThanExternal, LessThanInternal >, ompl::GridN< _T >, ompl::GridB< CellData *, OrderCellsByImportance >, and ompl::GridN< CellData * >.
typedef boost::unordered_map<Coord*, Cell*, HashFunCoordPtr, EqualCoordPtr> ompl::Grid< _T >::CoordHash [protected] |
typedef CoordHash::const_iterator ompl::Grid< _T >::iterator |
ompl::Grid< _T >::Grid | ( | unsigned int | dimension | ) | [inline, explicit] |
virtual ompl::Grid< _T >::~Grid | ( | void | ) | [inline, virtual] |
virtual void ompl::Grid< _T >::add | ( | Cell * | cell | ) | [inline, virtual] |
Add an instantiated cell to the grid.
Reimplemented in ompl::GridB< _T, LessThanExternal, LessThanInternal >.
iterator ompl::Grid< _T >::begin | ( | void | ) | const [inline] |
virtual void ompl::Grid< _T >::clear | ( | void | ) | [inline, virtual] |
Clear all cells in the grid.
Reimplemented in ompl::GridB< _T, LessThanExternal, LessThanInternal >, and ompl::GridB< CellData *, OrderCellsByImportance >.
std::vector< std::vector<Cell*> > ompl::Grid< _T >::components | ( | void | ) | const [inline] |
virtual Cell* ompl::Grid< _T >::createCell | ( | const Coord & | coord, | |
CellArray * | nbh = NULL | |||
) | [inline, virtual] |
Instantiate a new cell at given coordinates; optionally Return the list of future neighbors. Note: this call only creates the cell, but does not add it to the grid. It however updates the neighbor count for neighboring cells
Reimplemented in ompl::GridB< _T, LessThanExternal, LessThanInternal >, and ompl::GridB< CellData *, OrderCellsByImportance >.
virtual void ompl::Grid< _T >::destroyCell | ( | Cell * | cell | ) | const [inline, virtual] |
bool ompl::Grid< _T >::empty | ( | void | ) | const [inline] |
iterator ompl::Grid< _T >::end | ( | void | ) | const [inline] |
void ompl::Grid< _T >::freeMemory | ( | void | ) | [inline, protected] |
Cell* ompl::Grid< _T >::getCell | ( | const Coord & | coord | ) | const [inline] |
Get the cell at a specified coordinate.
Reimplemented in ompl::GridN< _T >, and ompl::GridN< CellData * >.
void ompl::Grid< _T >::getCells | ( | CellArray & | cells | ) | const [inline] |
Get the set of instantiated cells in the grid.
Reimplemented in ompl::GridN< _T >, and ompl::GridN< CellData * >.
void ompl::Grid< _T >::getContent | ( | std::vector< _T > & | content | ) | const [inline] |
void ompl::Grid< _T >::getCoordinates | ( | std::vector< Coord * > & | coords | ) | const [inline] |
unsigned int ompl::Grid< _T >::getDimension | ( | void | ) | const [inline] |
bool ompl::Grid< _T >::has | ( | const Coord & | coord | ) | const [inline] |
void ompl::Grid< _T >::neighbors | ( | Coord & | coord, | |
CellArray & | list | |||
) | const [inline] |
Get the list of neighbors for a given coordinate.
Reimplemented in ompl::GridN< _T >, and ompl::GridN< CellData * >.
void ompl::Grid< _T >::neighbors | ( | const Coord & | coord, | |
CellArray & | list | |||
) | const [inline] |
Get the list of neighbors for a given coordinate.
Reimplemented in ompl::GridN< _T >, and ompl::GridN< CellData * >.
void ompl::Grid< _T >::neighbors | ( | const Cell * | cell, | |
CellArray & | list | |||
) | const [inline] |
Get the list of neighbors for a given cell.
Reimplemented in ompl::GridN< _T >, and ompl::GridN< CellData * >.
void ompl::Grid< _T >::printCoord | ( | Coord & | coord, | |
std::ostream & | out = std::cout | |||
) | const [inline] |
virtual bool ompl::Grid< _T >::remove | ( | Cell * | cell | ) | [inline, virtual] |
Remove a cell from the grid. If the cell has not been Added to the grid, only update the neighbor list
Reimplemented in ompl::GridB< _T, LessThanExternal, LessThanInternal >, and ompl::GridN< _T >.
void ompl::Grid< _T >::setDimension | ( | unsigned int | dimension | ) | [inline] |
Update the dimension of the grid; this should not be done unless the grid is empty
Reimplemented in ompl::GridN< _T >, and ompl::GridN< CellData * >.
unsigned int ompl::Grid< _T >::size | ( | void | ) | const [inline] |
virtual void ompl::Grid< _T >::status | ( | std::ostream & | out = std::cout |
) | const [inline, virtual] |
Print information about the data in this grid structure.
Reimplemented in ompl::GridB< _T, LessThanExternal, LessThanInternal >, and ompl::GridB< CellData *, OrderCellsByImportance >.
unsigned int ompl::Grid< _T >::dimension_ [protected] |
CoordHash ompl::Grid< _T >::hash_ [protected] |
unsigned int ompl::Grid< _T >::maxNeighbors_ [protected] |