27 std::vector<std::vector<T>>
data;
45 LogData(std::string str_name, std::string str_path,
46 std::vector<std::string> signal_names,
int ID,
47 size_t num_of_signals,
size_t num_of_samples,
48 Time* p_time =
nullptr, std::string theAuthor =
"unknown") {
77 T
get(
int i,
int j) {
return data[i][j]; }
84 std::vector<T>
get(
int i) {
return data[i]; }
115 return (std::string)
"0000-00-00 00:00:00";
125 if (p_file ==
nullptr) {
return 0; }
127 if (buf == NULL) { free(buf);
return 0; }
A class for file reading and writing.
Definition: File.h:30
size_t write(void *buf, size_t len)
Write a buffer.
A templated-class for managing logged-data.
Definition: LogData.h:20
Time * time
Variable to store the initial time.
Definition: LogData.h:33
T get(int i, int j)
Get a single sample of a signal.
Definition: LogData.h:77
std::string author
Author of the log.
Definition: LogData.h:32
std::vector< T > get(int i)
Get all samples of a signal.
Definition: LogData.h:84
std::string getDate()
Get the date.
Definition: LogData.h:110
size_t save(File *p_file)
Save the log.
Definition: LogData.h:124
size_t num_samples
Number of logged samples.
Definition: LogData.h:24
std::vector< size_t > samples
Vector of samples.
Definition: LogData.h:28
std::vector< std::vector< T > > data
Vector of vector of type T (i.e. a matrix with num_signals rows and max_num_samples columns)
Definition: LogData.h:27
std::vector< std::string > signals
Vector of signal names.
Definition: LogData.h:29
std::string name
Name of the log.
Definition: LogData.h:30
std::string path
Path of the corresponding log file.
Definition: LogData.h:31
size_t num_signals
Number of logged signals.
Definition: LogData.h:25
bool saved
True if the log has been saved.
Definition: LogData.h:35
LogData(std::string str_name, std::string str_path, std::vector< std::string > signal_names, int ID, size_t num_of_signals, size_t num_of_samples, Time *p_time=nullptr, std::string theAuthor="unknown")
Constructor.
Definition: LogData.h:45
size_t max_num_samples
Max number of logged samples (reserved for vectors).
Definition: LogData.h:26
~LogData()
Destructor.
Definition: LogData.h:67
int push_back(T *packet)
Push data to the log buffer.
Definition: LogData.h:91
std::string getAuthor()
Get author name.
Definition: LogData.h:102
A class to get system time.
Definition: Timepp.h:37
int getData(char *str, size_t len, bool update=true)
Get the current date-time.
Definition: Timepp.h:110