NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
NumeRe::Table Class Reference

This data container is a copy- efficient table to interchange data between Kernel and GUI. More...

#include <table.hpp>

Collaboration diagram for NumeRe::Table:

Public Member Functions

 Table ()
 Default constructor. More...
 
 Table (int nLines, int nCols)
 Size constructor. More...
 
 Table (const Table &_table)
 Copy constructor. More...
 
 Table (Table &&_table)
 Move constructor. More...
 
 ~Table ()
 Destructor. More...
 
Tableoperator= (Table _table)
 Move assignment operator. More...
 
void Clear ()
 This member function cleares the contents of this table. More...
 
void setSize (size_t i, size_t j)
 This member function simply redirects the control to setMinSize(). More...
 
void setName (const std::string &_sName)
 Setter function for the table name. More...
 
void setComment (const std::string &_comment)
 Setter function for the table comment. More...
 
void setMetaData (const TableMetaData &meta)
 Setter function for the table meta data. More...
 
void setHead (size_t i, const std::string &_sHead)
 Setter function for the selected column headline. Will create missing headlines automatically. More...
 
void setHeadPart (size_t i, size_t part, const std::string &_sHead)
 Setter function for the selected column headline and the selected part of the headline (split using linebreak characters). Will create the missing headlines automatically. More...
 
void setValue (size_t i, size_t j, const mu::value_type &_dValue)
 This member function sets the data to the table. It will resize the table automatically, if needed. More...
 
void setValueAsString (size_t i, size_t j, const std::string &_sValue)
 This member function sets the data, which is passed as a string, to the table. If the data is not a numerical value, the data is assigned to the corresponding column head. More...
 
void setColumn (size_t j, TableColumn *column)
 Assigns a whole column to the internal array. More...
 
bool setColumnType (size_t j, TableColumn::ColumnType _type)
 Tries to change the column type of the selected column. More...
 
std::string getName () const
 Getter function for the table name. More...
 
std::string getComment () const
 Getter function for the table comment. More...
 
TableMetaData getMetaData () const
 Getter function for the table meta data. More...
 
int getHeadCount () const
 Getter function for the needed number of headlines (depending on the number of linebreaks found in the headlines). More...
 
std::string getHead (size_t i) const
 Getter function for the selected column's headline. More...
 
std::string getCleanHead (size_t i) const
 Getter function for the selected column's headline. Underscores and masked headlines are replaced on-the-fly. More...
 
std::string getCleanHeadPart (size_t i, size_t part=0) const
 Getter function for the selected part of the selected column's headline. Underscores and masked headlines are replaced on-the-fly. More...
 
mu::value_type getValue (size_t i, size_t j) const
 Getter function for the value of the selected cell. More...
 
std::string getValueAsString (size_t i, size_t j) const
 Getter function for the value of the selected cell. The value is converted into a string. More...
 
TableColumngetColumn (size_t j) const
 Returns a copy of the internal column array or a nullptr, if the column does not exist or is empty. More...
 
TableColumn::ColumnType getColumnType (size_t j) const
 Returns the type of the selected column. More...
 
TableColumnArraygetTableData ()
 
size_t getLines () const
 Get the number of lines. More...
 
size_t getCols () const
 Get the number of columns. More...
 
bool isEmpty () const
 Return, whether the table is empty. More...
 
bool insertLines (size_t nPos=0, size_t nNum=1)
 This member function inserts lines at the desired position. More...
 
bool appendLines (size_t nNum=1)
 This member function appends lines. More...
 
bool deleteLines (size_t nPos=0, size_t nNum=1)
 This member function deletes lines at the desired position. More...
 
bool insertCols (size_t nPos=0, size_t nNum=1)
 This member function inserts columns at the desired position. More...
 
bool appendCols (size_t nNum=1)
 This member function appends columns. More...
 
bool deleteCols (size_t nPos=0, size_t nNum=1)
 This member function delets columns at the desired position. More...
 

Private Member Functions

void setMinSize (size_t i, size_t j)
 This member function prepares a table with the minimal size of the selected lines and columns. More...
 
bool isNumerical (const std::string &sValue) const
 This member function is a simple helper function to determine, whether a passed value may be parsed into a numerical value. More...
 

Private Attributes

TableColumnArray vTableData
 
std::string sTableName
 
TableMetaData m_meta
 

Detailed Description

This data container is a copy- efficient table to interchange data between Kernel and GUI.

Definition at line 86 of file table.hpp.

Constructor & Destructor Documentation

◆ Table() [1/4]

NumeRe::Table::Table ( )

Default constructor.

Definition at line 32 of file table.cpp.

References sTableName.

◆ Table() [2/4]

NumeRe::Table::Table ( int  nLines,
int  nCols 
)

Size constructor.

Parameters
nLinesint
nColsint

Definition at line 45 of file table.cpp.

References setSize().

Here is the call graph for this function:

◆ Table() [3/4]

NumeRe::Table::Table ( const Table _table)

Copy constructor.

Parameters
_tableconst Table&

Definition at line 57 of file table.cpp.

References vTableData.

◆ Table() [4/4]

NumeRe::Table::Table ( Table &&  _table)

Move constructor.

Parameters
_tableTable&&

Definition at line 75 of file table.cpp.

References vTableData.

◆ ~Table()

NumeRe::Table::~Table ( )

Destructor.

Definition at line 85 of file table.cpp.

References vTableData.

Member Function Documentation

◆ appendCols()

bool NumeRe::Table::appendCols ( size_t  nNum = 1)

This member function appends columns.

Parameters
nNumsize_t
Returns
bool

Definition at line 763 of file table.cpp.

References vTableData.

Referenced by GridNumeReTable::AppendCols().

◆ appendLines()

bool NumeRe::Table::appendLines ( size_t  nNum = 1)

This member function appends lines.

Parameters
nNumsize_t
Returns
bool

Definition at line 704 of file table.cpp.

References vTableData.

Referenced by GridNumeReTable::AppendRows().

◆ Clear()

void NumeRe::Table::Clear ( )

This member function cleares the contents of this table.

Returns
void

Definition at line 149 of file table.cpp.

References sTableName, and vTableData.

Referenced by GridNumeReTable::Clear().

◆ deleteCols()

bool NumeRe::Table::deleteCols ( size_t  nPos = 0,
size_t  nNum = 1 
)

This member function delets columns at the desired position.

Parameters
nPossize_t
nNumsize_t
Returns
bool

Definition at line 780 of file table.cpp.

References vTableData.

Referenced by GridNumeReTable::DeleteCols().

◆ deleteLines()

bool NumeRe::Table::deleteLines ( size_t  nPos = 0,
size_t  nNum = 1 
)

This member function deletes lines at the desired position.

Parameters
nPossize_t
nNumsize_t
Returns
bool

Definition at line 725 of file table.cpp.

References getHeadCount(), and vTableData.

Referenced by GridNumeReTable::DeleteRows().

Here is the call graph for this function:

◆ getCleanHead()

std::string NumeRe::Table::getCleanHead ( size_t  i) const

Getter function for the selected column's headline. Underscores and masked headlines are replaced on-the-fly.

Parameters
isize_t
Returns
std::string

Definition at line 487 of file table.cpp.

References TableColumn::getDefaultColumnHead(), and vTableData.

Referenced by getCleanHeadPart().

Here is the call graph for this function:

◆ getCleanHeadPart()

std::string NumeRe::Table::getCleanHeadPart ( size_t  i,
size_t  part = 0 
) const

Getter function for the selected part of the selected column's headline. Underscores and masked headlines are replaced on-the-fly.

Parameters
isize_t
partsize_t
Returns
std::string

Definition at line 507 of file table.cpp.

References getCleanHead(), TableColumn::getDefaultColumnHead(), getHeadCount(), and vTableData.

Referenced by GridNumeReTable::GetValue(), and setHeadPart().

Here is the call graph for this function:

◆ getCols()

◆ getColumn()

TableColumn * NumeRe::Table::getColumn ( size_t  j) const

Returns a copy of the internal column array or a nullptr, if the column does not exist or is empty.

Parameters
jsize_t
Returns
TableColumn*

Definition at line 604 of file table.cpp.

References vTableData.

Referenced by GridNumeReTable::CanGetValueAs(), GridNumeReTable::getCategories(), and Memory::importTable().

◆ getColumnType()

TableColumn::ColumnType NumeRe::Table::getColumnType ( size_t  j) const

Returns the type of the selected column.

Parameters
jsize_t
Returns
TableColumn::ColumnType

Definition at line 621 of file table.cpp.

References TableColumn::TYPE_NONE, and vTableData.

Referenced by GridNumeReTable::CanGetValueAs(), GridNumeReTable::getCategories(), and GridNumeReTable::getColumnTypes().

◆ getComment()

std::string NumeRe::Table::getComment ( ) const

Getter function for the table comment.

Returns
std::string

Definition at line 415 of file table.cpp.

References NumeRe::TableMetaData::comment, and m_meta.

◆ getHead()

std::string NumeRe::Table::getHead ( size_t  i) const

Getter function for the selected column's headline.

Parameters
isize_t
Returns
std::string

Definition at line 469 of file table.cpp.

References TableColumn::getDefaultColumnHead(), and vTableData.

Here is the call graph for this function:

◆ getHeadCount()

int NumeRe::Table::getHeadCount ( ) const

Getter function for the needed number of headlines (depending on the number of linebreaks found in the headlines).

Returns
int

Definition at line 429 of file table.cpp.

References vTableData.

Referenced by deleteLines(), getCleanHeadPart(), GridNumeReTable::getNumHeadlines(), insertLines(), TableViewer::SetData(), and setHeadPart().

◆ getLines()

◆ getMetaData()

TableMetaData NumeRe::Table::getMetaData ( ) const

Getter function for the table meta data.

Returns
TableMetaData

Definition at line 403 of file table.cpp.

References m_meta.

Referenced by Memory::importTable(), TableViewer::saveTable(), and TableViewer::SetData().

◆ getName()

std::string NumeRe::Table::getName ( ) const

Getter function for the table name.

Returns
string

Definition at line 390 of file table.cpp.

References sTableName.

◆ getTableData()

TableColumnArray & NumeRe::Table::getTableData ( )
inline

Definition at line 130 of file table.hpp.

References vTableData.

Referenced by TableViewer::saveTable().

◆ getValue()

mu::value_type NumeRe::Table::getValue ( size_t  i,
size_t  j 
) const

◆ getValueAsString()

std::string NumeRe::Table::getValueAsString ( size_t  i,
size_t  j 
) const

Getter function for the value of the selected cell. The value is converted into a string.

Parameters
isize_t
jsize_t
Returns
std::string

Definition at line 580 of file table.cpp.

References vTableData.

Referenced by GridNumeReTable::GetValue().

◆ insertCols()

bool NumeRe::Table::insertCols ( size_t  nPos = 0,
size_t  nNum = 1 
)

This member function inserts columns at the desired position.

Parameters
nPossize_t
nNumsize_t
Returns
bool

Definition at line 748 of file table.cpp.

References vTableData.

Referenced by GridNumeReTable::InsertCols().

◆ insertLines()

bool NumeRe::Table::insertLines ( size_t  nPos = 0,
size_t  nNum = 1 
)

This member function inserts lines at the desired position.

Parameters
nPossize_t
nNumsize_t
Returns
bool

Definition at line 683 of file table.cpp.

References getHeadCount(), and vTableData.

Referenced by GridNumeReTable::InsertRows().

Here is the call graph for this function:

◆ isEmpty()

bool NumeRe::Table::isEmpty ( ) const

Return, whether the table is empty.

Returns
bool

Definition at line 668 of file table.cpp.

References vTableData.

Referenced by editObject(), and TableViewer::SetData().

◆ isNumerical()

bool NumeRe::Table::isNumerical ( const std::string &  sValue) const
private

This member function is a simple helper function to determine, whether a passed value may be parsed into a numerical value.

Parameters
sValueconst std::string&
Returns
bool

Definition at line 136 of file table.cpp.

References CONVTYPE_VALUE, and isConvertible().

Here is the call graph for this function:

◆ operator=()

Table & NumeRe::Table::operator= ( Table  _table)

Move assignment operator.

Parameters
_tableTable
Returns
Table&

Definition at line 98 of file table.cpp.

References m_meta, sTableName, and vTableData.

◆ setColumn()

void NumeRe::Table::setColumn ( size_t  j,
TableColumn column 
)

Assigns a whole column to the internal array.

Parameters
jsize_t
columnTableColumn*
Returns
void

Definition at line 357 of file table.cpp.

References vTableData.

Referenced by Memory::extractTable().

◆ setColumnType()

bool NumeRe::Table::setColumnType ( size_t  j,
TableColumn::ColumnType  _type 
)

Tries to change the column type of the selected column.

Parameters
jsize_t
_typeTableColumn::ColumnType
Returns
bool

Definition at line 375 of file table.cpp.

References convert_if_needed(), and vTableData.

Referenced by TableViewer::changeColType().

Here is the call graph for this function:

◆ setComment()

void NumeRe::Table::setComment ( const std::string &  _comment)

Setter function for the table comment.

Parameters
_commentconst std::string&
Returns
void

Definition at line 213 of file table.cpp.

References NumeRe::TableMetaData::comment, and m_meta.

Referenced by TableViewer::GetData(), and TableViewer::GetDataCopy().

◆ setHead()

void NumeRe::Table::setHead ( size_t  i,
const std::string &  _sHead 
)

Setter function for the selected column headline. Will create missing headlines automatically.

Parameters
isize_t
_sHeadconst std::string&
Returns
void

Definition at line 229 of file table.cpp.

References vTableData.

◆ setHeadPart()

void NumeRe::Table::setHeadPart ( size_t  i,
size_t  part,
const std::string &  _sHead 
)

Setter function for the selected column headline and the selected part of the headline (split using linebreak characters). Will create the missing headlines automatically.

Parameters
isize_t
partsize_t
_sHeadconst std::string&
Returns
void

Definition at line 254 of file table.cpp.

References getCleanHeadPart(), getHeadCount(), and vTableData.

Referenced by GridNumeReTable::SetValue().

Here is the call graph for this function:

◆ setMetaData()

void NumeRe::Table::setMetaData ( const TableMetaData meta)

Setter function for the table meta data.

Parameters
metaconst TableMetaData&
Returns
void

Definition at line 200 of file table.cpp.

References m_meta.

Referenced by Memory::extractTable().

◆ setMinSize()

void NumeRe::Table::setMinSize ( size_t  i,
size_t  j 
)
private

This member function prepares a table with the minimal size of the selected lines and columns.

Parameters
isize_t
jsize_t
Returns
void

Definition at line 119 of file table.cpp.

References vTableData.

Referenced by setSize(), setValue(), and setValueAsString().

◆ setName()

void NumeRe::Table::setName ( const std::string &  _sName)

Setter function for the table name.

Parameters
_sNameconst std::string&
Returns
void

Definition at line 186 of file table.cpp.

References sTableName.

Referenced by Memory::extractTable().

◆ setSize()

void NumeRe::Table::setSize ( size_t  i,
size_t  j 
)

This member function simply redirects the control to setMinSize().

Parameters
isize_t
jsize_t
Returns
void

Definition at line 165 of file table.cpp.

References setMinSize(), and vTableData.

Referenced by decodeWaveletData(), and Table().

Here is the call graph for this function:

◆ setValue()

void NumeRe::Table::setValue ( size_t  i,
size_t  j,
const mu::value_type _dValue 
)

This member function sets the data to the table. It will resize the table automatically, if needed.

Parameters
isize_t
jsize_t
_dValueconst mu::value_type&
Returns
void

Definition at line 291 of file table.cpp.

References convert_if_empty(), setMinSize(), TableColumn::TYPE_VALUE, and vTableData.

Referenced by decodeWaveletData().

Here is the call graph for this function:

◆ setValueAsString()

void NumeRe::Table::setValueAsString ( size_t  i,
size_t  j,
const std::string &  _sValue 
)

This member function sets the data, which is passed as a string, to the table. If the data is not a numerical value, the data is assigned to the corresponding column head.

Parameters
isize_t
jsize_t
_sValueconst string&
Returns
void

Definition at line 312 of file table.cpp.

References convert_if_needed(), CONVTYPE_DATE_TIME, CONVTYPE_LOGICAL, CONVTYPE_VALUE, isConvertible(), setMinSize(), StrToCmplx(), StrToLogical(), StrToTime(), to_double(), TableColumn::TYPE_DATETIME, TableColumn::TYPE_LOGICAL, TableColumn::TYPE_STRING, TableColumn::TYPE_VALUE, and vTableData.

Referenced by GridNumeReTable::SetValue().

Here is the call graph for this function:

Member Data Documentation

◆ m_meta

TableMetaData NumeRe::Table::m_meta
private

Definition at line 91 of file table.hpp.

Referenced by getComment(), getMetaData(), operator=(), setComment(), and setMetaData().

◆ sTableName

std::string NumeRe::Table::sTableName
private

Definition at line 90 of file table.hpp.

Referenced by Clear(), getName(), operator=(), setName(), and Table().

◆ vTableData


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