Inviwo  0.9.10.1
Inviwo documentation
inviwo::CategoricalColumn Class Reference

Specialized data column representing categorical values, i.e. strings. Categorical values are internally mapped to a number representation. More...

#include <column.h>

+ Inheritance diagram for inviwo::CategoricalColumn:

Public Member Functions

 CategoricalColumn (const std::string &header)
 
 CategoricalColumn (const CategoricalColumn &rhs)=default
 
 CategoricalColumn (CategoricalColumn &&rhs)=default
 
CategoricalColumnoperator= (const CategoricalColumn &rhs)=default
 
CategoricalColumnoperator= (CategoricalColumn &&rhs)=default
 
virtual CategoricalColumnclone () const override
 
virtual std::string getAsString (size_t idx) const override
 
virtual std::shared_ptr< DataPointBaseget (size_t idx, bool getStringsAsStrings) const override
 returns either the categorical value, i.e. a number representation, or the actual string for the given index. More...
 
virtual void set (size_t idx, const std::string &str)
 
virtual void add (const std::string &value) override
 converts given value to type T, which is added to the column More...
 
const std::vector< std::string > & getCategories () const
 
- Public Member Functions inherited from inviwo::TemplateColumn< std::uint32_t >
 TemplateColumn (const std::string &header)
 
 TemplateColumn (const TemplateColumn< std::uint32_t > &rhs)
 
 TemplateColumn (TemplateColumn< std::uint32_t > &&rhs)
 
TemplateColumn< std::uint32_t > & operator= (const TemplateColumn< std::uint32_t > &rhs)
 
TemplateColumn< std::uint32_t > & operator= (TemplateColumn< std::uint32_t > &&rhs)
 
virtual const std::string & getHeader () const override
 
void setHeader (const std::string &header) override
 
virtual void add (const std::uint32_t &value)
 
virtual void set (size_t idx, const std::uint32_t &value)
 
std::uint32_t get (size_t idx) const
 
virtual double getAsDouble (size_t idx) const override
 
virtual dvec2 getAsDVec2 (size_t idx) const override
 
virtual dvec3 getAsDVec3 (size_t idx) const override
 
virtual dvec4 getAsDVec4 (size_t idx) const override
 
void setBuffer (std::shared_ptr< Buffer< std::uint32_t >> buffer)
 
virtual std::shared_ptr< BufferBasegetBuffer () override
 
virtual std::shared_ptr< const BufferBasegetBuffer () const override
 
std::shared_ptr< Buffer< std::uint32_t > > getTypedBuffer ()
 
std::shared_ptr< const Buffer< std::uint32_t > > getTypedBuffer () const
 
virtual size_t getSize () const override
 

Additional Inherited Members

- Public Types inherited from inviwo::TemplateColumn< std::uint32_t >
using type = std::uint32_t
 
- Protected Attributes inherited from inviwo::TemplateColumn< std::uint32_t >
std::string header_
 
std::shared_ptr< Buffer< std::uint32_t > > buffer_
 

Detailed Description

Specialized data column representing categorical values, i.e. strings. Categorical values are internally mapped to a number representation.

For example: The data column "blue", "blue", "red", "yellow" might internally be represented by 0, 0, 1, 2. The original string values can be accessed using CategoricalColumn::get(index, true)

See also
TemplateColumn,
CategoricalColumn::get()

Member Function Documentation

◆ add()

void inviwo::CategoricalColumn::add ( const std::string &  value)
overridevirtual

converts given value to type T, which is added to the column

Parameters
value
Exceptions
InvalidConversionif the value cannot be converted to T

Reimplemented from inviwo::TemplateColumn< std::uint32_t >.

◆ get()

std::shared_ptr< DataPointBase > inviwo::CategoricalColumn::get ( size_t  idx,
bool  getStringsAsStrings 
) const
overridevirtual

returns either the categorical value, i.e. a number representation, or the actual string for the given index.

Parameters
idxindex
getStringsAsStringsif true, a string will be returned instead of the internal representation. This will not affect other column types.
See also
TemplateColumn

Reimplemented from inviwo::TemplateColumn< std::uint32_t >.

◆ getCategories()

const std::vector<std::string>& inviwo::CategoricalColumn::getCategories ( ) const
inline

Returns the unique set of categorical values.


The documentation for this class was generated from the following files: