summaryrefslogtreecommitdiffhomepage
path: root/logic/tracklogger.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-12 18:00:49 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-12 18:00:49 +0200
commit9040b187a1c4fa380f8a12207b9dd6d04b3a10ac (patch)
tree115e1351571d690c1261a9d512e6d44e717f3051 /logic/tracklogger.hpp
parent13a18b149764509a3f460be86590250cdcf690fb (diff)
all: rename modules s#^opentrack-##. and opentrack -> api
Adjust usages.
Diffstat (limited to 'logic/tracklogger.hpp')
-rw-r--r--logic/tracklogger.hpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/logic/tracklogger.hpp b/logic/tracklogger.hpp
new file mode 100644
index 00000000..52ab35bc
--- /dev/null
+++ b/logic/tracklogger.hpp
@@ -0,0 +1,65 @@
+#pragma once
+#include "main-settings.hpp"
+#include "compat/options.hpp"
+#include "compat/timer.hpp"
+
+#include <fstream>
+#include <QString>
+#include <QMessageBox>
+#include <QWidget>
+
+class OPENTRACK_LOGIC_EXPORT TrackLogger
+{
+ TrackLogger(TrackLogger&&) = delete;
+ TrackLogger(const TrackLogger&) = delete;
+ TrackLogger& operator=(const TrackLogger&) = delete;
+ TrackLogger& operator=(TrackLogger&&) = delete;
+
+ Timer t;
+
+public:
+ TrackLogger()
+ {
+ }
+
+ virtual ~TrackLogger();
+
+ virtual void write(const char *)
+ {
+ }
+
+ virtual void write(const double *, int)
+ {
+ }
+
+ virtual void next_line()
+ {
+ }
+
+ void write_pose(const double *p)
+ {
+ write(p, 6);
+ }
+
+ void reset_dt();
+ void write_dt();
+};
+
+
+class OPENTRACK_LOGIC_EXPORT TrackLoggerCSV : public TrackLogger
+{
+ std::ofstream out;
+ bool first_col;
+ inline void handle_first_col_sep();
+public:
+ TrackLoggerCSV(const QString &filename) : first_col(true)
+ {
+ out.open(filename.toStdString());
+ }
+
+ bool is_open() const { return out.is_open(); }
+ void write(const char *s) override;
+ void write(const double *p, int n) override;
+ void next_line() override;
+};
+