A map of clusters, which also saves a back-reference from handle to cluster. More...
#include <ClusterBiMap.hpp>
Public Member Functions | |
ClusterHandle | addToCluster (ClusterHandle clusterHandle, HandleT handle) |
Adds the given handle to the cluster behind the given cluster handle. More... | |
ClusterBiMapIterator< HandleT > | begin () const |
ClusterBiMap () | |
ClusterHandle | createCluster () |
Creates a cluster and returns its handle. More... | |
ClusterBiMapIterator< HandleT > | end () const |
const Cluster< HandleT > & | getCluster (ClusterHandle clusterHandle) const |
Get cluster behind the cluster handle. More... | |
ClusterHandle | getClusterH (HandleT handle) const |
Returns a handle to the cluster to which the given handle is referenced. More... | |
OptionalClusterHandle | getClusterOf (HandleT handle) const |
Returns the handle of the cluster to which the given handle belongs to. More... | |
size_t | numCluster () const |
Returns the number of cluster in this set. More... | |
size_t | numHandles () const |
Returns the number of handles in all clusters in the set. More... | |
const Cluster< HandleT > & | operator[] (ClusterHandle clusterHandle) const |
Request the value behind the given key. More... | |
void | removeCluster (ClusterHandle clusterHandle) |
Removes the cluster behind the given handle. More... | |
ClusterHandle | removeFromCluster (ClusterHandle clusterHandle, HandleT handle) |
Removes the given handle from the cluster behind the given cluster handle. More... | |
void | reserve (size_t newCap) |
Private Member Functions | |
Cluster< HandleT > & | getC (ClusterHandle clusterHandle) |
Private helper to get cluster behind the cluster handle. More... | |
Private Attributes | |
StableVector< ClusterHandle, Cluster< HandleT > > | m_cluster |
Clusters. More... | |
DenseAttrMap< HandleT, ClusterHandle > | m_clusterMap |
Map from handle -> cluster to save the back-reference for stored handles. More... | |
size_t | m_numHandles |
Number of handels in all clusters. More... | |
A map of clusters, which also saves a back-reference from handle to cluster.
Type | of handles in the cluster map. |
Definition at line 72 of file ClusterBiMap.hpp.
|
inline |
Definition at line 75 of file ClusterBiMap.hpp.
ClusterHandle lvr2::ClusterBiMap< HandleT >::addToCluster | ( | ClusterHandle | clusterHandle, |
HandleT | handle | ||
) |
Adds the given handle to the cluster behind the given cluster handle.
This method creates a back-reference from cluster -> handle.
Important: If the given handle or cluster handle does not exist, the behavior of this method is undefined!
ClusterBiMapIterator<HandleT> lvr2::ClusterBiMap< HandleT >::begin | ( | ) | const |
ClusterHandle lvr2::ClusterBiMap< HandleT >::createCluster | ( | ) |
Creates a cluster and returns its handle.
ClusterBiMapIterator<HandleT> lvr2::ClusterBiMap< HandleT >::end | ( | ) | const |
|
private |
Private helper to get cluster behind the cluster handle.
const Cluster<HandleT>& lvr2::ClusterBiMap< HandleT >::getCluster | ( | ClusterHandle | clusterHandle | ) | const |
Get cluster behind the cluster handle.
ClusterHandle lvr2::ClusterBiMap< HandleT >::getClusterH | ( | HandleT | handle | ) | const |
Returns a handle to the cluster to which the given handle is referenced.
DEPRECATED: use getClusterOf()
instead.
Important: If the given cluster handle does not exist, the behavior of this method is undefined!
OptionalClusterHandle lvr2::ClusterBiMap< HandleT >::getClusterOf | ( | HandleT | handle | ) | const |
Returns the handle of the cluster to which the given handle
belongs to.
handle
is not associated with any cluster. size_t lvr2::ClusterBiMap< HandleT >::numCluster | ( | ) | const |
Returns the number of cluster in this set.
size_t lvr2::ClusterBiMap< HandleT >::numHandles | ( | ) | const |
Returns the number of handles in all clusters in the set.
const Cluster<HandleT>& lvr2::ClusterBiMap< HandleT >::operator[] | ( | ClusterHandle | clusterHandle | ) | const |
Request the value behind the given key.
void lvr2::ClusterBiMap< HandleT >::removeCluster | ( | ClusterHandle | clusterHandle | ) |
Removes the cluster behind the given handle.
This method does a clean up in the back-reference collection from handle to cluster such that all handle -> cluster connections to the removed cluster are also removed.
Important: If the given handle does not exist, the behavior of this method is undefined!
ClusterHandle lvr2::ClusterBiMap< HandleT >::removeFromCluster | ( | ClusterHandle | clusterHandle, |
HandleT | handle | ||
) |
Removes the given handle from the cluster behind the given cluster handle.
This method cleans up the back-reference from cluster -> handle.
Important: If the given handle or cluster handle does not exist, the behavior of this method is undefined!
void lvr2::ClusterBiMap< HandleT >::reserve | ( | size_t | newCap | ) |
|
private |
Clusters.
Definition at line 151 of file ClusterBiMap.hpp.
|
private |
Map from handle -> cluster to save the back-reference for stored handles.
Definition at line 154 of file ClusterBiMap.hpp.
|
private |
Number of handels in all clusters.
Definition at line 148 of file ClusterBiMap.hpp.