19#ifndef TABLECOLUMNIMPL_HPP
20#define TABLECOLUMNIMPL_HPP
66 virtual void setValue(
size_t elem,
const std::string& sValue)
override;
77 virtual void resize(
size_t elem)
override;
79 virtual int compare(
int i,
int j,
bool unused)
const override;
80 virtual bool isValid(
int elem)
const override;
81 virtual bool asBool(
int elem)
const override;
102 virtual size_t size()
const override
150 virtual void setValue(
size_t elem,
const std::string& sValue)
override;
161 virtual void resize(
size_t elem)
override;
163 virtual int compare(
int i,
int j,
bool unused)
const override;
164 virtual bool isValid(
int elem)
const override;
165 virtual bool asBool(
int elem)
const override;
186 virtual size_t size()
const override
241 virtual void setValue(
size_t elem,
const std::string& sValue)
override;
252 virtual void resize(
size_t elem)
override;
254 virtual int compare(
int i,
int j,
bool unused)
const override;
255 virtual bool isValid(
int elem)
const override;
256 virtual bool asBool(
int elem)
const override;
277 virtual size_t size()
const override
325 virtual void setValue(
size_t elem,
const std::string& sValue)
override;
336 virtual void resize(
size_t elem)
override;
338 virtual int compare(
int i,
int j,
bool caseinsensitive)
const override;
339 virtual bool isValid(
int elem)
const override;
340 virtual bool asBool(
int elem)
const override;
342 virtual size_t getBytes()
const override;
351 virtual size_t size()
const override
402 virtual void setValue(
size_t elem,
const std::string& sValue)
override;
413 virtual void resize(
size_t elem)
override;
415 virtual int compare(
int i,
int j,
bool caseinsensitive)
const override;
416 virtual bool isValid(
int elem)
const override;
417 virtual bool asBool(
int elem)
const override;
419 virtual size_t getBytes()
const override;
428 virtual size_t size()
const override
448 void setCategories(
const std::vector<std::string>& vCategories);
A table column containing categorical values.
virtual std::string getValueAsInternalString(size_t elem) const override
Returns the contents as an internal string (i.e. without quotation marks).
CategoricalColumn()
Default constructor. Sets only the column's type.
virtual bool asBool(int elem) const override
Interprets the value as a boolean.
virtual void assign(const TableColumn *column) override
Assign another TableColumn's contents to this table column.
virtual size_t getBytes() const override
Calculates the number of bytes occupied by this column.
virtual void removeElements(size_t pos, size_t elem)
Removes the selected number of elements from the column and moving all following items forward.
std::vector< std::string > m_categories
virtual mu::value_type getValue(size_t elem) const override
Returns always NaN, because this conversion is not possible.
virtual std::string getValueAsParserString(size_t elem) const override
Returns the contents as parser string (i.e. with quotation marks).
virtual void insertElements(size_t pos, size_t elem)
Inserts as many as the selected elements at the desired position, if the column is already larger tha...
virtual void resize(size_t elem) override
Resizes the internal array.
virtual void setValue(size_t elem, const std::string &sValue) override
Set a single string value.
void setCategories(const std::vector< std::string > &vCategories)
Replaces the internal categories with new categories.
virtual std::string getValueAsString(size_t elem) const override
Returns the selected value or an empty string, if the value does not exist.
virtual void insert(const VectorIndex &idx, const TableColumn *column) override
Insert the contents of the passed column at the specified positions.
virtual void deleteElements(const VectorIndex &idx) override
Delete the specified elements.
virtual int compare(int i, int j, bool caseinsensitive) const override
Returns 0, if both elements are equal, -1 if element i is smaller than element j and 1 otherwise.
virtual ~CategoricalColumn()
virtual size_t size() const override
Returns the number of elements in this column (will also count invalid ones).
virtual std::string getValueAsStringLiteral(size_t elem) const override
Returns the contents as parser string (i.e. with quotation marks).
CategoricalColumn(size_t nElem)
Generalized constructor. Will prepare a column with the specified size.
virtual bool isValid(int elem) const override
Returns true, if the selected element is a valid value.
std::vector< int > m_data
virtual TableColumn * convert(ColumnType type=TableColumn::TYPE_NONE) override
Returns the contents of this column converted to the new column type. Might even return itself.
const std::vector< std::string > & getCategories() const
Returns the list of internal categories to be used within expressions and code.
virtual void appendElements(size_t elem)
Appends the number of elements.
A table column containing numerical values formatted as dates and times.
DateTimeColumn(size_t nElem)
Generalized constructor. Will prepare a column with the specified size.
virtual size_t size() const override
Return the number of elements in this column (will also count invalid ones).
virtual bool isValid(int elem) const override
Returns true, if the selected element is a valid value.
virtual std::string getValueAsStringLiteral(size_t elem) const override
Returns the contents as parser string (i.e. with quotation marks).
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.
virtual void setValue(size_t elem, const std::string &sValue) override
Set a single string value.
virtual bool asBool(int elem) const override
Interprets the value as a boolean.
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 tha...
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.
virtual size_t getBytes() const override
Return the number of bytes occupied by this column.
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.
virtual TableColumn * convert(ColumnType type=TableColumn::TYPE_NONE) override
Returns the contents of this column converted to the new column type. Might even return itself.
virtual std::string getValueAsInternalString(size_t elem) const override
Returns the contents as an internal string (i.e. without quotation marks).
DateTimeColumn()
Default constructor. Sets only the column's type.
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.
virtual void resize(size_t elem) override
Resizes the internal array.
std::vector< double > m_data
virtual void insert(const VectorIndex &idx, const TableColumn *column) override
Insert the contents of the passed column at the specified positions.
virtual void appendElements(size_t elem) override
Appends the number of elements.
virtual std::string getValueAsParserString(size_t elem) const override
Returns the contents as parser string (i.e. with quotation marks).
virtual void assign(const TableColumn *column) override
Assign another TableColumn's contents to this table column.
virtual void deleteElements(const VectorIndex &idx) override
Delete the specified elements.
virtual ~DateTimeColumn()
A table column containing logical values.
virtual std::string getValueAsInternalString(size_t elem) const override
Returns the contents as an internal string (i.e. without quotation marks).
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.
virtual void insert(const VectorIndex &idx, const TableColumn *column) override
Insert the contents of the passed column at the specified positions.
virtual std::string getValueAsStringLiteral(size_t elem) const override
Returns the contents as parser string (i.e. without quotation marks).
virtual void appendElements(size_t elem) override
Appends the number of elements.
virtual TableColumn * convert(ColumnType type=TableColumn::TYPE_NONE) override
Returns the contents of this column converted to the new column type. Might even return itself.
virtual void setValue(size_t elem, const std::string &sValue) override
Set a single string value.
virtual std::string getValueAsParserString(size_t elem) const override
Returns the contents as parser string (i.e. without quotation marks).
virtual void assign(const TableColumn *column) override
Assign another TableColumn's contents to this table column.
virtual bool asBool(int elem) const override
Interprets the value as a boolean.
virtual size_t size() const override
Return the number of elements in this column (will also count invalid ones).
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.
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 tha...
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.
LogicalColumn(size_t nElem)
Generalized constructor. Will prepare a column with the specified size.
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.
virtual void deleteElements(const VectorIndex &idx) override
Delete the specified elements.
virtual size_t getBytes() const override
Return the number of bytes occupied by this column.
virtual void resize(size_t elem) override
Resizes the internal array.
LogicalColumn()
Default constructor. Sets only the column's type.
virtual bool isValid(int elem) const override
Returns true, if the selected element is a valid value.
std::vector< LogicalValue > m_data
A table column containing only strings as values.
virtual std::string getValueAsString(size_t elem) const override
Returns the selected value or an empty string, if the value does not exist.
virtual std::string getValueAsStringLiteral(size_t elem) const override
Returns the contents as parser string (i.e. with quotation marks).
virtual bool asBool(int elem) const override
Interprets the value as a boolean.
virtual std::string getValueAsParserString(size_t elem) const override
Returns the contents as parser string (i.e. with quotation marks).
virtual void insertElements(size_t pos, size_t elem)
Inserts as many as the selected elements at the desired position, if the column is already larger tha...
StringColumn(size_t nElem)
Generalized constructor. Will prepare a column with the specified size.
virtual void deleteElements(const VectorIndex &idx) override
Delete the specified elements.
virtual size_t size() const override
Returns the number of elements in this column (will also count invalid ones).
virtual std::string getValueAsInternalString(size_t elem) const override
Returns the contents as an internal string (i.e. without quotation marks).
virtual int compare(int i, int j, bool caseinsensitive) const override
Returns 0, if both elements are equal, -1 if element i is smaller than element j and 1 otherwise.
virtual bool isValid(int elem) const override
Returns true, if the selected element is a valid value.
std::vector< std::string > m_data
StringColumn()
Default constructor. Sets only the column's type.
virtual size_t getBytes() const override
Calculates the number of bytes occupied by this column.
virtual void resize(size_t elem) override
Resizes the internal array.
virtual void appendElements(size_t elem)
Appends the number of elements.
virtual mu::value_type getValue(size_t elem) const override
Returns always NaN, because this conversion is not possible.
virtual TableColumn * convert(ColumnType type=TableColumn::TYPE_NONE) override
Returns the contents of this column converted to the new column type. Might even return itself.
virtual void setValue(size_t elem, const std::string &sValue) override
Set a single string value.
virtual void insert(const VectorIndex &idx, const TableColumn *column) override
Insert the contents of the passed column at the specified positions.
virtual void assign(const TableColumn *column) override
Assign another TableColumn's contents to this table column.
virtual void removeElements(size_t pos, size_t elem)
Removes the selected number of elements from the column and moving all following items forward.
A table column containing only numerical values.
virtual bool asBool(int elem) const override
Interprets the value as a boolean.
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.
virtual void deleteElements(const VectorIndex &idx) override
Delete the specified elements.
virtual void appendElements(size_t elem) override
Appends the number of elements.
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.
ValueColumn()
Default constructor. Sets only the type of the column.
ValueColumn(size_t nElem)
Generalized constructor. Will prepare a column with the specified size.
virtual size_t getBytes() const override
Return the number of bytes occupied by this column.
virtual std::string getValueAsParserString(size_t elem) const override
Returns the contents as parser string (i.e. without quotation marks).
virtual TableColumn * convert(ColumnType type=TableColumn::TYPE_NONE) override
Returns the contents of this column converted to the new column type. Might even return itself.
virtual std::string getValueAsStringLiteral(size_t elem) const override
Returns the contents as parser string (i.e. without quotation marks).
std::vector< mu::value_type > m_data
virtual void setValue(size_t elem, const std::string &sValue) override
Set a single string value.
virtual void insert(const VectorIndex &idx, const TableColumn *column) override
Insert the contents of the passed column at the specified positions.
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 tha...
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.
virtual std::string getValueAsInternalString(size_t elem) const override
Returns the contents as an internal string (i.e. without quotation marks).
virtual bool isValid(int elem) const override
Returns true, if the selected element is a valid value.
virtual size_t size() const override
Return the number of elements in this column (will also count invalid ones).
virtual void resize(size_t elem) override
Resizes the internal array.
virtual void assign(const TableColumn *column) override
Assign another TableColumn's contents to this table column.
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.
This class abstracts all the index logics, i.e. the logical differences between single indices and in...
MUP_BASETYPE value_type
The numeric datatype used by the parser.
Abstract table column, which allows using it to compose the data table in each Memory instance.
TableColumn * copy() const
Simplification wrapper around the indiced copy method to copy the whole column.
std::unique_ptr< TableColumn > TblColPtr
Typedef for simplifying the usage of a smart pointer in combination with a TableColumn instance.
void convert_for_overwrite(TblColPtr &col, size_t colNo, TableColumn::ColumnType type)
This function deletes the contents of a column, if necessary, and creates a new column with the corre...
void convert_if_empty(TblColPtr &col, size_t colNo, TableColumn::ColumnType type)
Tries to convert a column if the column does not contain any data (with the exception of the header).
bool convert_if_needed(TblColPtr &col, size_t colNo, TableColumn::ColumnType type)
Tries to convert a column into the selected column, if possible.