Class BaseBuffer
Defined in File BaseBuffer.hpp
Inheritance Relationships
Base Type
public lvr2::VariantChannelMap< char, unsigned char, short, unsigned short, int, unsigned int, long int, unsigned long int, float, double, bool, WaveformData >(Template Class VariantChannelMap)
Derived Types
public lvr2::LabelBuffer(Class LabelBuffer)public lvr2::MeshBuffer(Class MeshBuffer)public lvr2::PointBuffer(Class PointBuffer)public lvr2::PolygonBuffer(Class PolygonBuffer)
Class Documentation
-
class BaseBuffer : public lvr2::VariantChannelMap<char, unsigned char, short, unsigned short, int, unsigned int, long int, unsigned long int, float, double, bool, WaveformData>
ChannelManager class Store and access AttributeChannels. It expands the MultiChannelMap with downwoards compitibility functions of the old ChannelManager.
Subclassed by lvr2::LabelBuffer, lvr2::MeshBuffer, lvr2::PointBuffer, lvr2::PolygonBuffer
Public Types
-
using base = std::unordered_map<std::string, VariantChannel<T...>>
Public Functions
-
inline virtual ~BaseBuffer()
-
template<typename T>
size_t channelWidth(const std::string &name) const Gets a channels width.
- Parameters:
name – [in] Key of the channel.
- Template Parameters:
T – type of channel to search for.
- Returns:
0 if not found, otherwise the channels width.
-
inline size_t ucharChannelWidth(const std::string &name) const
Gets an uchar channels width.
- Parameters:
name – [in] Key of the channel.
- Returns:
0 if not found, otherwise the channels width.
-
inline size_t floatChannelWidth(const std::string &name) const
Gets a float channels width.
- Parameters:
name – [in] Key of the channel.
- Returns:
0 if not found, otherwise the channels width.
-
inline size_t indexChannelWidth(const std::string &name) const
Gets an index channels width.
- Parameters:
name – [in] Key of the channel.
- Returns:
0 if not found, otherwise the channels width.
-
template<typename T>
bool hasChannel(const std::string &name) const Checks if a channel is available.
- Parameters:
name – [in] Key of the channel.
- Template Parameters:
T – Type of the channel.
-
inline bool hasUCharChannel(const std::string &name) const
Checks if an uchar channel is available.
- Parameters:
name – [in] Key of the channel.
-
inline bool hasFloatChannel(const std::string &name) const
Checks if a float channel is available.
- Parameters:
name – [in] Key of the channel.
-
inline bool hasIndexChannel(const std::string &name) const
Checks if an index channel is available.
- Parameters:
name – [in] Key of the channel.
-
template<typename T>
void addChannel(typename Channel<T>::Ptr data, const std::string &name) Adds a channel pointer to the map.
- Parameters:
data – [in] The channel pointer to add.
name – [in] The key of the channel.
- Template Parameters:
T – Type of the channel.
-
inline void addFloatChannel(FloatChannelPtr data, const std::string &name)
Adds a float channel pointer to the map.
- Parameters:
data – [in] The channel pointer to add.
name – [in] Key of the channel.
-
inline void addUCharChannel(UCharChannelPtr data, const std::string &name)
Adds an uchar channel pointer to the map.
- Parameters:
data – [in] The channel pointer to add.
name – [in] Key of the channel.
-
inline void addIndexChannel(IndexChannelPtr data, const std::string &name)
Adds an index channel pointer to the map. cointer to add. cannel.
Constructs a channel from an boost::shared_array and saves it to the map.
- Parameters:
array – [in] The shared array of the data.
name – [in] Key of the channel.
- Template Parameters:
T – Type of the channel.
-
inline 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.
- Parameters:
array – [in] The shared array of the data.
name – [in] Key of the channel.
-
inline 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.
- Parameters:
array – [in] The shared array of the data.
name – [in] Key of the channel.
-
inline 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.
- Parameters:
array – [in] The shared array of the data.
name – [in] Key of the channel.
-
template<typename T>
void addEmptyChannel(const std::string &name, size_t n, size_t width) Adds an empty channel to the map.
- Parameters:
name – [in] Key of the channel.
n – [in] Number of elements.
width – [in] Width of one element.
- Template Parameters:
T – Type of the channel.
-
inline void addEmptyFloatChannel(const std::string &name, size_t n, size_t width)
Adds an empty float channel to the map.
- Parameters:
name – [in] Key of the channel.
n – [in] Number of elements.
width – [in] Width of one element.
-
inline void addEmptyUCharChannel(const std::string &name, size_t n, size_t width)
Adds an empty uchar channel to the map.
- Parameters:
name – [in] Key of the channel.
n – [in] Number of elements.
width – [in] Width of one element.
-
inline void addEmptyIndexChannel(const std::string &name, size_t n, size_t width)
Adds an empty index channel to the map.
- Parameters:
name – [in] Key of the channel.
n – [in] Number of elements.
width – [in] Width of one element.
-
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.
- Template Parameters:
T – Type of the channel.
- Parameters:
name – [in] Key of the channel.
- Returns:
true If the channel was removed.
- Returns:
false If no channel was removed.
-
inline bool removeIndexChannel(const std::string &name)
Removes an index channel. @detail If the type is not required use: erase.
- Parameters:
name – [in] Key of the channel.
- Returns:
true If the channel was removed.
- Returns:
false If no channel was removed.
-
inline bool removeFloatChannel(const std::string &name)
Removes a float channel. @detail If the type is not required use: erase.
- Parameters:
name – [in] Key of the channel.
- Returns:
true If the channel was removed.
- Returns:
false If no channel was removed.
-
inline bool removeUCharChannel(const std::string &name)
Removes an uchar channel. @detail If the type is not required use: erase.
- Parameters:
name – [in] Key of the channel.
- Returns:
true If the channel was removed.
- Returns:
false If no channel was removed.
-
template<typename T>
inline int getAllChannelsOfType(std::map<std::string, Channel<T>> &channels) Returns all channels of type T.
- Template Parameters:
T – The type of the channels.
- Parameters:
channels – The vector of channel pairs(name, Channel).
- Returns:
The type index in the MultiChannelMap.
-
template<typename T>
inline int getAllChannelsOfType(std::vector<std::pair<std::string, Channel<T>>> &channels) Returns all channels of type T.
- Template Parameters:
T – The type of the channels.
- Parameters:
channels – The vector of channel pairs(name, Channel).
- Returns:
The type index in the MultiChannelMap.
-
template<typename T>
Channel<T>::Optional getChannel(const std::string &name) Gets a channel and returns it as optional.
- Parameters:
name – [in] Key of the channel.
- Template Parameters:
T – Type of the channel.
- Returns:
An OptionalChannel which is filled if the channel was found.
-
template<typename T>
const Channel<T>::Optional getChannel(const std::string &name) const Gets a channel and returns it as optional.
- Parameters:
name – [in] Key of the channel.
- Template Parameters:
T – Type of the channel.
- Returns:
An OptionalChannel which is filled if the channel was found.
-
inline Channel<float>::Optional getFloatChannel(const std::string &name)
Gets a float channel and returns it as optional.
- Parameters:
name – [in] Key of the channel.
- Returns:
An OptionalChannel which is filled if the channel was found.
-
inline Channel<unsigned char>::Optional getUCharChannel(const std::string &name)
Gets an uchar channel and returns it as optional.
- Parameters:
name – [in] Key of the channel.
- Returns:
An OptionalChannel which is filled if the channel was found.
-
inline Channel<unsigned int>::Optional getIndexChannel(const std::string &name)
Gets an index channel and returns it as optional.
- Parameters:
name – [in] Key of the channel.
- Returns:
An OptionalChannel which is filled if the channel was found.
-
inline void getChannel(const std::string &name, FloatChannelOptional &channelOptional)
Gets a float channel and returns it as optional.
- Parameters:
name – [in] Key of the channel.
channelOptional – [out] The float channel optional.
-
inline void getChannel(const std::string &name, IndexChannelOptional &channelOptional)
Gets an index channel and returns it as optional.
- Parameters:
name – [in] Key of the channel.
channelOptional – [out] The index channel optional.
-
inline void getChannel(const std::string &name, UCharChannelOptional &channelOptional)
Gets an uchar channel and returns it as optional.
- Parameters:
name – [in] Key of the channel.
channelOptional – [out] The uchar channel optional.
-
template<typename T>
ElementProxy<T> getHandle(unsigned int idx, const std::string &name) Get a Handle object (ElementProxy) of a specific typed channel.
- Template Parameters:
T – The type of the channel.
- Parameters:
idx – [in] The index of the element to access.
name – [in] Key of the channel.
- Returns:
ElementProxy<T> The handle.
-
inline FloatProxy getFloatHandle(unsigned int idx, const std::string &name)
Get a Handle object (ElementProxy) of a float channel.
- Parameters:
idx – [in] The index of the element to access.
name – [in] Key of the channel.
- Returns:
FloatProxy The handle.
-
inline UCharProxy getUCharHandle(unsigned int idx, const std::string &name)
Get a Handle object (ElementProxy) of an uchar channel.
- Parameters:
idx – [in] The index of the element to access.
name – [in] Key of the channel.
- Returns:
UCharProxy The handle.
-
inline IndexProxy getIndexHandle(unsigned int idx, const std::string &name)
Get a Handle object (ElementProxy) of an index channel.
- Parameters:
idx – [in] The index of the element to access.
name – [in] Key of the channel.
- Returns:
IndexProxy The handle.
Gets a channel as array.
- Template Parameters:
T – Type of the channel.
- Parameters:
n – [out] Number of elements stored in the channel.
w – [out] Width of an element.
name – [in] Key of the channel.
- Returns:
boost::shared_array<T> The data pointer. Empty if the channel was not found.
-
inline floatArr getFloatArray(const std::string &name, size_t &n, size_t &w)
Gets a float channel as array.
- Parameters:
n – [out] Number of elements stored in the channel.
w – [out] Width of an element.
name – [in] Key of the channel.
- Returns:
floatArr The data pointer. Empty if the channel was not found.
-
inline ucharArr getUCharArray(const std::string &name, size_t &n, size_t &w)
Gets an uchar channel as array.
- Parameters:
n – [out] Number of elements stored in the channel.
w – [out] Width of an element.
name – [in] Key of the channel.
- Returns:
ucharArr The data pointer. Empty if the channel was not found.
-
inline indexArray getIndexArray(const std::string &name, size_t &n, size_t &w)
Gets an index channel as array.
- Parameters:
n – [out] Number of elements stored in the channel.
w – [out] Width of an element.
name – [in] Key of the channel.
- Returns:
indexArray The data pointer. Empty if the channel was not found.
-
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.
- Template Parameters:
T – Type of the atomic value.
- Parameters:
data – [in] The atomic data to add to the channel manager.
name – [in] The key of the atomic value (don’t use keys that are already used for channels).
-
inline 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.
- Parameters:
data – [in] The atomic data to add to the channel manager.
name – [in] The key of the atomic value (don’t use keys that are already used for channels).
-
inline 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.
- Parameters:
data – [in] The atomic data to add to the channel manager.
name – [in] The key of the atomic value (don’t use keys that are already used for channels).
-
inline 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.
- Parameters:
data – [in] The atomic data to add to the channel manager.
name – [in] The key of the atomic value (don’t use keys that are already used for channels).
-
template<typename T>
boost::optional<T> getAtomic(const std::string &name) Gets an atomic value.
- Template Parameters:
T – The atomic values type.
- Parameters:
name – [in] Key of the atomic value.
- Returns:
The atomic value as optional. The optional is set if the atomic value was found.
-
inline floatOptional getFloatAtomic(const std::string &name)
Gets an atomic float value.
- Parameters:
name – [in] Key of the atomic value.
- Returns:
The atomic value as optional. The optional is set if the atomic value was found.
-
inline ucharOptional getUCharAtomic(const std::string &name)
Gets an atomic uchar value.
- Parameters:
name – [in] Key of the atomic value.
- Returns:
The atomic value as optional. The optional is set if the atomic value was found.
-
inline intOptional getIntAtomic(const std::string &name)
Gets an atomic int value.
- Parameters:
name – [in] Key of the atomic value.
- Returns:
The atomic value as optional. The optional is set if the atomic value was found.
-
template<typename V>
inline BaseBuffer manipulate(V visitor)
-
inline BaseBuffer clone() const
-
using base = std::unordered_map<std::string, VariantChannel<T...>>