Go to the documentation of this file.
35 #ifndef LVR2_ATTRMAPS_STABLEVECTOR_H_
36 #define LVR2_ATTRMAPS_STABLEVECTOR_H_
40 #include <boost/optional.hpp>
41 #include <boost/shared_array.hpp>
60 template<
typename HandleT,
typename ElemT>
103 template<
typename HandleT,
typename ElemT>
108 "HandleT must inherit from BaseHandle!"
130 StableVector(
size_t countElements,
const boost::shared_array<ElementType>& sharedArray);
203 boost::optional<const ElementType&>
get(
HandleType handle)
const;
292 #include "lvr2/attrmaps/StableVector.tcc"
void set(HandleType handle, const ElementType &elem)
Set a value for the existing handle.
void increaseSize(HandleType upTo)
Increases the size of the vector to the length of upTo.
StableVectorIterator(const vector< boost::optional< ElemT >> *deleted, bool startAtEnd=false)
Iterator over handles in this vector, which skips deleted elements.
bool operator!=(const StableVectorIterator &other) const
Represents a group of handles, which are somehow connected.
StableVector()
Creates an empty StableVector.
StableVectorIterator< HandleType, ElementType > begin() const
Returns an iterator to the first element of this vector.
HandleType nextHandle() const
The handle which would be returned by calling push now.
HandleT operator*() const
const vector< boost::optional< ElemT > > * m_elements
Reference to the deleted marker array this iterator belongs to.
StableVectorIterator & operator++()
size_t size() const
Absolute size of the vector (including deleted elements).
A vector which guarantees stable indices and features O(1) deletion.
size_t m_usedCount
Count of used elements in elements vector.
size_t m_pos
Current position in the vector.
void checkAccess(HandleType handle) const
Assert that the requested handle is not deleted or throw an exception otherwise.
bool operator==(const StableVectorIterator &other) const
boost::optional< ElementType & > get(HandleType handle)
Returns the element referred to by handle.
HandleType push(const ElementType &elem)
Adds the given element to the vector.
void erase(HandleType handle)
Mark the element behind the given handle as deleted.
size_t numUsed() const
Number of non-deleted elements.
void clear()
Removes all elements from the vector.
StableVectorIterator< HandleType, ElementType > end() const
Returns an iterator to the element after the last element of this vector.
StableVectorIterator & operator=(const StableVectorIterator &other)
Handle to access Cluster of the ClusterBiMap.
ElementType & operator[](HandleType handle)
Returns the element referred to by handle.
vector< boost::optional< ElementType > > m_elements
Vector for stored elements.
void reserve(size_t newCap)
Increase the capacity of the vector to a value that's greater or equal to newCap.
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:25