diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-06-20 18:45:59 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-06-20 18:47:20 +0200 |
commit | c1be0706d4872f31bcc09c0963c7602ac19f8c76 (patch) | |
tree | f66a4c525eb522447d543429a5c026c9325d9b1f | |
parent | 74ce228b1e3e756174c2e75579bfe500701ee570 (diff) |
logic/work: const correctness
-rw-r--r-- | logic/mappings.hpp | 2 | ||||
-rw-r--r-- | logic/pipeline.cpp | 4 | ||||
-rw-r--r-- | logic/pipeline.hpp | 6 | ||||
-rw-r--r-- | logic/tracklogger.hpp | 3 | ||||
-rw-r--r-- | logic/work.cpp | 6 | ||||
-rw-r--r-- | logic/work.hpp | 4 | ||||
-rw-r--r-- | spline/spline.cpp | 2 | ||||
-rw-r--r-- | spline/spline.hpp | 4 |
8 files changed, 16 insertions, 15 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; diff --git a/spline/spline.cpp b/spline/spline.cpp index 3ec3b5dc..98a82711 100644 --- a/spline/spline.cpp +++ b/spline/spline.cpp @@ -37,7 +37,7 @@ spline::~spline() spline::spline() : spline(QString{}, QString{}, Axis(-1)) {} -void spline::set_tracking_active(bool value) +void spline::set_tracking_active(bool value) const { std::shared_ptr<settings> S; { diff --git a/spline/spline.hpp b/spline/spline.hpp index a78db8dd..85f1c969 100644 --- a/spline/spline.hpp +++ b/spline/spline.hpp @@ -54,7 +54,7 @@ struct OTR_SPLINE_EXPORT base_spline_ virtual double get_value_no_save(double x) const = 0; [[nodiscard]] virtual bool get_last_value(QPointF& point) = 0; - virtual void set_tracking_active(bool value) = 0; + virtual void set_tracking_active(bool value) const = 0; virtual double max_input() const = 0; virtual double max_output() const = 0; @@ -146,7 +146,7 @@ public: const points_t& get_points() const override; - void set_tracking_active(bool value) override; + void set_tracking_active(bool value) const override; bundle get_bundle(); void ensure_valid(points_t& in_out) const; |