ClusterBiMap.hpp
Go to the documentation of this file.
1 
28 /*
29  * ClusterBiMap.hpp
30  *
31  * @date 17.06.2017
32  * @author Johan M. von Behren <johan@vonbehren.eu>
33  */
34 
35 #ifndef LVR2_UTIL_CLUSTERBIMAP_H_
36 #define LVR2_UTIL_CLUSTERBIMAP_H_
37 
39 #include "lvr2/util/Cluster.hpp"
40 
43 
44 namespace lvr2
45 {
46 
53  template<typename HandleT>
55 {
56 public:
59  bool operator==(const ClusterBiMapIterator& other) const;
60  bool operator!=(const ClusterBiMapIterator& other) const;
61  ClusterHandle operator*() const;
62 
63 private:
65 };
66 
71 template<typename HandleT>
73 {
74 public:
76 
79 
88  void removeCluster(ClusterHandle clusterHandle);
89 
97  ClusterHandle addToCluster(ClusterHandle clusterHandle, HandleT handle);
98 
106  ClusterHandle removeFromCluster(ClusterHandle clusterHandle, HandleT handle);
107 
115  ClusterHandle getClusterH(HandleT handle) const;
116 
124  OptionalClusterHandle getClusterOf(HandleT handle) const;
125 
127  size_t numCluster() const;
128 
131 
133  const Cluster<HandleT>& getCluster(ClusterHandle clusterHandle) const;
134 
136  const Cluster<HandleT>& operator[](ClusterHandle clusterHandle) const;
137 
141  void reserve(size_t newCap);
142 
144  size_t numHandles() const;
145 
146 private:
148  size_t m_numHandles;
149 
152 
155 
157  Cluster<HandleT>& getC(ClusterHandle clusterHandle);
158 };
159 
160 } // namespace lvr2
161 
162 #include "lvr2/util/ClusterBiMap.tcc"
163 
164 #endif /* LVR2_UTIL_CLUSTERBIMAP_H_ */
Handles.hpp
lvr2::ClusterBiMap::getCluster
const Cluster< HandleT > & getCluster(ClusterHandle clusterHandle) const
Get cluster behind the cluster handle.
lvr2::StableVectorIterator
Iterator over handles in this vector, which skips deleted elements.
Definition: StableVector.hpp:61
lvr2::ClusterBiMap::end
ClusterBiMapIterator< HandleT > end() const
lvr2::ClusterBiMap::numHandles
size_t numHandles() const
Returns the number of handles in all clusters in the set.
AttrMaps.hpp
Cluster.hpp
lvr2::ClusterBiMap::removeCluster
void removeCluster(ClusterHandle clusterHandle)
Removes the cluster behind the given handle.
lvr2::ClusterBiMap::m_clusterMap
DenseAttrMap< HandleT, ClusterHandle > m_clusterMap
Map from handle -> cluster to save the back-reference for stored handles.
Definition: ClusterBiMap.hpp:154
lvr2::ClusterBiMap::reserve
void reserve(size_t newCap)
lvr2::Cluster
Represents a group of handles, which are somehow connected.
Definition: Cluster.hpp:50
lvr2::ClusterBiMapIterator::operator!=
bool operator!=(const ClusterBiMapIterator &other) const
lvr2::VectorMap
A map with constant lookup overhead using small-ish integer-keys.
Definition: VectorMap.hpp:60
lvr2::ClusterBiMapIterator
Iterator over cluster handles in this cluster map.
Definition: ClusterBiMap.hpp:54
lvr2::OptionalClusterHandle
Semantically equivalent to boost::optional<ClusterHandle>
Definition: Handles.hpp:182
lvr2::StableVector
A vector which guarantees stable indices and features O(1) deletion.
Definition: StableVector.hpp:104
StableVector.hpp
lvr2::ClusterBiMap::begin
ClusterBiMapIterator< HandleT > begin() const
lvr2::ClusterBiMapIterator::operator==
bool operator==(const ClusterBiMapIterator &other) const
lvr2::ClusterBiMap::createCluster
ClusterHandle createCluster()
Creates a cluster and returns its handle.
lvr2::ClusterBiMap::ClusterBiMap
ClusterBiMap()
Definition: ClusterBiMap.hpp:75
lvr2::ClusterBiMap::numCluster
size_t numCluster() const
Returns the number of cluster in this set.
lvr2::ClusterBiMap::getClusterH
ClusterHandle getClusterH(HandleT handle) const
Returns a handle to the cluster to which the given handle is referenced.
lvr2::ClusterHandle
Handle to access Cluster of the ClusterBiMap.
Definition: Handles.hpp:152
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::ClusterBiMapIterator::ClusterBiMapIterator
ClusterBiMapIterator(StableVectorIterator< ClusterHandle, Cluster< HandleT >> iterator)
Definition: ClusterBiMap.hpp:57
lvr2::ClusterBiMapIterator::operator*
ClusterHandle operator*() const
lvr2::ClusterBiMap::m_numHandles
size_t m_numHandles
Number of handels in all clusters.
Definition: ClusterBiMap.hpp:148
lvr2::ClusterBiMap::m_cluster
StableVector< ClusterHandle, Cluster< HandleT > > m_cluster
Clusters.
Definition: ClusterBiMap.hpp:151
lvr2::ClusterBiMap::removeFromCluster
ClusterHandle removeFromCluster(ClusterHandle clusterHandle, HandleT handle)
Removes the given handle from the cluster behind the given cluster handle.
lvr2::ClusterBiMap::operator[]
const Cluster< HandleT > & operator[](ClusterHandle clusterHandle) const
Request the value behind the given key.
lvr2::ClusterBiMap::getC
Cluster< HandleT > & getC(ClusterHandle clusterHandle)
Private helper to get cluster behind the cluster handle.
lvr2::ClusterBiMap
A map of clusters, which also saves a back-reference from handle to cluster.
Definition: ClusterBiMap.hpp:72
lvr2::ClusterBiMapIterator::operator++
ClusterBiMapIterator & operator++()
lvr2::ClusterBiMap::getClusterOf
OptionalClusterHandle getClusterOf(HandleT handle) const
Returns the handle of the cluster to which the given handle belongs to.
lvr2::ClusterBiMap::addToCluster
ClusterHandle addToCluster(ClusterHandle clusterHandle, HandleT handle)
Adds the given handle to the cluster behind the given cluster handle.
lvr2::ClusterBiMapIterator::m_iterator
StableVectorIterator< ClusterHandle, Cluster< HandleT > > m_iterator
Definition: ClusterBiMap.hpp:64


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 Wed Mar 2 2022 00:37:23