20 #ifndef GEOS_COMMON_FORMAT_TABLE_TABLEDATA_HPP
21 #define GEOS_COMMON_FORMAT_TABLE_TABLEDATA_HPP
25 #include "common/format/Format.hpp"
26 #include "TableTypes.hpp"
67 template<
typename ... Args >
68 void addRow( Args
const & ... args );
151 template<
typename T >
164 bool columnMajorValues );
179 bool columnMajorValues,
196 std::map< RowType, std::map< ColumnType, string > > m_data;
199 std::set< real64 > m_columnValues;
206 template<
typename T >
209 template<
typename ... Args >
214 static_assert( has_formatter_v< decltype(args) > ||
isCellType< std::decay_t< decltype(args) > >,
"Argument passed in addRow cannot be converted to string nor a CellType" );
215 if constexpr (std::is_same_v< Args, CellType >) {
216 cells.push_back( { args,
string() } );
220 cells.push_back( {CellType::Value, GEOS_FMT(
"{}", args )} );
226 template<
typename T >
229 static_assert( has_formatter_v< decltype(value) >,
"Argument passed in addCell cannot be converted to string" );
230 m_columnValues.insert( columnValue );
231 m_data[rowValue][columnValue] = GEOS_FMT(
"{}", value );
Enumerates the Units that are in use in GEOS and regroups useful conversion and formatting functions.
Class for managing 2D table m_data.
real64 RowType
Type real64 for a row.
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 > dim0AxisCoordinates, arraySlice1d< real64 const > dim1AxisCoordinates, arrayView1d< real64 const > values, bool columnMajorValues)
Collects all the values needed to build the table.
TableDataHolder buildTableData(string_view dataDescription, string_view rowFmt="{}", string_view columnFmt="{}") const
TableData2D::TableDataHolder convertTable2D(ArrayOfArraysView< real64 const > const coordinates, string_view rowAxisDescription, string_view columnAxisDescription, arrayView1d< real64 const > const values, bool columnMajorValues, string_view valueDescription)
real64 ColumnType
Type real64 for a column.
Class for managing table data.
DataRows const & getCellsData() const
stdVector< string > const & getErrorMsgs() const
Get all error messages.
void clear()
Reset data in the table.
void addRow(stdVector< CellData > const &row)
Add a row to the table.
bool operator==(TableData const &comparingTable) const
Comparison operator for data rows.
void addRow(Args const &... args)
Add a row to the table. The values passed to addRow (can be any type).
void addSeparator()
Add a line separator to the table You must have filled values in TableData before using it.
stdVector< stdVector< CellData > > DataRows
Alias for table data rows with cells values.
stdVector< stdVector< CellData > > const & getTableDataRows() const
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
std::string string
String type.
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.
constexpr bool isCellType
Trait to check is the args is a special type of cell.
ArraySlice< T, 1, USD > arraySlice1d
Alias for 1D array slice.
std::vector< T, Allocator > stdVector
CellType
The different type a cell can handle.
std::string_view string_view
String type.
Struct containing conversion informations.
stdVector< string > headerNames
TableData tableData
TableData to be built.
Representing a data in TableData.
bool operator==(CellData const &other) const
Comparison operator for cell value.
string value
The cell value.
CellType type
The cell type.