summaryrefslogtreecommitdiffhomepage
path: root/logic
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-06-20 18:45:59 +0200
committerStanislaw Halik <sthalik@misaki.pl>2019-06-20 18:47:20 +0200
commitc1be0706d4872f31bcc09c0963c7602ac19f8c76 (patch)
treef66a4c525eb522447d543429a5c026c9325d9b1f /logic
parent74ce228b1e3e756174c2e75579bfe500701ee570 (diff)
logic/work: const correctness
Diffstat (limited to 'logic')
-rw-r--r--logic/mappings.hpp2
-rw-r--r--logic/pipeline.cpp4
-rw-r--r--logic/pipeline.hpp6
-rw-r--r--logic/tracklogger.hpp3
-rw-r--r--logic/work.cpp6
-rw-r--r--logic/work.hpp4
6 files changed, 13 insertions, 12 deletions
diff --git a/logic/mappings.hpp b/logic/mappings.hpp
index 726b0916..be7dd3a2 100644
--- a/logic/mappings.hpp
+++ b/logic/mappings.hpp
@@ -33,8 +33,6 @@ public:
Map& operator()(int i) { return axes[i]; }
const Map& operator()(int i) const { return axes[i]; }
- Map& operator()(unsigned i) { return axes[i]; }
- const Map& operator()(unsigned i) const { return axes[i]; }
template<typename f> void forall(f&& fun)
{
diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp
index 65699287..809a8ce8 100644
--- a/logic/pipeline.cpp
+++ b/logic/pipeline.cpp
@@ -184,7 +184,7 @@ Pose_ reltrans::apply_neck(const rmat& R, int nz, bool disable_tz) const
return neck;
}
-pipeline::pipeline(Mappings& m, runtime_libraries& libs, event_handler& ev, TrackLogger& logger) :
+pipeline::pipeline(const Mappings& m, const runtime_libraries& libs, event_handler& ev, TrackLogger& logger) :
m(m), ev(ev), libs(libs), logger(logger)
{
}
@@ -195,7 +195,7 @@ pipeline::~pipeline()
wait();
}
-double pipeline::map(double pos, Map& axis)
+double pipeline::map(double pos, const Map& axis)
{
bool altp = (pos < 0) && axis.opts.altp;
axis.spline_main.set_tracking_active(!altp);
diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp
index e6e9cc7e..7775054e 100644
--- a/logic/pipeline.hpp
+++ b/logic/pipeline.hpp
@@ -83,7 +83,7 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
mutable QMutex mtx;
main_settings s;
- Mappings& m;
+ const Mappings& m;
event_handler& ev;
Timer t;
@@ -107,7 +107,7 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
bool tracking_started = false;
- static double map(double pos, Map& axis);
+ static double map(double pos, const Map& axis);
void logic();
void run() override;
bool maybe_enable_center_on_tracking_started();
@@ -123,7 +123,7 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
bits b;
public:
- pipeline(Mappings& m, runtime_libraries& libs, event_handler& ev, TrackLogger& logger);
+ pipeline(const Mappings& m, const runtime_libraries& libs, event_handler& ev, TrackLogger& logger);
~pipeline() override;
void raw_and_mapped_pose(double* mapped, double* raw) const;
diff --git a/logic/tracklogger.hpp b/logic/tracklogger.hpp
index 134a27fd..84cded28 100644
--- a/logic/tracklogger.hpp
+++ b/logic/tracklogger.hpp
@@ -41,5 +41,8 @@ public:
void write(const char *s) override;
void write(const double *p, int n) override;
void next_line() override;
+
+ TrackLoggerCSV(const TrackLoggerCSV&) = delete;
+ TrackLoggerCSV& operator=(const TrackLoggerCSV&) = delete;
};
diff --git a/logic/work.cpp b/logic/work.cpp
index da61b348..302414b8 100644
--- a/logic/work.cpp
+++ b/logic/work.cpp
@@ -61,9 +61,9 @@ std::unique_ptr<TrackLogger> Work::make_logger(main_settings &s)
}
-Work::Work(Mappings& m, event_handler& ev, QFrame* frame,
- const dylibptr& tracker_, const dylibptr& filter_, const dylibptr& proto_) :
- libs(frame, tracker_, filter_, proto_),
+Work::Work(const Mappings& m, event_handler& ev, QFrame* frame,
+ const dylibptr& tracker, const dylibptr& filter, const dylibptr& proto) :
+ libs(frame, tracker, filter, proto),
pipeline_{ m, libs, ev, *logger }
{
if (!is_ok())
diff --git a/logic/work.hpp b/logic/work.hpp
index 8177e654..82449e47 100644
--- a/logic/work.hpp
+++ b/logic/work.hpp
@@ -25,7 +25,7 @@
#include <tuple>
#include <functional>
-class OTR_LOGIC_EXPORT Work final : public TR
+class OTR_LOGIC_EXPORT Work final : public QObject
{
Q_OBJECT
@@ -59,7 +59,7 @@ public:
key_tuple(s.key_zero_press2, [&](bool x) { pipeline_.set_zero(x); }, false),
};
- Work(Mappings& m, event_handler& ev, QFrame* frame,
+ Work(const Mappings& m, event_handler& ev, QFrame* frame,
const dylibptr& tracker, const dylibptr& filter, const dylibptr& proto);
void reload_shortcuts();
bool is_ok() const;