Alexandria
2.16
Please provide a description of the project.
|
Represents one row of a Table. More...
#include <Row.h>
Public Types | |
typedef boost::variant< bool, int32_t, int64_t, float, double, std::string, std::vector< bool > , std::vector< int32_t > , std::vector< int64_t > , std::vector< float > , std::vector< double > , NdArray::NdArray< bool > , NdArray::NdArray< int32_t > , NdArray::NdArray< int64_t > , NdArray::NdArray< float > , NdArray::NdArray< double > > | cell_type |
The possible cell types. More... | |
typedef std::vector< cell_type > ::const_iterator | const_iterator |
Public Member Functions | |
Row (std::vector< cell_type > values, std::shared_ptr< ColumnInfo > column_info) | |
Constructs a Row with the given cell values and column info descriptor. More... | |
virtual | ~Row ()=default |
Default destructor. More... | |
std::shared_ptr< ColumnInfo > | getColumnInfo () const |
Returns a ColumnInfo object describing the columns of the Row. More... | |
size_t | size () const |
Returns the number of cells in the row. More... | |
const cell_type & | operator[] (const size_t index) const |
Returns the value of the column with the given index (zero based) More... | |
const cell_type & | operator[] (const std::string &column) const |
Returns the value of the row for the given column. More... | |
const_iterator | begin () const |
Returns a const iterator to the first cell of the row. More... | |
const_iterator | end () const |
Returns a const iterator to the past-the-end cell of the row. More... | |
Private Attributes | |
std::vector< cell_type > | m_values |
std::shared_ptr< ColumnInfo > | m_column_info |
Represents one row of a Table.
The Row is an immutable class which represents a single row of a Table. It contains one cell for each column, which has a value of one of the types defined in the cell_type boost::variant specialization. The information about the columns can be retrieved via a ColumnInfo object provided by the getColumnInfo() method. The values of the cells, in the case they are of std::string type, they cannot be the empty string, neither a string containing whitespace characters, because these values break the representation of the columns in the ASCII file.
typedef boost::variant<bool, int32_t, int64_t, float, double, std::string, std::vector<bool>, std::vector<int32_t>, std::vector<int64_t>, std::vector<float>, std::vector<double>, NdArray::NdArray<bool>, NdArray::NdArray<int32_t>, NdArray::NdArray<int64_t>, NdArray::NdArray<float>, NdArray::NdArray<double> > Euclid::Table::Row::cell_type |
Euclid::Table::Row::Row | ( | std::vector< cell_type > | values, |
std::shared_ptr< ColumnInfo > | column_info | ||
) |
Constructs a Row with the given cell values and column info descriptor.
The number and type of the cells must match the ones of the columns, otherwise a Elements::Exception is thrown. The column_info cannot be the nullptr and the values of the cells cannot be the empty string or contain any whitespace characters (if they are of type std::string).
values | The values of the row cells |
column_info | The information of the columns |
Elements::Exception | if column_info is null |
Elements::Exception | if the values vector have different size than the number of columns |
Elements::Exception | if the values have different types than the columns |
Elements::Exception | if any of the cell values is the empty string |
Elements::Exception | if any of the cell values contains whitespace characters |
|
virtualdefault |
Default destructor.
Row::const_iterator Euclid::Table::Row::begin | ( | ) | const |
Row::const_iterator Euclid::Table::Row::end | ( | ) | const |
std::shared_ptr< ColumnInfo > Euclid::Table::Row::getColumnInfo | ( | ) | const |
Returns a ColumnInfo object describing the columns of the Row.
Definition at line 103 of file Row.cpp.
References m_column_info.
const Row::cell_type & Euclid::Table::Row::operator[] | ( | const size_t | index | ) | const |
Returns the value of the column with the given index (zero based)
index | The index of the column (zero based) |
Elements::Exception | if the index is out of range |
const Row::cell_type & Euclid::Table::Row::operator[] | ( | const std::string & | column | ) | const |
Returns the value of the row for the given column.
column | The name of the column |
Elements::Exception | if there is no column with such name |
Definition at line 118 of file Row.cpp.
References m_column_info.
size_t Euclid::Table::Row::size | ( | ) | const |
|
private |
Definition at line 171 of file Row.h.
Referenced by getColumnInfo(), and operator[]().
|
private |