Alexandria  2.16
Please provide a description of the project.
Row.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2020 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
25 #ifndef TABLE_ROW_H
26 #define TABLE_ROW_H
27 
28 #include <memory>
29 #include <vector>
30 #include <string>
31 #include <iterator>
32 #include <boost/variant.hpp>
33 
34 #include "ElementsKernel/Export.h"
35 
36 #include "Table/ColumnInfo.h"
37 #include "NdArray/NdArray.h"
38 
39 namespace std {
40 
41 template <typename T>
42 std::ostream& operator<< (std::ostream& s, const std::vector<T>& v);
43 
44 }
45 
46 namespace Euclid {
47 namespace Table {
48 
65 
66 public:
67 
69  typedef boost::variant<bool,
70  int32_t,
71  int64_t,
72  float,
73  double,
74  std::string,
75  std::vector<bool>,
76  std::vector<int32_t>,
77  std::vector<int64_t>,
78  std::vector<float>,
79  std::vector<double>,
85 
86  typedef std::vector<cell_type>::const_iterator const_iterator;
87 
110  Row(std::vector<cell_type> values, std::shared_ptr<ColumnInfo> column_info);
111 
113  virtual ~Row() = default;
114 
121  std::shared_ptr<ColumnInfo> getColumnInfo() const;
122 
129  size_t size() const;
130 
140  const cell_type& operator[](const size_t index) const;
141 
151  const cell_type& operator[](const std::string& column) const;
152 
159  const_iterator begin() const;
160 
167  const_iterator end() const;
168 
169 private:
170  std::vector<cell_type> m_values;
171  std::shared_ptr<ColumnInfo> m_column_info;
172 };
173 
174 }
175 } // end of namespace Euclid
176 
177 #endif /* TABLE_ROW_H */
178 
std::vector< cell_type > m_values
Definition: Row.h:170
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.
Definition: Row.h:84
STL namespace.
std::vector< cell_type >::const_iterator const_iterator
Definition: Row.h:86
std::shared_ptr< ColumnInfo > m_column_info
Definition: Row.h:171
#define ELEMENTS_API
Represents one row of a Table.
Definition: Row.h:64