35 #ifndef LVR2_ATTRMAPS_VECTORMAP_H_ 36 #define LVR2_ATTRMAPS_VECTORMAP_H_ 39 #include <boost/optional.hpp> 59 template<
typename HandleT,
typename ValueT>
90 VectorMap(
size_t countElements,
const ValueT& defaultValue);
92 VectorMap(
size_t countElements,
const boost::shared_array<ValueT>&
values);
98 boost::optional<ValueT>
insert(HandleT key,
const ValueT& value)
final;
99 boost::optional<ValueT>
erase(HandleT key)
final;
101 boost::optional<ValueT&>
get(HandleT key)
final;
102 boost::optional<const ValueT&>
get(HandleT key)
const final;
120 template<
typename HandleT,
typename ValueT>
125 "HandleT must inherit from BaseHandle!" 135 std::unique_ptr<AttributeMapHandleIterator<HandleT>> clone()
const final;
143 #include "lvr2/attrmaps/VectorMap.tcc"
StableVectorIterator< HandleT, ValueT > m_iter
AttributeMapHandleIteratorPtr< HandleT > end() const final
Returns an iterator to the end of all keys.
StableVector< HandleT, ValueT > m_vec
The underlying storage.
Simple convinience wrapper for unique_ptr<AttributeMapHandleIterator>
Iterator over keys of an attribute map.
void reserve(size_t newCap)
void clear() final
Removes all values from the map.
boost::optional< ValueT > insert(HandleT key, const ValueT &value) final
Inserts the given value at the given key position.
VectorMap()
Creates an empty map without default element set.
Interface for attribute maps.
bool containsKey(HandleT key) const final
Returns true iff the map contains a value associated with the given key.
AttributeMapHandleIteratorPtr< HandleT > begin() const final
Returns an iterator over all keys of this map. The order of iteration is unspecified.
boost::optional< ValueT > m_default
boost::optional< ValueT > erase(HandleT key) final
Removes the value associated with the given key.
A map with constant lookup overhead using small-ish integer-keys.
BaseVector< CoordType > operator*(const Eigen::Matrix< Scalar, 4, 4 > &mat, const BaseVector< CoordType > &normal)
Multiplication operator to support transformation with Eigen matrices. Rotates the normal...
size_t numValues() const final
Returns the number of values in this map.