CsvLogger.h
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include <map>
00004 #include <fstream>
00005 #include <string>
00006 #include <memory>
00007 
00008 class CSVLogger
00009 {
00010         typedef std::map<std::string, double> columns_type;
00011 
00012    public:
00013         CSVLogger();
00014         virtual ~CSVLogger();
00015 
00016    public:
00017         void addColumn(std::string name);
00018         void updateColumn(std::string name, double value);
00019         bool writeHeader();
00020         bool writeRow();
00021 
00022         void setFilepath(std::string path) { m_filepath = path; }
00023         bool open();
00024         bool isOpen();
00025         bool close();
00026         bool clear();
00027 
00028         void setRecording(bool recording) { isRecording = recording; }
00029         void newSession();
00030 
00031    private:
00032         columns_type m_columns;
00033         std::shared_ptr<std::ofstream> m_file;
00034         std::string m_filepath;
00035         bool isRecording = false;
00036         unsigned int currentSession = 1;
00037 };


mvsim
Author(s):
autogenerated on Thu Sep 7 2017 09:27:48