blob: d6c3415747c139efe395129627481d29a50d3d43 (
plain)
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
42
43
44
45
|
#pragma once
#include "main-settings.hpp"
#include "options/options.hpp"
#include "compat/timer.hpp"
#include <fstream>
#include <QString>
#include <QDebug>
class OTR_LOGIC_EXPORT TrackLogger
{
Timer t;
public:
TrackLogger() = default;
virtual ~TrackLogger() = default;
virtual void write(const char *) {}
virtual void write(const double *, int) {}
virtual void next_line() {}
void write_pose(const double *p);
void reset_dt();
void write_dt();
};
class OTR_LOGIC_EXPORT TrackLoggerCSV : public TrackLogger
{
std::ofstream out;
bool first_col = true;
inline void handle_first_col_sep();
public:
explicit TrackLoggerCSV(const QString &filename)
{
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;
};
|