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

A table column containing only numerical values. More...

#include <tablecolumnimpl.hpp>

Inheritance diagram for ValueColumn:
Collaboration diagram for ValueColumn:

Public Member Functions

 ValueColumn ()
 Default constructor. Sets only the type of the column. More...
 
 ValueColumn (size_t nElem)
 Generalized constructor. Will prepare a column with the specified size. More...
 
virtual ~ValueColumn ()
 
virtual std::string getValueAsString (size_t elem) const override
 Returns the selected value as a string or a default value, if it does not exist. More...
 
virtual std::string getValueAsInternalString (size_t elem) const override
 Returns the contents as an internal string (i.e. without quotation marks). More...
 
virtual std::string getValueAsParserString (size_t elem) const override
 Returns the contents as parser string (i.e. without quotation marks). More...
 
virtual std::string getValueAsStringLiteral (size_t elem) const override
 Returns the contents as parser string (i.e. without quotation marks). More...
 
virtual mu::value_type getValue (size_t elem) const override
 Returns the selected value as a numerical type or an invalid value, if it does not exist. More...
 
virtual void setValue (size_t elem, const std::string &sValue) override
 Set a single string value. More...
 
virtual void setValue (size_t elem, const mu::value_type &vValue) override
 Set a single numerical value. More...
 
virtual ValueColumncopy (const VectorIndex &idx) const override
 Creates a copy of the selected part of this column. Can be used for simple extraction into a new table. More...
 
virtual void assign (const TableColumn *column) override
 Assign another TableColumn's contents to this table column. More...
 
virtual void insert (const VectorIndex &idx, const TableColumn *column) override
 Insert the contents of the passed column at the specified positions. More...
 
virtual void deleteElements (const VectorIndex &idx) override
 Delete the specified elements. More...
 
virtual void insertElements (size_t pos, size_t elem) override
 Inserts as many as the selected elements at the desired position, if the column is already larger than the starting position. More...
 
virtual void appendElements (size_t elem) override
 Appends the number of elements. More...
 
virtual void removeElements (size_t pos, size_t elem) override
 Removes the selected number of elements from the column and moving all following items forward. More...
 
virtual void resize (size_t elem) override
 Resizes the internal array. More...
 
virtual int compare (int i, int j, bool unused) const override
 Returns 0, if both elements are equal, -1 if element i is smaller than element j and 1 otherwise. More...
 
virtual bool isValid (int elem) const override
 Returns true, if the selected element is a valid value. More...
 
virtual bool asBool (int elem) const override
 Interprets the value as a boolean. More...
 
virtual size_t getBytes () const override
 Return the number of bytes occupied by this column. More...
 
virtual size_t size () const override
 Return the number of elements in this column (will also count invalid ones). More...
 
virtual TableColumnconvert (ColumnType type=TableColumn::TYPE_NONE) override
 Returns the contents of this column converted to the new column type. Might even return itself. More...
 
- Public Member Functions inherited from TableColumn
 TableColumn ()
 
virtual ~TableColumn ()
 
std::vector< std::string > getValueAsString (const VectorIndex &idx) const
 Return the table column's contents as a vector of strings. More...
 
std::vector< std::string > getValueAsInternalString (const VectorIndex &idx) const
 Returns the table column's contents as a vector containing internal strings. More...
 
std::vector< mu::value_typegetValue (const VectorIndex &idx) const
 Return the table column's contents as a vector of numerical types. More...
 
virtual std::string getValueAsString (size_t elem) const =0
 
virtual std::string getValueAsInternalString (size_t elem) const =0
 
virtual std::string getValueAsParserString (size_t elem) const =0
 
virtual std::string getValueAsStringLiteral (size_t elem) const =0
 
virtual mu::value_type getValue (size_t elem) const =0
 
void setValue (const VectorIndex &idx, const std::vector< std::string > &vValue)
 Sets a string vector at the specified indices. More...
 
void setValue (const VectorIndex &idx, const std::vector< mu::value_type > &vValue)
 Sets a numerical vector at the specified indices. More...
 
void setValue (const VectorIndex &idx, mu::value_type *_dData, unsigned int _nNum)
 Sets a plain numerical array at the specified indices. More...
 
virtual void setValue (size_t elem, const std::string &sValue)=0
 
virtual void setValue (size_t elem, const mu::value_type &vValue)=0
 
TableColumncopy () const
 Simplification wrapper around the indiced copy method to copy the whole column. More...
 
virtual TableColumncopy (const VectorIndex &idx) const =0
 
virtual void assign (const TableColumn *column)=0
 
virtual void insert (const VectorIndex &idx, const TableColumn *column)=0
 
virtual void deleteElements (const VectorIndex &idx)=0
 
void shrink ()
 Shrink the column by removing all invalid elements from the end. More...
 
virtual void insertElements (size_t pos, size_t elem)=0
 
virtual void appendElements (size_t elem)=0
 
virtual void removeElements (size_t pos, size_t elem)=0
 
virtual void resize (size_t elem)=0
 
virtual int compare (int i, int j, bool flag) const =0
 
virtual bool isValid (int elem) const =0
 
virtual bool asBool (int elem) const =0
 
virtual size_t size () const =0
 
virtual size_t getBytes () const =0
 
size_t getNumFilledElements () const
 Return the number of actual filled elements in this column, which can be different from the actual size of the column. More...
 
virtual TableColumnconvert (ColumnType type=TableColumn::TYPE_NONE)=0
 

Protected Attributes

std::vector< mu::value_typem_data
 

Additional Inherited Members

- Public Types inherited from TableColumn
enum  ColumnType {
  TYPE_NONE , VALUELIKE , TYPE_VALUE , TYPE_DATETIME ,
  TYPE_LOGICAL , TYPE_CATEGORICAL , STRINGLIKE , TYPE_STRING ,
  TYPE_MIXED
}
 
- Static Public Member Functions inherited from TableColumn
static std::string getDefaultColumnHead (size_t colNo)
 Creates a default column headline for a column, which can be used without an instance of this class. More...
 
static std::string typeToString (ColumnType type)
 Converts the passed ColumnType value to a string representation. More...
 
static ColumnType stringToType (const std::string &sType)
 Converts the passed string representation to a ColumnType value. More...
 
static std::vector< std::string > getTypesAsString ()
 Returns a list of all available column types as strings. More...
 
- Public Attributes inherited from TableColumn
std::string m_sHeadLine
 
ColumnType m_type
 

Detailed Description

A table column containing only numerical values.

Definition at line 31 of file tablecolumnimpl.hpp.

Constructor & Destructor Documentation

◆ ValueColumn() [1/2]

ValueColumn::ValueColumn ( )
inline

Default constructor. Sets only the type of the column.

Definition at line 41 of file tablecolumnimpl.hpp.

References TableColumn::m_type, and TableColumn::TYPE_VALUE.

Referenced by copy().

◆ ValueColumn() [2/2]

ValueColumn::ValueColumn ( size_t  nElem)
inline

Generalized constructor. Will prepare a column with the specified size.

Parameters
nElemsize_t

Definition at line 53 of file tablecolumnimpl.hpp.

References resize().

Here is the call graph for this function:

◆ ~ValueColumn()

virtual ValueColumn::~ValueColumn ( )
inlinevirtual

Definition at line 58 of file tablecolumnimpl.hpp.

Member Function Documentation

◆ appendElements()

void ValueColumn::appendElements ( size_t  elem)
overridevirtual

Appends the number of elements.

Parameters
elemsize_t
Returns
void

Implements TableColumn.

Definition at line 257 of file tablecolumnimpl.cpp.

References m_data.

◆ asBool()

bool ValueColumn::asBool ( int  elem) const
overridevirtual

Interprets the value as a boolean.

Parameters
elemint
Returns
bool

Implements TableColumn.

Definition at line 345 of file tablecolumnimpl.cpp.

References m_data.

◆ assign()

void ValueColumn::assign ( const TableColumn column)
overridevirtual

Assign another TableColumn's contents to this table column.

Parameters
columnconst TableColumn*
Returns
void

Implements TableColumn.

Definition at line 172 of file tablecolumnimpl.cpp.

References SyntaxError::CANNOT_ASSIGN_COLUMN_OF_DIFFERENT_TYPE, m_data, TableColumn::m_sHeadLine, TableColumn::m_type, TableColumn::TYPE_VALUE, and TableColumn::typeToString().

Here is the call graph for this function:

◆ compare()

int ValueColumn::compare ( int  i,
int  j,
bool  unused 
) const
overridevirtual

Returns 0, if both elements are equal, -1 if element i is smaller than element j and 1 otherwise.

Parameters
iint
jint
unusedbool
Returns
int

Implements TableColumn.

Definition at line 307 of file tablecolumnimpl.cpp.

References m_data, max, and mu::real().

Here is the call graph for this function:

◆ convert()

TableColumn * ValueColumn::convert ( ColumnType  type = TableColumn::TYPE_NONE)
overridevirtual

Returns the contents of this column converted to the new column type. Might even return itself.

Parameters
typeColumnType
Returns
TableColumn*

Implements TableColumn.

Definition at line 363 of file tablecolumnimpl.cpp.

References NumeReKernel::getInstance(), mu::isnan(), m_data, TableColumn::m_sHeadLine, TableColumn::setValue(), toString(), TableColumn::TYPE_CATEGORICAL, TableColumn::TYPE_DATETIME, TableColumn::TYPE_LOGICAL, TableColumn::TYPE_NONE, TableColumn::TYPE_STRING, and TableColumn::TYPE_VALUE.

Here is the call graph for this function:

◆ copy()

ValueColumn * ValueColumn::copy ( const VectorIndex idx) const
overridevirtual

Creates a copy of the selected part of this column. Can be used for simple extraction into a new table.

Parameters
idxconst VectorIndex&
Returns
ValueColumn*

Implements TableColumn.

Definition at line 148 of file tablecolumnimpl.cpp.

References getValue(), m_data, TableColumn::m_sHeadLine, VectorIndex::setOpenEndIndex(), VectorIndex::size(), size(), and ValueColumn().

Here is the call graph for this function:

◆ deleteElements()

void ValueColumn::deleteElements ( const VectorIndex idx)
overridevirtual

Delete the specified elements.

Note
Will trigger the shrinking algorithm.
Parameters
idxconst VectorIndex&
Returns
void

Implements TableColumn.

Definition at line 211 of file tablecolumnimpl.cpp.

References VectorIndex::front(), VectorIndex::isExpanded(), VectorIndex::last(), m_data, VectorIndex::setOpenEndIndex(), TableColumn::shrink(), VectorIndex::size(), and size().

Here is the call graph for this function:

◆ getBytes()

virtual size_t ValueColumn::getBytes ( ) const
inlineoverridevirtual

Return the number of bytes occupied by this column.

Returns
size_t

Implements TableColumn.

Definition at line 90 of file tablecolumnimpl.hpp.

References TableColumn::m_sHeadLine, and size().

Here is the call graph for this function:

◆ getValue()

mu::value_type ValueColumn::getValue ( size_t  elem) const
overridevirtual

Returns the selected value as a numerical type or an invalid value, if it does not exist.

Parameters
elemsize_t
Returns
mu::value_type

Implements TableColumn.

Definition at line 93 of file tablecolumnimpl.cpp.

References m_data.

Referenced by copy().

◆ getValueAsInternalString()

std::string ValueColumn::getValueAsInternalString ( size_t  elem) const
overridevirtual

Returns the contents as an internal string (i.e. without quotation marks).

Parameters
elemsize_t
Returns
std::string

Implements TableColumn.

Definition at line 50 of file tablecolumnimpl.cpp.

References getValueAsString().

Here is the call graph for this function:

◆ getValueAsParserString()

std::string ValueColumn::getValueAsParserString ( size_t  elem) const
overridevirtual

Returns the contents as parser string (i.e. without quotation marks).

Parameters
elemsize_t
Returns
std::string

Implements TableColumn.

Definition at line 64 of file tablecolumnimpl.cpp.

References getValueAsString().

Here is the call graph for this function:

◆ getValueAsString()

std::string ValueColumn::getValueAsString ( size_t  elem) const
overridevirtual

Returns the selected value as a string or a default value, if it does not exist.

Parameters
elemsize_t
Returns
std::string

Implements TableColumn.

Definition at line 33 of file tablecolumnimpl.cpp.

References NumeReKernel::getInstance(), m_data, and toString().

Referenced by getValueAsInternalString(), getValueAsParserString(), and getValueAsStringLiteral().

Here is the call graph for this function:

◆ getValueAsStringLiteral()

std::string ValueColumn::getValueAsStringLiteral ( size_t  elem) const
overridevirtual

Returns the contents as parser string (i.e. without quotation marks).

Parameters
elemsize_t
Returns
std::string

Implements TableColumn.

Definition at line 78 of file tablecolumnimpl.cpp.

References getValueAsString().

Here is the call graph for this function:

◆ insert()

void ValueColumn::insert ( const VectorIndex idx,
const TableColumn column 
)
overridevirtual

Insert the contents of the passed column at the specified positions.

Parameters
idxconst VectorIndex&
columnconst TableColumn*
Returns
void

Implements TableColumn.

Definition at line 193 of file tablecolumnimpl.cpp.

References SyntaxError::CANNOT_ASSIGN_COLUMN_OF_DIFFERENT_TYPE, m_data, TableColumn::m_sHeadLine, TableColumn::m_type, TableColumn::setValue(), TableColumn::TYPE_VALUE, and TableColumn::typeToString().

Here is the call graph for this function:

◆ insertElements()

void ValueColumn::insertElements ( size_t  pos,
size_t  elem 
)
overridevirtual

Inserts as many as the selected elements at the desired position, if the column is already larger than the starting position.

Parameters
possize_t
elemsize_t
Returns
void

Implements TableColumn.

Definition at line 243 of file tablecolumnimpl.cpp.

References m_data.

◆ isValid()

bool ValueColumn::isValid ( int  elem) const
overridevirtual

Returns true, if the selected element is a valid value.

Parameters
elemint
Returns
bool

Implements TableColumn.

Definition at line 329 of file tablecolumnimpl.cpp.

References mu::isnan(), and m_data.

Here is the call graph for this function:

◆ removeElements()

void ValueColumn::removeElements ( size_t  pos,
size_t  elem 
)
overridevirtual

Removes the selected number of elements from the column and moving all following items forward.

Parameters
possize_t
elemsize_t
Returns
void

Implements TableColumn.

Definition at line 273 of file tablecolumnimpl.cpp.

References m_data.

◆ resize()

void ValueColumn::resize ( size_t  elem)
overridevirtual

Resizes the internal array.

Parameters
elemsize_t
Returns
void

Implements TableColumn.

Definition at line 287 of file tablecolumnimpl.cpp.

References m_data.

Referenced by ValueColumn().

◆ setValue() [1/2]

void ValueColumn::setValue ( size_t  elem,
const mu::value_type vValue 
)
overridevirtual

Set a single numerical value.

Parameters
elemsize_t
vValueconst mu::value_type&
Returns
void

Implements TableColumn.

Definition at line 127 of file tablecolumnimpl.cpp.

References mu::isnan(), and m_data.

Here is the call graph for this function:

◆ setValue() [2/2]

void ValueColumn::setValue ( size_t  elem,
const std::string &  sValue 
)
overridevirtual

Set a single string value.

Parameters
elemsize_t
sValueconst std::string&
Returns
void

Implements TableColumn.

Definition at line 110 of file tablecolumnimpl.cpp.

References CONVTYPE_VALUE, isConvertible(), setValue(), SyntaxError::STRING_ERROR, StrToCmplx(), and toInternalString().

Referenced by setValue().

Here is the call graph for this function:

◆ size()

virtual size_t ValueColumn::size ( ) const
inlineoverridevirtual

Return the number of elements in this column (will also count invalid ones).

Returns
size_t

Implements TableColumn.

Definition at line 102 of file tablecolumnimpl.hpp.

References m_data.

Referenced by copy(), deleteElements(), and getBytes().

Member Data Documentation

◆ m_data


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