Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
GridContainerToTable.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012-2021 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
19#ifndef GRIDCONTAINER_GRIDCONTAINERTOTABLE_H
20#define GRIDCONTAINER_GRIDCONTAINERTOTABLE_H
21
23#include "Table/Table.h"
25#include <vector>
26
27namespace Euclid {
28namespace GridContainer {
29
36template <typename T>
38 typedef T table_cell_t;
39
40 static T serialize(T v) {
41 return v;
42 }
43};
44
48template <>
56
62template <typename T, typename Enable = void>
64 static_assert(!std::is_same<T, T>::value, "Specialization of GridCellToTable required");
65
75
83 static void addCells(const T& c, std::vector<Table::Row::cell_type>& row);
84};
85
89template <typename T>
90struct GridCellToTable<T, typename std::enable_if<std::is_arithmetic<T>::value>::type> {
91
93 columns.emplace_back("value", typeid(T));
94 }
95
96 static void addCells(const T& c, std::vector<Table::Row::cell_type>& row) {
97 row.emplace_back(c);
98 }
99};
100
105template <typename GridCellManager, typename... AxesTypes>
107
108} // end of namespace GridContainer
109} // end of namespace Euclid
110
112
113#endif // GRIDCONTAINER_GRIDCONTAINERTOTABLE_H
Representation of a multi-dimensional grid which contains axis information.
Represents a table.
Definition Table.h:49
Represents a name qualified with a set of groups.
const std::string & qualifiedName() const
Returns the qualified name as a string.
T emplace_back(T... args)
Table::Table gridContainerToTable(const GridContainer< GridCellManager, AxesTypes... > &grid)
STL namespace.
static table_cell_t serialize(const Euclid::XYDataset::QualifiedName &qn)
static void addColumnDescriptions(const T &, std::vector< Table::ColumnDescription > &columns)
static void addCells(const T &c, std::vector< Table::Row::cell_type > &row)
static void addColumnDescriptions(const T &c, std::vector< Table::ColumnDescription > &columns)