OpenMS
2.6.0
|
Container for (2-dimensional coordinate, value) pairs. More...
#include <OpenMS/COMPARISON/CLUSTERING/HashGrid.h>
Classes | |
class | ConstIterator |
Constant element iterator for the hash grid. More... | |
class | Iterator |
Element iterator for the hash grid. More... | |
Public Types | |
typedef DPosition< 2, double > | ClusterCenter |
Coordinate for stored pairs. More... | |
typedef DPosition< 2, Int64 > | CellIndex |
Index for cells. More... | |
typedef boost::unordered_multimap< ClusterCenter, Cluster > | CellContent |
Contents of a cell. More... | |
typedef boost::unordered_map< CellIndex, CellContent > | Grid |
Map of (cell-index, cell-content). More... | |
typedef CellContent::key_type | key_type |
typedef CellContent::mapped_type | mapped_type |
typedef CellContent::value_type | value_type |
typedef ConstIterator | const_iterator |
typedef Iterator | iterator |
typedef Grid::const_iterator | const_grid_iterator |
typedef Grid::iterator | grid_iterator |
typedef CellContent::const_iterator | const_cell_iterator |
typedef CellContent::iterator | cell_iterator |
typedef CellContent::size_type | size_type |
Public Member Functions | |
HashGrid (const ClusterCenter &c_dimension) | |
cell_iterator | insert (const value_type &v) |
Inserts a (2-dimensional coordinate, value) pair. More... | |
void | erase (iterator pos) |
Erases element on given iterator. More... | |
size_type | erase (const key_type &key) |
Erases elements matching the 2-dimensional coordinate. More... | |
void | clear () |
Clears the map. More... | |
iterator | begin () |
Returns iterator to first element. More... | |
const_iterator | begin () const |
Returns iterator to first element. More... | |
iterator | end () |
Returns iterator to first element. More... | |
const_iterator | end () const |
Returns iterator to first element. More... | |
bool | empty () const |
Return true if HashGrid is empty. More... | |
size_type | size () const |
Return number of elements. More... | |
const_grid_iterator | grid_begin () const |
Returns iterator to first grid cell. More... | |
const_grid_iterator | grid_end () const |
Returns iterator to on after last grid cell. More... | |
const Grid::mapped_type & | grid_at (const CellIndex &x) const |
Returns the grid cell at given index. More... | |
Grid::mapped_type & | grid_at (const CellIndex &x) |
const_grid_iterator | grid_find (const CellIndex &x) const |
Returns the grid cell at given index if present, otherwise the grid_end iterator. More... | |
grid_iterator | grid_find (const CellIndex &x) |
Returns the grid cell at given index if present, otherwise the grid_end iterator. More... | |
grid_iterator | grid_begin () |
grid_iterator | grid_end () |
Public Attributes | |
const ClusterCenter | cell_dimension |
Dimension of cells. More... | |
const CellIndex & | grid_dimension |
Upper-right corner of key space for cells. More... | |
Private Member Functions | |
CellIndex | cellindexAtClustercenter_ (const ClusterCenter &key) |
void | updateGridDimension_ (const CellIndex &d) |
Private Attributes | |
Grid | cells_ |
CellIndex | grid_dimension_ |
Container for (2-dimensional coordinate, value) pairs.
A hash-grid consists of hash-grid cells. The key of each cell is a pair of integers. Each pair is assigned to a cell using a hash function.
This container implements most parts of the C++ standard map interface.
Cluster | Type to be stored in the hash grid. (e.g. HierarchicalClustering::Cluster) |
typedef CellContent::iterator cell_iterator |
typedef boost::unordered_multimap<ClusterCenter, Cluster> CellContent |
Contents of a cell.
typedef DPosition<2, double> ClusterCenter |
Coordinate for stored pairs.
typedef CellContent::const_iterator const_cell_iterator |
typedef Grid::const_iterator const_grid_iterator |
typedef ConstIterator const_iterator |
typedef boost::unordered_map<CellIndex, CellContent> Grid |
Map of (cell-index, cell-content).
typedef Grid::iterator grid_iterator |
typedef CellContent::key_type key_type |
typedef CellContent::mapped_type mapped_type |
typedef CellContent::size_type size_type |
typedef CellContent::value_type value_type |
|
inlineexplicit |
|
inline |
Returns iterator to first element.
References HashGrid< Cluster >::cells_, and HashGrid< Cluster >::end().
|
inline |
Returns iterator to first element.
References HashGrid< Cluster >::cells_, and HashGrid< Cluster >::end().
|
inlineprivate |
|
inline |
Clears the map.
References HashGrid< Cluster >::cells_.
|
inline |
Return true if HashGrid is empty.
References HashGrid< Cluster >::size().
|
inline |
Returns iterator to first element.
References HashGrid< Cluster >::cells_.
Referenced by HashGrid< Cluster >::begin().
|
inline |
Returns iterator to first element.
References HashGrid< Cluster >::cells_.
Erases elements matching the 2-dimensional coordinate.
key | Key of element to be erased. |
References HashGrid< Cluster >::cellindexAtClustercenter_(), and HashGrid< Cluster >::cells_.
|
inline |
Erases element on given iterator.
References HashGrid< Cluster >::Iterator::cell_it_, and HashGrid< Cluster >::Iterator::grid_it_.
|
inline |
References HashGrid< Cluster >::cells_.
|
inline |
Returns the grid cell at given index.
References HashGrid< Cluster >::cells_.
|
inline |
References HashGrid< Cluster >::cells_.
|
inline |
Returns iterator to first grid cell.
References HashGrid< Cluster >::cells_.
Referenced by HashGrid< Cluster >::size().
|
inline |
References HashGrid< Cluster >::cells_.
|
inline |
Returns iterator to on after last grid cell.
References HashGrid< Cluster >::cells_.
Referenced by HashGrid< Cluster >::size().
|
inline |
Returns the grid cell at given index if present, otherwise the grid_end iterator.
References HashGrid< Cluster >::cells_.
|
inline |
Returns the grid cell at given index if present, otherwise the grid_end iterator.
References HashGrid< Cluster >::cells_.
|
inline |
Inserts a (2-dimensional coordinate, value) pair.
v | Pair to be inserted. |
References HashGrid< Cluster >::cellindexAtClustercenter_(), HashGrid< Cluster >::cells_, and HashGrid< Cluster >::updateGridDimension_().
|
inline |
Return number of elements.
References HashGrid< Cluster >::grid_begin(), and HashGrid< Cluster >::grid_end().
Referenced by HashGrid< Cluster >::empty().
|
inlineprivate |
const ClusterCenter cell_dimension |
Dimension of cells.
Referenced by HashGrid< Cluster >::cellindexAtClustercenter_().
|
private |
Referenced by HashGrid< Cluster >::begin(), HashGrid< Cluster >::clear(), HashGrid< Cluster >::end(), HashGrid< Cluster >::erase(), HashGrid< Cluster >::grid_at(), HashGrid< Cluster >::grid_begin(), HashGrid< Cluster >::grid_end(), HashGrid< Cluster >::grid_find(), and HashGrid< Cluster >::insert().
const CellIndex& grid_dimension |
Upper-right corner of key space for cells.
|
private |
Referenced by HashGrid< Cluster >::updateGridDimension_().