diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-12 18:00:49 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-12 18:00:49 +0200 |
commit | 9040b187a1c4fa380f8a12207b9dd6d04b3a10ac (patch) | |
tree | 115e1351571d690c1261a9d512e6d44e717f3051 /logic/tracklogger.cpp | |
parent | 13a18b149764509a3f460be86590250cdcf690fb (diff) |
all: rename modules s#^opentrack-##. and opentrack -> api
Adjust usages.
Diffstat (limited to 'logic/tracklogger.cpp')
-rw-r--r-- | logic/tracklogger.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/logic/tracklogger.cpp b/logic/tracklogger.cpp new file mode 100644 index 00000000..64dda579 --- /dev/null +++ b/logic/tracklogger.cpp @@ -0,0 +1,47 @@ +#include "tracklogger.hpp" +#include "tracker.h" + +TrackLogger::~TrackLogger() {} + +void TrackLogger::reset_dt() +{ + t.start(); +} + +void TrackLogger::write_dt() +{ + const double dt = t.elapsed_seconds(); + write(&dt, 1); +} + +void TrackLoggerCSV::handle_first_col_sep() +{ + if (!first_col) + out.put(','); + first_col = false; +} + +void TrackLoggerCSV::write(const char *s) +{ + handle_first_col_sep(); + out << s; +} + + +void TrackLoggerCSV::write(const double *p, int n) +{ + handle_first_col_sep(); + for (int i = 0; i < n-1; ++i) + { + out << p[i]; + out.put(','); + } + out << p[n-1]; +} + +void TrackLoggerCSV::next_line() +{ + out << std::endl; + first_col = true; +} + |