ChannelManager class Store and access AttributeChannels. It expands the MultiChannelMap with downwoards compitibility functions of the old ChannelManager. More...
#include <BaseBuffer.hpp>
Public Types | |
using | base = std::unordered_map< std::string, VariantChannel< T... > > |
Public Types inherited from lvr2::VariantChannelMap< T > | |
using | base = std::unordered_map< std::string, VariantChannel< T... > > |
using | elem_type = std::pair< const key_type, val_type > |
using | key_type = std::string |
template<std::size_t N> | |
using | type_of_index = typename val_type::template type_of_index< N > |
using | types = std::tuple< T... > |
using | val_type = VariantChannel< T... > |
Public Member Functions | |
template<typename T > | |
void | addAtomic (T data, const std::string &name) |
Adds an atomic value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. More... | |
template<typename T > | |
void | addChannel (boost::shared_array< T > array, std::string name, size_t n, size_t width) |
Constructs a channel from an boost::shared_array and saves it to the map. More... | |
template<typename T > | |
void | addChannel (typename Channel< T >::Ptr data, const std::string &name) |
Adds a channel pointer to the map. More... | |
template<typename T > | |
void | addEmptyChannel (const std::string &name, size_t n, size_t width) |
Adds an empty channel to the map. More... | |
void | addEmptyFloatChannel (const std::string &name, size_t n, size_t width) |
Adds an empty float channel to the map. More... | |
void | addEmptyIndexChannel (const std::string &name, size_t n, size_t width) |
Adds an empty index channel to the map. More... | |
void | addEmptyUCharChannel (const std::string &name, size_t n, size_t width) |
Adds an empty uchar channel to the map. More... | |
void | addFloatAtomic (float data, const std::string &name) |
Adds an atomic float value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. More... | |
void | addFloatChannel (floatArr array, std::string name, size_t n, size_t width) |
Constructs a float channel from an boost::shared_array and saves it to the map. More... | |
void | addFloatChannel (FloatChannelPtr data, const std::string &name) |
Adds a float channel pointer to the map. More... | |
void | addIndexChannel (indexArray array, std::string name, size_t n, size_t width) |
Constructs an index channel from an boost::shared_array and saves it to the map. More... | |
void | addIndexChannel (IndexChannelPtr data, const std::string &name) |
Adds an index channel pointer to the map. cointer to add. cannel. More... | |
void | addIntAtomic (int data, const std::string &name) |
Adds an atomic int value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. Kept because of api stability. More... | |
void | addUCharAtomic (unsigned char data, const std::string &name) |
Adds an atomic uchar value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. Kept because of api stability. More... | |
void | addUCharChannel (ucharArr array, std::string name, size_t n, size_t width) |
Constructs an uchar channel from an boost::shared_array and saves it to the map. More... | |
void | addUCharChannel (UCharChannelPtr data, const std::string &name) |
Adds an uchar channel pointer to the map. More... | |
template<typename T > | |
size_t | channelWidth (const std::string &name) const |
Gets a channels width. More... | |
BaseBuffer | clone () const |
size_t | floatChannelWidth (const std::string &name) const |
Gets a float channels width. More... | |
template<typename T > | |
int | getAllChannelsOfType (std::map< std::string, Channel< T > > &channels) |
Returns all channels of type T. More... | |
template<typename T > | |
int | getAllChannelsOfType (std::vector< std::pair< std::string, Channel< T > >> &channels) |
Returns all channels of type T. More... | |
template<typename T > | |
boost::shared_array< T > | getArray (const std::string &name, size_t &n, size_t &w) |
Gets a channel as array. More... | |
template<typename T > | |
boost::optional< T > | getAtomic (const std::string &name) |
Gets an atomic value. More... | |
template<typename T > | |
Channel< T >::Optional | getChannel (const std::string &name) |
Gets a channel and returns it as optional. More... | |
template<typename T > | |
const Channel< T >::Optional | getChannel (const std::string &name) const |
Gets a channel and returns it as optional. More... | |
void | getChannel (const std::string &name, FloatChannelOptional &channelOptional) |
Gets a float channel and returns it as optional. More... | |
void | getChannel (const std::string &name, IndexChannelOptional &channelOptional) |
Gets an index channel and returns it as optional. More... | |
void | getChannel (const std::string &name, UCharChannelOptional &channelOptional) |
Gets an uchar channel and returns it as optional. More... | |
floatArr | getFloatArray (const std::string &name, size_t &n, size_t &w) |
Gets a float channel as array. More... | |
floatOptional | getFloatAtomic (const std::string &name) |
Gets an atomic float value. More... | |
Channel< float >::Optional | getFloatChannel (const std::string &name) |
Gets a float channel and returns it as optional. More... | |
FloatProxy | getFloatHandle (unsigned int idx, const std::string &name) |
Get a Handle object (ElementProxy) of a float channel. More... | |
template<typename T > | |
ElementProxy< T > | getHandle (unsigned int idx, const std::string &name) |
Get a Handle object (ElementProxy) of a specific typed channel. More... | |
indexArray | getIndexArray (const std::string &name, size_t &n, size_t &w) |
Gets an index channel as array. More... | |
Channel< unsigned int >::Optional | getIndexChannel (const std::string &name) |
Gets an index channel and returns it as optional. More... | |
IndexProxy | getIndexHandle (unsigned int idx, const std::string &name) |
Get a Handle object (ElementProxy) of an index channel. More... | |
intOptional | getIntAtomic (const std::string &name) |
Gets an atomic int value. More... | |
ucharArr | getUCharArray (const std::string &name, size_t &n, size_t &w) |
Gets an uchar channel as array. More... | |
ucharOptional | getUCharAtomic (const std::string &name) |
Gets an atomic uchar value. More... | |
Channel< unsigned char >::Optional | getUCharChannel (const std::string &name) |
Gets an uchar channel and returns it as optional. More... | |
UCharProxy | getUCharHandle (unsigned int idx, const std::string &name) |
Get a Handle object (ElementProxy) of an uchar channel. More... | |
template<typename T > | |
bool | hasChannel (const std::string &name) const |
Checks if a channel is available. More... | |
bool | hasFloatChannel (const std::string &name) const |
Checks if a float channel is available. More... | |
bool | hasIndexChannel (const std::string &name) const |
Checks if an index channel is available. More... | |
bool | hasUCharChannel (const std::string &name) const |
Checks if an uchar channel is available. More... | |
size_t | indexChannelWidth (const std::string &name) const |
Gets an index channels width. More... | |
template<typename V > | |
BaseBuffer | manipulate (V visitor) |
template<typename T > | |
bool | removeChannel (const std::string &name) |
Removes a channel with a specific type. @detail If the type is not required use: erase. More... | |
bool | removeFloatChannel (const std::string &name) |
Removes a float channel. @detail If the type is not required use: erase. More... | |
bool | removeIndexChannel (const std::string &name) |
Removes an index channel. @detail If the type is not required use: erase. More... | |
bool | removeUCharChannel (const std::string &name) |
Removes an uchar channel. @detail If the type is not required use: erase. More... | |
size_t | ucharChannelWidth (const std::string &name) const |
Gets an uchar channels width. More... | |
Public Member Functions inherited from lvr2::VariantChannelMap< T > | |
template<typename U > | |
void | add (const std::string &name) |
Adds an empty channel. More... | |
template<typename U > | |
void | add (const std::string &name, Channel< U > channel) |
Adds an Key + AttributeChannel to the map. More... | |
template<typename U > | |
void | add (const std::string &name, size_t numElements, size_t width) |
Adds an empty channel with size. More... | |
VariantChannelMap< T... > | clone () const |
template<typename U > | |
iterator< U > | erase (iterator< U > it) |
template<typename U > | |
Channel< U > & | get (const std::string &name) |
Gets AttributeChannel with type U from map as reference. More... | |
template<typename U > | |
const Channel< U > & | get (const std::string &name) const |
Gets AttributeChannel by type U from map. More... | |
template<typename U > | |
Channel< U >::Optional | getOptional (const std::string &name) |
template<typename U > | |
const Channel< U >::Optional | getOptional (const std::string &name) const |
template<typename U > | |
bool | is_type (const std::string &name) const |
Checks if key has specific type U. More... | |
template<typename U > | |
std::vector< std::string > | keys () |
Gets the available keys by a specific type. More... | |
template<typename V > | |
VariantChannelMap< T... > | manipulate (V visitor) |
template<typename U > | |
size_t | numChannels () |
Counts the number of channels by a specific type. @detail For total number of channels use "size()". More... | |
int | type (const std::string &name) const |
Gets type index of a map entry. More... | |
template<typename U > | |
iterator< U > | typedBegin () |
template<typename U > | |
const_iterator< U > | typedBegin () const |
Private Types | |
using | base = MultiChannelMap |
Additional Inherited Members | |
Static Public Attributes inherited from lvr2::VariantChannelMap< T > | |
static constexpr std::size_t | num_types = val_type::num_types |
ChannelManager class Store and access AttributeChannels. It expands the MultiChannelMap with downwoards compitibility functions of the old ChannelManager.
Definition at line 54 of file BaseBuffer.hpp.
|
private |
Definition at line 55 of file BaseBuffer.hpp.
using lvr2::VariantChannelMap< T >::base = std::unordered_map<std::string, VariantChannel<T...> > |
Definition at line 52 of file VariantChannelMap.hpp.
void lvr2::BaseBuffer::addAtomic | ( | T | data, |
const std::string & | name | ||
) |
Adds an atomic value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead.
T | Type of the atomic value. |
[in] | data | The atomic data to add to the channel manager. |
[in] | name | The key of the atomic value (don't use keys that are already used for channels). |
void lvr2::BaseBuffer::addChannel | ( | boost::shared_array< T > | array, |
std::string | name, | ||
size_t | n, | ||
size_t | width | ||
) |
Constructs a channel from an boost::shared_array and saves it to the map.
[in] | array | The shared array of the data. |
[in] | name | Key of the channel. |
T | Type of the channel. |
void lvr2::BaseBuffer::addChannel | ( | typename Channel< T >::Ptr | data, |
const std::string & | name | ||
) |
Adds a channel pointer to the map.
[in] | data | The channel pointer to add. |
[in] | name | The key of the channel. |
T | Type of the channel. |
void lvr2::BaseBuffer::addEmptyChannel | ( | const std::string & | name, |
size_t | n, | ||
size_t | width | ||
) |
Adds an empty channel to the map.
[in] | name | Key of the channel. |
[in] | n | Number of elements. |
[in] | width | Width of one element. |
T | Type of the channel. |
|
inline |
Adds an empty float channel to the map.
[in] | name | Key of the channel. |
[in] | n | Number of elements. |
[in] | width | Width of one element. |
Definition at line 242 of file BaseBuffer.hpp.
|
inline |
Adds an empty index channel to the map.
[in] | name | Key of the channel. |
[in] | n | Number of elements. |
[in] | width | Width of one element. |
Definition at line 264 of file BaseBuffer.hpp.
|
inline |
Adds an empty uchar channel to the map.
[in] | name | Key of the channel. |
[in] | n | Number of elements. |
[in] | width | Width of one element. |
Definition at line 253 of file BaseBuffer.hpp.
|
inline |
Adds an atomic float value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead.
[in] | data | The atomic data to add to the channel manager. |
[in] | name | The key of the atomic value (don't use keys that are already used for channels). |
Definition at line 582 of file BaseBuffer.hpp.
|
inline |
Constructs a float channel from an boost::shared_array and saves it to the map.
[in] | array | The shared array of the data. |
[in] | name | Key of the channel. |
Definition at line 208 of file BaseBuffer.hpp.
|
inline |
Adds a float channel pointer to the map.
[in] | data | The channel pointer to add. |
[in] | name | Key of the channel. |
Definition at line 159 of file BaseBuffer.hpp.
|
inline |
Constructs an index channel from an boost::shared_array and saves it to the map.
[in] | array | The shared array of the data. |
[in] | name | Key of the channel. |
Definition at line 198 of file BaseBuffer.hpp.
|
inline |
Adds an index channel pointer to the map. cointer to add. cannel.
Definition at line 179 of file BaseBuffer.hpp.
|
inline |
Adds an atomic int value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. Kept because of api stability.
[in] | data | The atomic data to add to the channel manager. |
[in] | name | The key of the atomic value (don't use keys that are already used for channels). |
Definition at line 608 of file BaseBuffer.hpp.
|
inline |
Adds an atomic uchar value. Exists only for compatibility reasons. Dont use atomics, they are implemented as Channels. -> memory overhead. Kept because of api stability.
[in] | data | The atomic data to add to the channel manager. |
[in] | name | The key of the atomic value (don't use keys that are already used for channels). |
Definition at line 595 of file BaseBuffer.hpp.
|
inline |
Constructs an uchar channel from an boost::shared_array and saves it to the map.
[in] | array | The shared array of the data. |
[in] | name | Key of the channel. |
Definition at line 220 of file BaseBuffer.hpp.
|
inline |
Adds an uchar channel pointer to the map.
[in] | data | The channel pointer to add. |
[in] | name | Key of the channel. |
Definition at line 169 of file BaseBuffer.hpp.
size_t lvr2::BaseBuffer::channelWidth | ( | const std::string & | name | ) | const |
Gets a channels width.
[in] | name | Key of the channel. |
T | type of channel to search for. |
|
inline |
Definition at line 678 of file BaseBuffer.hpp.
|
inline |
Gets a float channels width.
[in] | name | Key of the channel. |
Definition at line 87 of file BaseBuffer.hpp.
|
inline |
Returns all channels of type T.
T | The type of the channels. |
channels | The vector of channel pairs(name, Channel). |
Definition at line 338 of file BaseBuffer.hpp.
|
inline |
Returns all channels of type T.
T | The type of the channels. |
channels | The vector of channel pairs(name, Channel). |
Definition at line 356 of file BaseBuffer.hpp.
boost::shared_array<T> lvr2::BaseBuffer::getArray | ( | const std::string & | name, |
size_t & | n, | ||
size_t & | w | ||
) |
Gets a channel as array.
T | Type of the channel. |
[out] | n | Number of elements stored in the channel. |
[out] | w | Width of an element. |
[in] | name | Key of the channel. |
boost::optional<T> lvr2::BaseBuffer::getAtomic | ( | const std::string & | name | ) |
Gets an atomic value.
T | The atomic values type. |
[in] | name | Key of the atomic value. |
Channel<T>::Optional lvr2::BaseBuffer::getChannel | ( | const std::string & | name | ) |
Gets a channel and returns it as optional.
[in] | name | Key of the channel. |
T | Type of the channel. |
const Channel<T>::Optional lvr2::BaseBuffer::getChannel | ( | const std::string & | name | ) | const |
Gets a channel and returns it as optional.
[in] | name | Key of the channel. |
T | Type of the channel. |
|
inline |
Gets a float channel and returns it as optional.
[in] | name | Key of the channel. |
[out] | channelOptional | The float channel optional. |
Definition at line 426 of file BaseBuffer.hpp.
|
inline |
Gets an index channel and returns it as optional.
[in] | name | Key of the channel. |
[out] | channelOptional | The index channel optional. |
Definition at line 437 of file BaseBuffer.hpp.
|
inline |
Gets an uchar channel and returns it as optional.
[in] | name | Key of the channel. |
[out] | channelOptional | The uchar channel optional. |
Definition at line 448 of file BaseBuffer.hpp.
|
inline |
Gets a float channel as array.
[out] | n | Number of elements stored in the channel. |
[out] | w | Width of an element. |
[in] | name | Key of the channel. |
Definition at line 528 of file BaseBuffer.hpp.
|
inline |
Gets an atomic float value.
[in] | name | Key of the atomic value. |
Definition at line 636 of file BaseBuffer.hpp.
|
inline |
Gets a float channel and returns it as optional.
[in] | name | Key of the channel. |
Definition at line 393 of file BaseBuffer.hpp.
|
inline |
Get a Handle object (ElementProxy) of a float channel.
[in] | idx | The index of the element to access. |
[in] | name | Key of the channel. |
Definition at line 475 of file BaseBuffer.hpp.
ElementProxy<T> lvr2::BaseBuffer::getHandle | ( | unsigned int | idx, |
const std::string & | name | ||
) |
Get a Handle object (ElementProxy) of a specific typed channel.
T | The type of the channel. |
[in] | idx | The index of the element to access. |
[in] | name | Key of the channel. |
|
inline |
Gets an index channel as array.
[out] | n | Number of elements stored in the channel. |
[out] | w | Width of an element. |
[in] | name | Key of the channel. |
Definition at line 554 of file BaseBuffer.hpp.
|
inline |
Gets an index channel and returns it as optional.
[in] | name | Key of the channel. |
Definition at line 415 of file BaseBuffer.hpp.
|
inline |
Get a Handle object (ElementProxy) of an index channel.
[in] | idx | The index of the element to access. |
[in] | name | Key of the channel. |
Definition at line 499 of file BaseBuffer.hpp.
|
inline |
Gets an atomic int value.
[in] | name | Key of the atomic value. |
Definition at line 662 of file BaseBuffer.hpp.
|
inline |
Gets an uchar channel as array.
[out] | n | Number of elements stored in the channel. |
[out] | w | Width of an element. |
[in] | name | Key of the channel. |
Definition at line 541 of file BaseBuffer.hpp.
|
inline |
Gets an atomic uchar value.
[in] | name | Key of the atomic value. |
Definition at line 649 of file BaseBuffer.hpp.
|
inline |
Gets an uchar channel and returns it as optional.
[in] | name | Key of the channel. |
Definition at line 404 of file BaseBuffer.hpp.
|
inline |
Get a Handle object (ElementProxy) of an uchar channel.
[in] | idx | The index of the element to access. |
[in] | name | Key of the channel. |
Definition at line 487 of file BaseBuffer.hpp.
bool lvr2::BaseBuffer::hasChannel | ( | const std::string & | name | ) | const |
Checks if a channel is available.
[in] | name | Key of the channel. |
T | Type of the channel. |
|
inline |
Checks if a float channel is available.
[in] | name | Key of the channel. |
Definition at line 127 of file BaseBuffer.hpp.
|
inline |
Checks if an index channel is available.
[in] | name | Key of the channel. |
Definition at line 136 of file BaseBuffer.hpp.
|
inline |
Checks if an uchar channel is available.
[in] | name | Key of the channel. |
Definition at line 118 of file BaseBuffer.hpp.
|
inline |
Gets an index channels width.
[in] | name | Key of the channel. |
Definition at line 97 of file BaseBuffer.hpp.
|
inline |
Definition at line 668 of file BaseBuffer.hpp.
bool lvr2::BaseBuffer::removeChannel | ( | const std::string & | name | ) |
Removes a channel with a specific type. @detail If the type is not required use: erase.
T | Type of the channel. |
[in] | name | Key of the channel. |
|
inline |
Removes a float channel. @detail If the type is not required use: erase.
[in] | name | Key of the channel. |
Definition at line 306 of file BaseBuffer.hpp.
|
inline |
Removes an index channel. @detail If the type is not required use: erase.
[in] | name | Key of the channel. |
Definition at line 293 of file BaseBuffer.hpp.
|
inline |
Removes an uchar channel. @detail If the type is not required use: erase.
[in] | name | Key of the channel. |
Definition at line 319 of file BaseBuffer.hpp.
|
inline |
Gets an uchar channels width.
[in] | name | Key of the channel. |
Definition at line 77 of file BaseBuffer.hpp.