CSVReader Class Reference#
|
DiFfRG
|
DiFfRG::CSVReader Class Reference
This class reads a .csv file and allows to access the data. More...
#include <csv_reader.hh>
Public Member Functions | |
| CSVReader (std::string input_file, char separator=',', bool has_header=false) | |
| Construct a new External Data Interpolator object. | |
| size_t | n_rows () const |
| Get the number of rows in the .csv file. | |
| size_t | n_cols () const |
| Get the number of columns in the .csv file. | |
| double | value (const std::string &col, const size_t row) const |
| Get the stored value at a given row and column. | |
| double | value (const size_t col, const size_t row) const |
| Get the stored value at a given row and column. | |
Private Attributes | |
| std::string | input_file |
| std::unique_ptr< rapidcsv::Document > | document |
Detailed Description
This class reads a .csv file and allows to access the data.
Constructor & Destructor Documentation
◆ CSVReader()
| DiFfRG::CSVReader::CSVReader | ( | std::string | input_file, |
| char | separator = ',', | ||
| bool | has_header = false ) |
Construct a new External Data Interpolator object.
- Parameters
-
input_file The .csv file to read the data from. separator The separator used in the .csv file. has_header Whether the .csv file has a header.
Member Function Documentation
◆ n_cols()
| size_t DiFfRG::CSVReader::n_cols | ( | ) | const |
Get the number of columns in the .csv file.
- Returns
- uint The number of columns.
◆ n_rows()
| size_t DiFfRG::CSVReader::n_rows | ( | ) | const |
Get the number of rows in the .csv file.
- Returns
- uint The number of rows.
◆ value() [1/2]
| double DiFfRG::CSVReader::value | ( | const size_t | col, |
| const size_t | row ) const |
Get the stored value at a given row and column.
- Parameters
-
col The column from which to get the value. row The row from which to get the value.
- Returns
- double The data.
◆ value() [2/2]
| double DiFfRG::CSVReader::value | ( | const std::string & | col, |
| const size_t | row ) const |
Get the stored value at a given row and column.
- Parameters
-
col The name of the column from which to get the value. row The row from which to get the value.
- Returns
- double The data.
Member Data Documentation
◆ document
|
private |
◆ input_file
|
private |
The documentation for this class was generated from the following file:
- /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/csv_reader.hh
Generated by