CsvLogger.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <fstream>
4 #include <map>
5 #include <memory>
6 #include <string>
7 
8 class CSVLogger
9 {
10  typedef std::map<std::string, double> columns_type;
11 
12  public:
13  CSVLogger();
14  virtual ~CSVLogger();
15 
16  public:
17  void addColumn(std::string name);
18  void updateColumn(std::string name, double value);
19  bool writeHeader();
20  bool writeRow();
21 
22  void setFilepath(std::string path) { m_filepath = path; }
23  bool open();
24  bool isOpen();
25  bool close();
26  bool clear();
27 
28  void setRecording(bool recording) { isRecording = recording; }
29  void newSession();
30 
31  private:
32  columns_type m_columns;
33  std::shared_ptr<std::ofstream> m_file;
34  std::string m_filepath;
35  bool isRecording = false;
36  unsigned int currentSession = 1;
37 };
bool isOpen()
Definition: CsvLogger.cpp:67
void updateColumn(std::string name, double value)
Definition: CsvLogger.cpp:10
GLsizei const GLfloat * value
bool clear()
Definition: CsvLogger.cpp:78
virtual ~CSVLogger()
Definition: CsvLogger.cpp:8
bool close()
Definition: CsvLogger.cpp:68
std::shared_ptr< std::ofstream > m_file
Definition: CsvLogger.h:33
bool open()
Definition: CsvLogger.cpp:55
GLuint const GLchar * name
unsigned int currentSession
Definition: CsvLogger.h:36
void setFilepath(std::string path)
Definition: CsvLogger.h:22
columns_type m_columns
Definition: CsvLogger.h:32
bool isRecording
Definition: CsvLogger.h:35
bool writeHeader()
Definition: CsvLogger.cpp:15
std::string m_filepath
Definition: CsvLogger.h:34
bool writeRow()
Definition: CsvLogger.cpp:33
void setRecording(bool recording)
Definition: CsvLogger.h:28
void newSession()
Definition: CsvLogger.cpp:90
void addColumn(std::string name)
Definition: CsvLogger.cpp:9
std::map< std::string, double > columns_type
Definition: CsvLogger.h:10


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51