/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/csv_reader.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/csv_reader.hh Source File
DiFfRG
csv_reader.hh
Go to the documentation of this file.
1#pragma once
2
3// standard library
4#include "rapidcsv.h"
5#include <cstddef>
6#include <memory>
7#include <string>
8
9namespace DiFfRG
10{
16 {
17 public:
25 CSVReader(std::string input_file, char separator = ',', bool has_header = false);
26
32 size_t n_rows() const;
33
39 size_t n_cols() const;
40
48 double value(const std::string &col, const size_t row) const;
49
57 double value(const size_t col, const size_t row) const;
58
59 private:
60 std::string input_file;
61 std::unique_ptr<rapidcsv::Document> document;
62 };
63} // namespace DiFfRG
This class reads a .csv file and allows to access the data.
Definition csv_reader.hh:16
std::string input_file
Definition csv_reader.hh:60
double value(const size_t col, const size_t row) const
Get the stored value at a given row and column.
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.
std::unique_ptr< rapidcsv::Document > document
Definition csv_reader.hh:61
size_t n_rows() const
Get the number of rows in the .csv file.
CSVReader(std::string input_file, char separator=',', bool has_header=false)
Construct a new External Data Interpolator object.
Definition complex_math.hh:10