6 #ifndef CSV_HPP_INCLUDE
7 #define CSV_HPP_INCLUDE
52 const std::string &format) = 0;
62 std::function<std::string(
double)> format) = 0;
71 virtual void update(
const std::vector<double> &sample) = 0;
79 CSVImp(
const std::string &file_path,
80 const std::string &host_name,
81 const std::string &start_time,
86 void add_column(
const std::string &name)
override;
88 const std::string &format)
override;
90 std::function<std::string(
double)> format)
override;
92 void update(
const std::vector<double> &sample)
override;
93 void flush(
void)
override;
95 void write_header(
const std::string &host_name,
const std::string &start_time);
96 void write_names(
void);
98 const std::map<std::string, std::function<std::string(
double)> > M_NAME_FORMAT_MAP;
99 const char M_SEPARATOR;
100 std::string m_file_path;
101 std::vector<std::string> m_column_name;
102 std::vector<std::function<std::string(
double)> > m_column_format;
103 std::ofstream m_stream;
104 std::ostringstream m_buffer;
105 off_t m_buffer_limit;
CSV class provides the GEOPM interface for creation of character separated value tabular data files....
Definition: CSV.hpp:25
virtual void add_column(const std::string &name)=0
Add a column with the given field name. The formatting of the column values will default to geopm::st...
virtual void add_column(const std::string &name, std::function< std::string(double)> format)=0
Add a column with the given field name. The formatting of the column values is implemented with the f...
virtual void flush(void)=0
Flush all output to the CSV file.
virtual void update(const std::vector< double > &sample)=0
Add a row to the CSV file.
virtual void activate(void)=0
Calling activate indicates that all columns have been added to the object and calls to update() are e...
virtual void add_column(const std::string &name, const std::string &format)=0
Add a column with the given field name. The formatting of the column values chosen based on the forma...
CSVImp(const CSVImp &other)=delete
void add_column(const std::string &name) override
Add a column with the given field name. The formatting of the column values will default to geopm::st...
Definition: CSV.cpp:47
CSVImp(const std::string &file_path, const std::string &host_name, const std::string &start_time, size_t buffer_size)
Definition: CSV.cpp:17
void activate(void) override
Calling activate indicates that all columns have been added to the object and calls to update() are e...
Definition: CSV.cpp:117
void flush(void) override
Flush all output to the CSV file.
Definition: CSV.cpp:101
void update(const std::vector< double > &sample) override
Add a row to the CSV file.
Definition: CSV.cpp:77
virtual ~CSVImp()
Definition: CSV.cpp:42
CSVImp & operator=(const CSVImp &other)=delete
Definition: Accumulator.cpp:12