Inviwo  0.9.10.1
Inviwo documentation
inviwo::DataFrame Class Reference

#include <dataframe.h>

Public Types

using DataItem = std::vector< std::shared_ptr< DataPointBase > >
 
using LookupTable = std::unordered_map< glm::u64, std::string >
 

Public Member Functions

 DataFrame (const DataFrame &df)
 
 DataFrame (std::uint32_t size=0)
 
std::shared_ptr< ColumnaddColumnFromBuffer (const std::string &identifier, std::shared_ptr< const BufferBase > buffer)
 add column based on the contents of the given buffer updateIndexBuffer() needs to be called after all columns have been added before the DataFrame can be used
 
template<typename T >
std::shared_ptr< TemplateColumn< T > > addColumn (const std::string &header, size_t size=0)
 add column of type T updateIndexBuffer() needs to be called after all columns have been added before the DataFrame can be used
 
std::shared_ptr< CategoricalColumnaddCategoricalColumn (const std::string &header, size_t size=0)
 add a categorical column updateIndexBuffer() needs to be called after all columns have been added before the DataFrame can be used
 
void addRow (const std::vector< std::string > &data)
 add a new row given a vector of strings. updateIndexBuffer() needs to be called after the last row has been added. More...
 
DataItem getDataItem (size_t index, bool getStringsAsStrings=false) const
 
const std::vector< std::pair< std::string, const DataFormatBase * > > getHeaders () const
 
std::string getHeader (size_t idx) const
 
std::shared_ptr< ColumngetColumn (size_t index)
 access individual columns updateIndexBuffer() needs to be called if the size of the column, i.e. the row count, was changed
 
std::shared_ptr< const ColumngetColumn (size_t index) const
 
std::shared_ptr< TemplateColumn< std::uint32_t > > getIndexColumn ()
 
std::shared_ptr< const TemplateColumn< std::uint32_t > > getIndexColumn () const
 
size_t getNumberOfColumns () const
 
size_t getNumberOfRows () const
 
std::vector< std::shared_ptr< Column > >::iterator begin ()
 
std::vector< std::shared_ptr< Column > >::iterator end ()
 
std::vector< std::shared_ptr< Column > >::const_iterator begin () const
 
std::vector< std::shared_ptr< Column > >::const_iterator end () const
 
void updateIndexBuffer ()
 update row indices. Needs to be called if the row count has changed, i.e. after adding rows from the DataFrame or adding or removing rows from a particular column.
 

Detailed Description

Table of data for plotting where each column can have a header (title). Missing float/double data is stored as Not a Number (NaN) All columns must have the same number of elements for the DataFrame to be valid.

Member Function Documentation

◆ addRow()

void inviwo::DataFrame::addRow ( const std::vector< std::string > &  data)

add a new row given a vector of strings. updateIndexBuffer() needs to be called after the last row has been added.

Parameters
datadata for each column
Exceptions
NoColumnsif the data frame has no columns defined
InvalidColCountif column count of DataFrame does not match the number of columns in data
DataTypeMismatchif the data type of a column doesn't match with the input data

◆ getNumberOfRows()

size_t inviwo::DataFrame::getNumberOfRows ( ) const

Returns the number of rows of the largest column, excluding the header, or zero if no columns exist.


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