This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/grid/GridNode.h
kazu 5aedce47f1 removed gridSize from the template arguments
- not needed and code much cleaner
some minor changes
new test-cases
2016-01-25 15:53:12 +01:00

51 lines
1.1 KiB
C++
Executable File

#ifndef GRIDNODE_H
#define GRIDNODE_H
#include "GridNodeBBox.h"
#include "GridPoint.h"
/** forward decl. */
template<typename> class Grid;
/**
* INTERNAL DATASTRUCTURE
* this data-structure is internally used by the Grid
* to store additional information for each node besides
* the user's requested data-structure
*/
struct GridNode {
private:
/** grant full access to the grid */
template<typename> friend class Grid;
/** INTERNAL: array-index */
int _idx;
/** INTERNAL: number of neighbors */
int _numNeighbors;
/** INTERNAL: store neighbors (via index) */
int _neighbors[10];
public:
GridNode() : _idx(-1), _numNeighbors(0), _neighbors() {;}
/** get the node's index within its grid */
int getIdx() const {return _idx;}
/** get the number of neighbors for this node */
int getNumNeighbors() const {return _numNeighbors;}
// /** get the n-th neighbor for this node */
// template <int gridSize_cm, typename T> inline T& getNeighbor(const int nth, const Grid<gridSize_cm, T>& grid) const {
// return grid.getNeighbor(_idx, nth);
// }
};
#endif // GRIDNODE_H