34 #ifndef LVR2_ATTRMAPS_ATTRIBUTEMAP_H_ 35 #define LVR2_ATTRMAPS_ATTRIBUTEMAP_H_ 37 #include <boost/optional.hpp> 74 template<
typename HandleT,
typename ValueT>
79 "HandleT must inherit from BaseHandle!" 102 virtual boost::optional<ValueT>
insert(HandleT key,
const ValueT& value) = 0;
110 virtual boost::optional<ValueT>
erase(HandleT key) = 0;
115 virtual void clear() = 0;
124 virtual boost::optional<ValueT&>
get(HandleT key) = 0;
133 virtual boost::optional<const ValueT&>
get(HandleT key)
const = 0;
186 template<
typename HandleT>
191 "HandleT must inherit from BaseHandle!" 203 virtual std::unique_ptr<AttributeMapHandleIterator> clone()
const = 0;
214 template<
typename HandleT>
219 "HandleT must inherit from BaseHandle!" 224 : m_iter(
std::move(iter)) {}
226 : m_iter(iteratorPtr.m_iter->clone()) {}
236 std::unique_ptr<AttributeMapHandleIterator<HandleT>>
m_iter;
241 #include "lvr2/attrmaps/AttributeMap.tcc"
virtual void clear()=0
Removes all values from the map.
AttributeMapHandleIteratorPtr(const AttributeMapHandleIteratorPtr &iteratorPtr)
virtual AttributeMapHandleIteratorPtr< HandleT > begin() const =0
Returns an iterator over all keys of this map. The order of iteration is unspecified.
virtual size_t numValues() const =0
Returns the number of values in this map.
Simple convinience wrapper for unique_ptr<AttributeMapHandleIterator>
Iterator over keys of an attribute map.
AttributeMapHandleIteratorPtr(std::unique_ptr< AttributeMapHandleIterator< HandleT >> iter)
ValueT ValueType
The type of the value stored in this map.
std::unique_ptr< AttributeMapHandleIterator< HandleT > > m_iter
virtual boost::optional< ValueT > insert(HandleT key, const ValueT &value)=0
Inserts the given value at the given key position.
virtual boost::optional< ValueT > erase(HandleT key)=0
Removes the value associated with the given key.
Interface for attribute maps.
virtual AttributeMapHandleIteratorPtr< HandleT > end() const =0
Returns an iterator to the end of all keys.
ValueT & operator[](HandleT key)
Returns the value associated with the given key or panics if there is no associated value...
virtual bool containsKey(HandleT key) const =0
Returns true iff the map contains a value associated with the given key.
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...
HandleT HandleType
The type of the handle used as key in this map.