Alexandria  2.18
Please provide a description of the project.
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 
27 namespace Euclid {
28 namespace GridContainer {
29 
36 template <typename T>
38  typedef T table_cell_t;
39 
40  static T serialize(T v) {
41  return v;
42  }
43 };
44 
48 template <>
51 
53  return qn.qualifiedName();
54  }
55 };
56 
62 template <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 
89 template <typename T>
90 struct 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 
105 template <typename GridCellManager, typename... AxesTypes>
107 
108 } // end of namespace GridContainer
109 } // end of namespace Euclid
110 
112 
113 #endif // GRIDCONTAINER_GRIDCONTAINERTOTABLE_H
std::is_same
std::string
STL class.
Euclid::GridContainer::GridContainer< GridCellManager, AxesTypes... >
std::vector
STL class.
Euclid::XYDataset::QualifiedName
Represents a name qualified with a set of groups.
Definition: QualifiedName.h:66
Euclid::XYDataset::QualifiedName::qualifiedName
const std::string & qualifiedName() const
Returns the qualified name as a string.
Definition: QualifiedName.cpp:73
Euclid::GridContainer::GridAxisToTable
Definition: GridContainerToTable.h:37
Euclid::GridContainer::GridAxisToTable::table_cell_t
T table_cell_t
Definition: GridContainerToTable.h:38
Euclid::GridContainer::GridCellToTable< T, typename std::enable_if< std::is_arithmetic< T >::value >::type >::addColumnDescriptions
static void addColumnDescriptions(const T &, std::vector< Table::ColumnDescription > &columns)
Definition: GridContainerToTable.h:92
Euclid::GridContainer::GridAxisToTable::serialize
static T serialize(T v)
Definition: GridContainerToTable.h:40
Euclid::GridContainer::GridAxisToTable< Euclid::XYDataset::QualifiedName >::table_cell_t
std::string table_cell_t
Definition: GridContainerToTable.h:50
GridContainer.h
Euclid::GridContainer::GridCellToTable< T, typename std::enable_if< std::is_arithmetic< T >::value >::type >::addCells
static void addCells(const T &c, std::vector< Table::Row::cell_type > &row)
Definition: GridContainerToTable.h:96
GridContainerToTable.icpp
Euclid::GridContainer::GridCellToTable
Definition: GridContainerToTable.h:63
std::vector::emplace_back
T emplace_back(T... args)
Euclid::GridContainer::gridContainerToTable
Table::Table gridContainerToTable(const GridContainer< GridCellManager, AxesTypes... > &grid)
QualifiedName.h
Euclid::GridContainer::GridCellToTable::addCells
static void addCells(const T &c, std::vector< Table::Row::cell_type > &row)
std
STL namespace.
Euclid::GridContainer::GridCellToTable::addColumnDescriptions
static void addColumnDescriptions(const T &c, std::vector< Table::ColumnDescription > &columns)
Euclid::Table::Table
Represents a table.
Definition: Table.h:49
Euclid
Definition: InstOrRefHolder.h:29
Table.h
Euclid::GridContainer::GridAxisToTable< Euclid::XYDataset::QualifiedName >::serialize
static table_cell_t serialize(const Euclid::XYDataset::QualifiedName &qn)
Definition: GridContainerToTable.h:52