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" 
   88   template< 
typename ... Args >
 
   89   void addRow( Args 
const & ... args );
 
  112   { m_errors->clear(); }
 
  152   { 
return *m_errors; }
 
  159   { 
return *m_errors; }
 
  166   std::unique_ptr< geos::TableErrorListing > m_errors;
 
  200   template< 
typename T >
 
  213                            bool columnMajorValues );
 
  230                                                bool columnMajorValues,
 
  251     m_columnValues.clear();
 
  260   std::set< real64 > m_columnValues;
 
  262   std::unique_ptr< geos::TableErrorListing > m_errors = std::make_unique< geos::TableErrorListing >();
 
  269 template< 
typename T >
 
  272 template< 
typename ... Args >
 
  277     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" );
 
  278     if constexpr (std::is_same_v< Args, CellType >) {
 
  279       cells.push_back( { args, 
string() } );
 
  281     else if constexpr (std::is_floating_point_v< std::decay_t< decltype(args) > >) {
 
  282       if( !
getErrorsList().hasErrors() && (std::isnan( args ) ||  std::isinf( args )))
 
  284         m_errors->addError( 
"Warning : Invalid values detected (nan/inf)." );
 
  286       cells.push_back( {CellType::Value, GEOS_FMT( 
"{}", args )} );
 
  290       cells.push_back( {CellType::Value, GEOS_FMT( 
"{}", args )} );
 
  304 template< 
typename T >
 
  307   static_assert( has_formatter_v< decltype(value) >, 
"Argument passed in addCell cannot be converted to string" );
 
  308   m_columnValues.insert( columnValue );
 
  309   m_data.get_inserted( rowValue ).get_inserted( 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 collectTableValues(arrayView1d< real64 const > dim0AxisCoordinates, arrayView1d< real64 const > dim1AxisCoordinates, arrayView1d< real64 const > values, bool columnMajorValues)
Collects all the values needed to build the table.
 
void clear()
Clear all data stored in TableData.
 
void addCell(RowType rowValue, ColumnType columnValue, T const &value)
Add a cell to the table. If necessary, create automatically the containing column & row.
 
TableData2D::TableDataHolder convertTable2D(arrayView1d< real64 const > coordX, arrayView1d< real64 const > coordY, string_view rowAxisDescription, string_view columnAxisDescription, arrayView1d< real64 const > const values, bool columnMajorValues, string_view valueDescription)
Convert from 2D axis/values a structure the information needed to build a TableFormatter.
 
TableDataHolder buildTableData(string_view dataDescription, string_view rowFmt="{}", string_view columnFmt="{}") const
 
real64 ColumnType
Type real64 for a column.
 
Class for managing table data.
 
stdVector< stdVector< CellData > > & getTableDataRows()
 
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.
 
void clearErrors()
Remove all errors.
 
bool operator==(TableData const &comparingTable) const
Comparison operator for data rows.
 
TableErrorListing & getErrorsList()
Get all error messages.
 
void addRow(Args const &... args)
Add a row to the table. The values passed to addRow (can be any type).
 
bool operator<(TableData const &other) const
Lexicographic sorting.
 
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.
 
TableErrorListing const  & getErrorsList() const
Get all error messages.
 
stdVector< stdVector< CellData > > const  & getTableDataRows() const
 
Class for retrieving errors in the table classes.
 
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
 
std::string string
String type.
 
double real64
64-bit floating point type.
 
constexpr bool isCellType
Trait to check is the args is a special type of cell.
 
internal::StdMapWrapper< std::map< Key, T, Compare, Allocator >, USE_STD_CONTAINER_BOUNDS_CHECKING > stdMap
 
CellType
The different type a cell can handle.
 
std::string_view string_view
String type.
 
internal::StdVectorWrapper< T, Allocator, USE_STD_CONTAINER_BOUNDS_CHECKING > stdVector
 
Struct containing conversion informations.
 
stdVector< string > headerNames
 
TableData tableData
TableData to be built.
 
Representing a data in TableData.
 
string value
The cell value.
 
CellType type
The cell type.