Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
TableColumn Class Reference

Used to represent the data stored in a table column. More...

#include <Table.hpp>

Public Types

enum class  DataType {
  Float , Integer , String , Boolean ,
  Undefined
}
 Used in the identification of the value type along each column in the table. More...
 

Public Member Functions

 TableColumn ()
 Construct a default TableColumn object.
 
auto appendFloat (double value) -> void
 Append a new floating-point value to the TableColumn object. More...
 
auto appendInteger (long value) -> void
 Append a new integer value to the TableColumn object. More...
 
auto appendString (String const &value) -> void
 Append a new string value to the TableColumn object. More...
 
auto appendBoolean (bool value) -> void
 Append a new boolean value to the TableColumn object. More...
 
auto dataType () const -> DataType
 Get the data type of the column.
 
auto floats () const -> Deque< double > const &
 Convert this TableColumn object to a constant reference to its underlying Deque<double> object. More...
 
auto floats () -> Deque< double > &
 Convert this TableColumn object to a mutable reference to its underlying Deque<double> object. More...
 
auto integers () const -> Deque< long > const &
 Convert this TableColumn object to a constant reference to its underlying Deque<long> object. More...
 
auto integers () -> Deque< long > &
 Convert this TableColumn object to a mutable reference to its underlying Deque<long> object. More...
 
auto strings () const -> Deque< String > const &
 Convert this TableColumn object to a constant reference to its underlying Deque<String> object. More...
 
auto strings () -> Deque< String > &
 Convert this TableColumn object to a mutable reference to its underlying Deque<String> object. More...
 
auto booleans () const -> Deque< bool > const &
 Convert this TableColumn object to a constant reference to its underlying Deque<bool> object. More...
 
auto booleans () -> Deque< bool > &
 Convert this TableColumn object to a mutable reference to its underlying Deque<bool> object. More...
 
auto rows () const -> Index
 Get the number of rows in the column.
 
auto operator[] (Index row) const -> std::variant< double, long, String, bool >
 Get the value stored in the column at the given row index.
 
template<typename T >
auto append (T const &value) -> void
 Append a new value to the TableColumn object. More...
 
auto append (Chars value) -> void
 Append a new string value to the TableColumn object.
 
template<typename T >
auto operator<< (T const &value) -> TableColumn &
 Append a new value to the TableColumn object. More...
 
auto operator<< (Chars value) -> TableColumn &
 Append a new string value to the TableColumn object.
 
template<typename T >
auto cast () -> Deque< T > &
 Cast this TableColumn object to a mutable reference to a list of values with type compatible with given one.
 
template<typename T >
auto cast () const -> Deque< T > const &
 Cast this TableColumn object to a constant reference to a list of values with type compatible with given one.
 

Detailed Description

Used to represent the data stored in a table column.

See also
Table

Member Enumeration Documentation

◆ DataType

enum DataType
strong

Used in the identification of the value type along each column in the table.

Enumerator
Float 

The column data type indicating a double floating-point value value.

Integer 

The column data type indicating an integer value.

String 

The column data type indicating a string value.

Boolean 

The column data type indicating a boolean value.

Undefined 

The column data type has not been specified yet.

Member Function Documentation

◆ appendFloat()

auto appendFloat ( double  value) -> void

Append a new floating-point value to the TableColumn object.

Warning
By appending a floating-point value, the column data type must be DataType::Float, otherwise a runtime error is thrown.

◆ appendInteger()

auto appendInteger ( long  value) -> void

Append a new integer value to the TableColumn object.

Warning
By appending a integer value, the column data type must be DataType::Integer, otherwise a runtime error is thrown.

◆ appendString()

auto appendString ( String const &  value) -> void

Append a new string value to the TableColumn object.

Warning
By appending a string value, the column data type must be DataType::String, otherwise a runtime error is thrown.

◆ appendBoolean()

auto appendBoolean ( bool  value) -> void

Append a new boolean value to the TableColumn object.

Warning
By appending a boolean value, the column data type must be DataType::Bool, otherwise a runtime error is thrown.

◆ floats() [1/2]

auto floats ( ) const -> Deque< double > const &

Convert this TableColumn object to a constant reference to its underlying Deque<double> object.

Warning
If the column data type is not DataType::Float, a runtime error is thrown.

◆ floats() [2/2]

auto floats ( ) -> Deque< double > &

Convert this TableColumn object to a mutable reference to its underlying Deque<double> object.

Warning
If the column data type is not DataType::Float, a runtime error is thrown.

◆ integers() [1/2]

auto integers ( ) const -> Deque< long > const &

Convert this TableColumn object to a constant reference to its underlying Deque<long> object.

Warning
If the column data type is not DataType::Integer, a runtime error is thrown.

◆ integers() [2/2]

auto integers ( ) -> Deque< long > &

Convert this TableColumn object to a mutable reference to its underlying Deque<long> object.

Warning
If the column data type is not DataType::Integer, a runtime error is thrown.

◆ strings() [1/2]

auto strings ( ) const -> Deque< String > const &

Convert this TableColumn object to a constant reference to its underlying Deque<String> object.

Warning
If the column data type is not DataType::String, a runtime error is thrown.

◆ strings() [2/2]

auto strings ( ) -> Deque< String > &

Convert this TableColumn object to a mutable reference to its underlying Deque<String> object.

Warning
If the column data type is not DataType::String, a runtime error is thrown.

◆ booleans() [1/2]

auto booleans ( ) const -> Deque< bool > const &

Convert this TableColumn object to a constant reference to its underlying Deque<bool> object.

Warning
If the column data type is not DataType::Bool, a runtime error is thrown.

◆ booleans() [2/2]

auto booleans ( ) -> Deque< bool > &

Convert this TableColumn object to a mutable reference to its underlying Deque<bool> object.

Warning
If the column data type is not DataType::Bool, a runtime error is thrown.

◆ append()

auto append ( T const &  value) -> void
inline

Append a new value to the TableColumn object.

This method is tolerant of inserting an integer value into a table column of floats. In this case, the integer value is converted to a float.

◆ operator<<()

auto operator<< ( T const &  value) -> TableColumn&
inline

Append a new value to the TableColumn object.

This operator exists for convenience and provides an operation identical to append.


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