-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathCSVLogger.h
More file actions
41 lines (31 loc) · 979 Bytes
/
CSVLogger.h
File metadata and controls
41 lines (31 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef _CSV_LOGGER_H_
#define _CSV_LOGGER_H_
#include <string>
#include "SD_Card_Manager.h"
class CSVLogger {
public:
/**
* @brief Construct a new CSVLogger object
*
* @param path the path where the file should be saved
* @param headers the array of headers of the csv file
* @param header_count the number of columns
* @param separator the separator between the columns
*/
CSVLogger(std::string path, SDCardManager *sd_card, const char **headers, size_t header_count, char separator = ',');
~CSVLogger();
int begin();
int end();
int sync();
int writeLine(const char **data, bool sync = false);
int writeLine(const double *data, bool sync = false);
int writeLine(const int *data, bool sync = false);
private:
std::string file_path;
const char **headers;
size_t header_count;
char separator;
SDCardManager *sd_card;
int write(std::string line, bool sync = false);
};
#endif