diff options
author | DaMichel <mw.pub@welter-4d.de> | 2016-07-30 17:52:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-30 17:52:51 +0200 |
commit | ae51598b329f7120c6ee07e2ed127a607ff68f1e (patch) | |
tree | 5530cadb7f2cd5794b06510a77a131924c6bb8a5 /opentrack-logic/tracklogger.hpp | |
parent | c346bb024b2a109debf59774eb96971d32a528ae (diff) | |
parent | 44428d4b5eeae78fd9cdedce840f7de2ddc6c6b2 (diff) |
Merge pull request #398 from DaMichel/logging
Track Logging
Diffstat (limited to 'opentrack-logic/tracklogger.hpp')
-rw-r--r-- | opentrack-logic/tracklogger.hpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/opentrack-logic/tracklogger.hpp b/opentrack-logic/tracklogger.hpp new file mode 100644 index 00000000..65128d48 --- /dev/null +++ b/opentrack-logic/tracklogger.hpp @@ -0,0 +1,53 @@ +#pragma once +#include "main-settings.hpp" +#include "opentrack-compat/options.hpp" + +#include <fstream> +#include <QString> +#include <QMessageBox> +#include <QWidget> + +class OPENTRACK_LOGIC_EXPORT TrackLogger +{ +public: + TrackLogger() + { + } + + virtual void write(const char *) + { + } + + virtual void write(const double *, int n) + { + } + + virtual void next_line() + { + } + + void write_pose(const double *p) + { + write(p, 6); + } +}; + + +class OPENTRACK_LOGIC_EXPORT TrackLoggerCSV : public TrackLogger +{ + std::ofstream out; + bool first_col; + inline void handle_first_col_sep(); +public: + TrackLoggerCSV(const QString &filename) : TrackLogger(), + first_col(true) + { + out.open(filename.toStdString()); + } + + bool is_open() const { return out.is_open(); } + virtual void write(const char *s); + virtual void write(const double *p, int n); + virtual void next_line(); +}; + |