ompl::Grid< _T > Class Template Reference

Representation of a simple grid. More...

#include <Grid.h>

Inheritance diagram for ompl::Grid< _T >:
Inheritance graph
[legend]

List of all members.

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 CellcreateCell (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.
CellgetCell (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).

Detailed Description

template<typename _T>
class ompl::Grid< _T >

Representation of a simple grid.

Definition at line 51 of file Grid.h.


Member Typedef Documentation

template<typename _T>
typedef std::vector<Cell*> ompl::Grid< _T >::CellArray
template<typename _T>
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 * >.

Definition at line 56 of file Grid.h.

template<typename _T>
typedef boost::unordered_map<Coord*, Cell*, HashFunCoordPtr, EqualCoordPtr> ompl::Grid< _T >::CoordHash [protected]

Define the datatype for the used hash structure.

Definition at line 357 of file Grid.h.

template<typename _T>
typedef CoordHash::const_iterator ompl::Grid< _T >::iterator

We only allow const iterators.

Definition at line 371 of file Grid.h.


Constructor & Destructor Documentation

template<typename _T>
ompl::Grid< _T >::Grid ( unsigned int  dimension  )  [inline, explicit]

The constructor takes the dimension of the grid as argument.

Definition at line 82 of file Grid.h.

template<typename _T>
virtual ompl::Grid< _T >::~Grid ( void   )  [inline, virtual]

Destructor.

Definition at line 88 of file Grid.h.


Member Function Documentation

template<typename _T>
virtual void ompl::Grid< _T >::add ( Cell cell  )  [inline, virtual]

Add an instantiated cell to the grid.

Reimplemented in ompl::GridB< _T, LessThanExternal, LessThanInternal >.

Definition at line 252 of file Grid.h.

template<typename _T>
iterator ompl::Grid< _T >::begin ( void   )  const [inline]

Return the begin() iterator for the grid.

Definition at line 374 of file Grid.h.

template<typename _T>
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 >.

Definition at line 94 of file Grid.h.

template<typename _T>
std::vector< std::vector<Cell*> > ompl::Grid< _T >::components ( void   )  const [inline]

Get the connected components formed by the cells in this grid (based on neighboring relation).

Definition at line 169 of file Grid.h.

template<typename _T>
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 >.

Definition at line 226 of file Grid.h.

template<typename _T>
virtual void ompl::Grid< _T >::destroyCell ( Cell cell  )  const [inline, virtual]

Clear the memory occupied by a cell; do not call this function unless remove() was called first.

Definition at line 258 of file Grid.h.

template<typename _T>
bool ompl::Grid< _T >::empty ( void   )  const [inline]

Check if the grid is empty.

Definition at line 294 of file Grid.h.

template<typename _T>
iterator ompl::Grid< _T >::end ( void   )  const [inline]

Return the end() iterator for the grid.

Definition at line 380 of file Grid.h.

template<typename _T>
void ompl::Grid< _T >::freeMemory ( void   )  [inline, protected]

Free the allocated memory.

Definition at line 319 of file Grid.h.

template<typename _T>
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 * >.

Definition at line 122 of file Grid.h.

template<typename _T>
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 * >.

Definition at line 278 of file Grid.h.

template<typename _T>
void ompl::Grid< _T >::getContent ( std::vector< _T > &  content  )  const [inline]

Get the data stored in the cells we are aware of.

Definition at line 264 of file Grid.h.

template<typename _T>
void ompl::Grid< _T >::getCoordinates ( std::vector< Coord * > &  coords  )  const [inline]

Get the set of coordinates where there are cells.

Definition at line 271 of file Grid.h.

template<typename _T>
unsigned int ompl::Grid< _T >::getDimension ( void   )  const [inline]

Return the dimension of the grid.

Definition at line 100 of file Grid.h.

template<typename _T>
bool ompl::Grid< _T >::has ( const Coord coord  )  const [inline]

Check if a cell exists at the specified coordinate.

Definition at line 116 of file Grid.h.

template<typename _T>
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 * >.

Definition at line 144 of file Grid.h.

template<typename _T>
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 * >.

Definition at line 137 of file Grid.h.

template<typename _T>
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 * >.

Definition at line 130 of file Grid.h.

template<typename _T>
void ompl::Grid< _T >::printCoord ( Coord coord,
std::ostream &  out = std::cout 
) const [inline]

Print the value of a coordinate to a stream.

Definition at line 285 of file Grid.h.

template<typename _T>
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 >.

Definition at line 237 of file Grid.h.

template<typename _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 * >.

Definition at line 107 of file Grid.h.

template<typename _T>
unsigned int ompl::Grid< _T >::size ( void   )  const [inline]

Check the size of the grid.

Definition at line 300 of file Grid.h.

template<typename _T>
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 >.

Definition at line 306 of file Grid.h.


Member Data Documentation

template<typename _T>
unsigned int ompl::Grid< _T >::dimension_ [protected]

The dimension of the grid.

Definition at line 388 of file Grid.h.

template<typename _T>
CoordHash ompl::Grid< _T >::hash_ [protected]

The hash holding the cells.

Definition at line 394 of file Grid.h.

template<typename _T>
unsigned int ompl::Grid< _T >::maxNeighbors_ [protected]

The maximum number of neighbors a cell can have (2 * dimension).

Definition at line 391 of file Grid.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


ompl
Author(s): Ioan Sucan/isucan@rice.edu, Mark Moll/mmoll@rice.edu, Lydia Kavraki/kavraki@rice.edu
autogenerated on Fri Jan 11 09:33:58 2013