This class reads a .csv file and allows to access the data.
More...
#include <csv_reader.hh>
|
| CSVReader (std::string input_file, char separator=',', bool has_header=false) |
| Construct a new External Data Interpolator object.
|
|
uint | n_rows () const |
| Get the number of rows in the .csv file.
|
|
uint | n_cols () const |
| Get the number of columns in the .csv file.
|
|
double | value (const std::string &col, const uint row) const |
| Get the stored value at a given row and column.
|
|
double | value (const uint col, const uint row) const |
| Get the stored value at a given row and column.
|
|
This class reads a .csv file and allows to access the data.
◆ 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. |
◆ n_cols()
uint DiFfRG::CSVReader::n_cols |
( |
| ) |
const |
Get the number of columns in the .csv file.
- Returns
- uint The number of columns.
◆ n_rows()
uint 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 std::string & | col, |
|
|
const uint | 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.
◆ value() [2/2]
double DiFfRG::CSVReader::value |
( |
const uint | col, |
|
|
const uint | 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.
◆ document
std::unique_ptr<rapidcsv::Document> DiFfRG::CSVReader::document |
|
private |
◆ input_file
std::string DiFfRG::CSVReader::input_file |
|
private |
The documentation for this class was generated from the following file:
- /home/runner/work/DiFfRG/DiFfRG/DiFfRG/include/DiFfRG/common/csv_reader.hh