DiFfRG
Loading...
Searching...
No Matches
csv_reader.hh
Go to the documentation of this file.
1#pragma once
2
3// standard library
4#include <memory>
5#include <string>
6
7// external libraries
8#include <rapidcsv.h>
9
10namespace DiFfRG
11{
17 {
18 public:
26 CSVReader(std::string input_file, char separator = ',', bool has_header = false);
27
33 uint n_rows() const;
34
40 uint n_cols() const;
41
49 double value(const std::string &col, const uint row) const;
50
58 double value(const uint col, const uint row) const;
59
60 private:
61 std::string input_file;
62 std::unique_ptr<rapidcsv::Document> document;
63 };
64} // namespace DiFfRG
This class reads a .csv file and allows to access the data.
Definition csv_reader.hh:17
std::string input_file
Definition csv_reader.hh:61
double value(const uint col, const uint row) const
Get the stored value at a given row and column.
uint n_cols() const
Get the number of columns in the .csv file.
uint n_rows() const
Get the number of rows in the .csv file.
double value(const std::string &col, const uint row) const
Get the stored value at a given row and column.
std::unique_ptr< rapidcsv::Document > document
Definition csv_reader.hh:62
CSVReader(std::string input_file, char separator=',', bool has_header=false)
Construct a new External Data Interpolator object.
Definition complex_math.hh:14
unsigned int uint
Definition utils.hh:22