Template Class VariantChannelMap

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

  • public std::unordered_map< std::string, VariantChannel< T... > >

Derived Type

Class Documentation

template<typename ...T>
class VariantChannelMap : public std::unordered_map<std::string, VariantChannel<T...>>

Subclassed by lvr2::BaseBuffer

Public Types

using key_type = std::string
using val_type = VariantChannel<T...>
using elem_type = std::pair<const key_type, val_type>
using types = std::tuple<T...>
using base = std::unordered_map<std::string, VariantChannel<T...>>
template<std::size_t N>
using type_of_index = typename val_type::template type_of_index<N>

Public Functions

template<typename U>
void add(const std::string &name, Channel<U> channel)

Adds an Key + AttributeChannel to the map.

Parameters:
  • name[in] Key of the channel.

  • channel[in] The channel.

template<typename U>
void add(const std::string &name)

Adds an empty channel.

Parameters:

name[in] Key of the channel.

template<typename U>
void add(const std::string &name, size_t numElements, size_t width)

Adds an empty channel with size.

Parameters:
  • name[in] Key of the channel.

  • numElements[in] Number of elements in channel.

  • width[in] Element size.

template<typename U>
Channel<U> &get(const std::string &name)

Gets AttributeChannel with type U from map as reference.

Parameters:

name[in] Key of the channel.

template<typename U>
const Channel<U> &get(const std::string &name) const

Gets AttributeChannel by type U from map.

Parameters:

name[in] Key of the channel.

template<typename U>
Channel<U>::Optional getOptional(const std::string &name)
template<typename U>
const Channel<U>::Optional getOptional(const std::string &name) const
int type(const std::string &name) const

Gets type index of a map entry.

Parameters:

Key[in] of the channel.

Returns:

Index of type tuple of the variant.

template<typename U>
bool is_type(const std::string &name) const

Checks if key has specific type U.

Example Usage: cm.is_type<float>(“points”) -> true

Parameters:

name[in] Key of the channel.

Template Parameters:

U – Type of the value to check.

Returns:

true If the type is equal.

Returns:

false If the type is unequal.

template<typename U>
std::vector<std::string> keys()

Gets the available keys by a specific type.

Template Parameters:

U – Type of the channels.

Returns:

Vector of keys.

template<typename U>
size_t numChannels()

Counts the number of channels by a specific type. @detail For total number of channels use “size()”.

Template Parameters:

U – Type of the channels.

Returns:

Number of channels.

template<typename U>
inline iterator<U> typedBegin()
template<typename U>
inline const_iterator<U> typedBegin() const
template<typename U>
inline iterator<U> erase(iterator<U> it)
template<typename V>
inline VariantChannelMap<T...> manipulate(V visitor)
VariantChannelMap<T...> clone() const

Public Static Attributes

static constexpr std::size_t num_types = val_type::num_types

Friends

inline friend std::ostream &operator<<(std::ostream &os, const VariantChannelMap<T...> &cm)

Output cout.

template<typename U>
struct const_iterator

Public Types

using resolved_elem_type = std::pair<const key_type&, const Channel<U>&>
using pointer = std::shared_ptr<resolved_elem_type>
using reference = elem_type&

Public Functions

inline const_iterator(typename base::const_iterator base_it, typename base::const_iterator end_it)
inline resolved_elem_type operator*() const noexcept
inline pointer operator->() const noexcept
inline const_iterator<U> &operator++() noexcept
inline const_iterator<U> operator++(int) noexcept
inline bool operator==(const typename base::const_iterator &rhs) noexcept
inline bool operator!=(const typename base::const_iterator &rhs) noexcept
inline base::iterator operator()() const noexcept

Public Members

base::const_iterator m_base_it
base::const_iterator m_end_it
template<class U>
struct index_of_type

Access type index by type.

Example usage: ChanneVariantMap<int, float> my_map; ChanneVariantMap<int, float>::type_index<int>::value -> 0

Public Static Attributes

static constexpr std::size_t value = val_type::template index_of_type<U>::value
template<typename U>
struct iterator

Public Types

using resolved_elem_type = std::pair<const key_type&, Channel<U>&>
using pointer = std::shared_ptr<resolved_elem_type>
using reference = elem_type&

Public Functions

inline iterator(typename base::iterator base_it, typename base::iterator end_it)
inline resolved_elem_type operator*() const noexcept
inline pointer operator->() const noexcept
inline iterator<U> &operator++() noexcept
inline iterator<U> operator++(int) noexcept
inline bool operator==(const typename base::iterator &rhs) noexcept
inline bool operator!=(const typename base::iterator &rhs) noexcept
inline base::iterator operator()() const noexcept

Public Members

base::iterator m_base_it
base::iterator m_end_it