Alexandria 2.32.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Row.h
Go to the documentation of this file.
1
18
24
25#ifndef TABLE_ROW_H
26#define TABLE_ROW_H
27
28#include <boost/variant.hpp>
29#include <iterator>
30#include <memory>
31#include <string>
32#include <vector>
33
34#include "ElementsKernel/Export.h"
35
36#include "NdArray/NdArray.h"
37#include "Table/ColumnInfo.h"
38
39namespace Euclid {
40namespace Table {
41
58
59public:
61 using cell_type =
62 boost::variant<bool, int32_t, int64_t, float, double, std::string, std::vector<bool>, std::vector<int32_t>,
65
66 using const_iterator = std::vector<cell_type>::const_iterator;
67
91
93 virtual ~Row() = default;
94
102
109 size_t size() const;
110
120 const cell_type& operator[](const size_t index) const;
121
131 const cell_type& operator[](const std::string& column) const;
132
139 const_iterator begin() const;
140
147 const_iterator end() const;
148
149private:
152};
153
161 explicit cell_stream_adaptor(const Row::cell_type& cell) : m_cell(cell){};
162
164};
165
167
168} // namespace Table
169} // end of namespace Euclid
170
171#endif /* TABLE_ROW_H */
NdArray(std::vector< size_t > shape_)
const_iterator end() const
Returns a const iterator to the past-the-end cell of the row.
Definition Row.cpp:133
std::vector< cell_type > m_values
Definition Row.h:150
std::shared_ptr< ColumnInfo > getColumnInfo() const
Returns a ColumnInfo object describing the columns of the Row.
Definition Row.cpp:106
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< int32_t >, NdArray::NdArray< int64_t >, NdArray::NdArray< float >, NdArray::NdArray< double > > cell_type
The possible cell types.
Definition Row.h:61
const_iterator begin() const
Returns a const iterator to the first cell of the row.
Definition Row.cpp:129
size_t size() const
Returns the number of cells in the row.
Definition Row.cpp:110
std::shared_ptr< ColumnInfo > m_column_info
Definition Row.h:151
virtual ~Row()=default
Default destructor.
Row(std::vector< cell_type > values, std::shared_ptr< ColumnInfo > column_info)
Constructs a Row with the given cell values and column info descriptor.
Definition Row.cpp:72
std::vector< cell_type >::const_iterator const_iterator
Definition Row.h:66
const cell_type & operator[](const size_t index) const
Returns the value of the column with the given index (zero based)
Definition Row.cpp:114
#define ELEMENTS_API
std::ostream & operator<<(std::ostream &s, const cell_stream_adaptor &cell)
Definition Row.cpp:66
const Row::cell_type & m_cell
Definition Row.h:163
cell_stream_adaptor(const Row::cell_type &cell)
Definition Row.h:161