20 #ifndef GEOS_COMMON_FORMAT_TABLE_TABLEDATA_HPP
21 #define GEOS_COMMON_FORMAT_TABLE_TABLEDATA_HPP
25 #include "common/format/Format.hpp"
41 template<
typename ... Args >
42 void addRow( Args
const & ... args );
48 void addRow( std::vector< string >
const & row );
69 std::vector< std::vector< string > > m_rows;
72 std::vector< string > m_errorsMsg;
105 template<
typename T >
146 std::map< RowType, std::map< ColumnType, string > > m_data;
149 std::set< real64 > m_columnValues;
152 template<
typename ... Args >
155 std::vector< string > m_cellsValue;
157 static_assert( has_formatter_v< decltype(args) >,
"Argument passed in addRow cannot be converted to string" );
158 string const cellValue = GEOS_FMT(
"{}", args );
159 m_cellsValue.push_back( cellValue );
165 template<
typename T >
168 static_assert( has_formatter_v< decltype(value) >,
"Argument passed in addCell cannot be converted to string" );
169 m_columnValues.insert( columnValue );
170 m_data[rowValue][columnValue] = GEOS_FMT(
"{}", value );
Enumerates the Units that are in use in GEOS and regroups useful conversion and formatting functions.
Unit
Enumerator of available unit types. Units are in SI by default.
Class for managing 2D table m_data.
real64 RowType
Type real64 for a row.
TableData2D::TableDataHolder convertTable2D(arrayView1d< real64 const > const values, units::Unit const valueUnit, ArrayOfArraysView< real64 const > const coordinates, string_view rowAxisDescription, string_view columnAxisDescription)
void addCell(RowType rowValue, ColumnType columnValue, T const &value)
Add a cell to the table. If necessary, create automatically the containing column & row.
void collectTableValues(arraySlice1d< real64 const > rowAxisValues, arraySlice1d< real64 const > columnAxisValues, arrayView1d< real64 const > values)
Collects all the values needed to build the table.
TableDataHolder buildTableData(string_view dataDescription, string_view rowFmt="{}", string_view columnFmt="{}") const
real64 ColumnType
Type real64 for a column.
Class for managing table data.
void clear()
Reset data in the table.
std::vector< std::vector< string > > const & getTableDataRows() const
void addRow(Args const &... args)
Add a row to the table. The values passed to addRow (can be any type).
std::vector< string > const & getErrorMsgs() const
Get all error messages.
void addRow(std::vector< string > const &row)
Add a row to the table.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
LvArray::ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, LvArray::ChaiBuffer > ArrayOfArraysView
View of array of variable-sized arrays. See LvArray::ArrayOfArraysView for details.
double real64
64-bit floating point type.
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
std::string_view string_view
String type.
Struct containing conversion informations.
TableData tableData
TableData to be built.
std::vector< string > headerNames