Public Member Functions | Private Member Functions | Private Attributes | List of all members
lvr2::ClusterBiMap< HandleT > Class Template Reference

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, ClusterHandlem_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...
 

Detailed Description

template<typename HandleT>
class lvr2::ClusterBiMap< HandleT >

A map of clusters, which also saves a back-reference from handle to cluster.

Template Parameters
Typeof handles in the cluster map.

Definition at line 72 of file ClusterBiMap.hpp.

Constructor & Destructor Documentation

◆ ClusterBiMap()

template<typename HandleT>
lvr2::ClusterBiMap< HandleT >::ClusterBiMap ( )
inline

Definition at line 75 of file ClusterBiMap.hpp.

Member Function Documentation

◆ addToCluster()

template<typename HandleT>
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!

◆ begin()

template<typename HandleT>
ClusterBiMapIterator<HandleT> lvr2::ClusterBiMap< HandleT >::begin ( ) const

◆ createCluster()

template<typename HandleT>
ClusterHandle lvr2::ClusterBiMap< HandleT >::createCluster ( )

Creates a cluster and returns its handle.

◆ end()

template<typename HandleT>
ClusterBiMapIterator<HandleT> lvr2::ClusterBiMap< HandleT >::end ( ) const

◆ getC()

template<typename HandleT>
Cluster<HandleT>& lvr2::ClusterBiMap< HandleT >::getC ( ClusterHandle  clusterHandle)
private

Private helper to get cluster behind the cluster handle.

◆ getCluster()

template<typename HandleT>
const Cluster<HandleT>& lvr2::ClusterBiMap< HandleT >::getCluster ( ClusterHandle  clusterHandle) const

Get cluster behind the cluster handle.

◆ getClusterH()

template<typename HandleT>
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!

◆ getClusterOf()

template<typename HandleT>
OptionalClusterHandle lvr2::ClusterBiMap< HandleT >::getClusterOf ( HandleT  handle) const

Returns the handle of the cluster to which the given handle belongs to.

Returns
The cluster handle or None if the given handle is not associated with any cluster.

◆ numCluster()

template<typename HandleT>
size_t lvr2::ClusterBiMap< HandleT >::numCluster ( ) const

Returns the number of cluster in this set.

◆ numHandles()

template<typename HandleT>
size_t lvr2::ClusterBiMap< HandleT >::numHandles ( ) const

Returns the number of handles in all clusters in the set.

◆ operator[]()

template<typename HandleT>
const Cluster<HandleT>& lvr2::ClusterBiMap< HandleT >::operator[] ( ClusterHandle  clusterHandle) const

Request the value behind the given key.

◆ removeCluster()

template<typename HandleT>
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!

◆ removeFromCluster()

template<typename HandleT>
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!

◆ reserve()

template<typename HandleT>
void lvr2::ClusterBiMap< HandleT >::reserve ( size_t  newCap)

Member Data Documentation

◆ m_cluster

template<typename HandleT>
StableVector<ClusterHandle, Cluster<HandleT> > lvr2::ClusterBiMap< HandleT >::m_cluster
private

Clusters.

Definition at line 151 of file ClusterBiMap.hpp.

◆ m_clusterMap

template<typename HandleT>
DenseAttrMap<HandleT, ClusterHandle> lvr2::ClusterBiMap< HandleT >::m_clusterMap
private

Map from handle -> cluster to save the back-reference for stored handles.

Definition at line 154 of file ClusterBiMap.hpp.

◆ m_numHandles

template<typename HandleT>
size_t lvr2::ClusterBiMap< HandleT >::m_numHandles
private

Number of handels in all clusters.

Definition at line 148 of file ClusterBiMap.hpp.


The documentation for this class was generated from the following file:


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:11