Template Class ClusterBiMap

Class Documentation

template<typename HandleT>
class ClusterBiMap

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

Template Parameters:

Type – of handles in the cluster map.

Public Functions

inline ClusterBiMap()
ClusterHandle createCluster()

Creates a cluster and returns its handle.

void 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 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!

ClusterHandle 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!

ClusterHandle 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 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.

size_t numCluster() const

Returns the number of cluster in this set.

ClusterBiMapIterator<HandleT> begin() const
ClusterBiMapIterator<HandleT> end() const
const Cluster<HandleT> &getCluster(ClusterHandle clusterHandle) const

Get cluster behind the cluster handle.

const Cluster<HandleT> &operator[](ClusterHandle clusterHandle) const

Request the value behind the given key.

void reserve(size_t newCap)

size_t numHandles() const

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