summaryrefslogtreecommitdiffhomepage
path: root/logic
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-12-19 20:36:56 +0100
committerStanislaw Halik <sthalik@misaki.pl>2021-12-19 20:37:04 +0100
commitcb0753adaefcd365134a16b5ebc0be76c1f7b7da (patch)
tree9e7d6f56e70e804c2d27e9e4a129771d6ff148d1 /logic
parentadedc93dfc2f3b62d1fe2cb51207749a2459c2fa (diff)
remove unfinished extension support
Diffstat (limited to 'logic')
-rw-r--r--logic/extensions.cpp74
-rw-r--r--logic/extensions.hpp44
-rw-r--r--logic/pipeline.cpp9
-rw-r--r--logic/pipeline.hpp4
-rw-r--r--logic/state.cpp1
-rw-r--r--logic/state.hpp2
-rw-r--r--logic/work.cpp4
-rw-r--r--logic/work.hpp2
8 files changed, 6 insertions, 134 deletions
diff --git a/logic/extensions.cpp b/logic/extensions.cpp
deleted file mode 100644
index 03d03a83..00000000
--- a/logic/extensions.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "extensions.hpp"
-
-#include <functional>
-
-using namespace options;
-
-using ext_fun_type = void(IExtension::*)(Pose&);
-using ext_mask = IExtension::event_mask;
-using ext_ord = IExtension::event_ordinal;
-
-static constexpr struct event_type_mapping
-{
- ext_fun_type ptr;
- ext_mask mask;
- ext_ord idx;
-} ordinal_to_function[] = {
- { &IExtension::process_raw, ext_mask::on_raw, ext_ord::ev_raw, },
- { &IExtension::process_before_filter, ext_mask::on_before_filter, ext_ord::ev_before_filter, },
- { &IExtension::process_before_mapping, ext_mask::on_before_mapping, ext_ord::ev_before_mapping, },
- { &IExtension::process_finished, ext_mask::on_finished, ext_ord::ev_finished, },
-};
-
-bool event_handler::is_enabled(const QString& name)
-{
- (void)name;
-#if 1
- return true;
-#else
- if (!ext_bundle->contains(name))
- return false;
-
- return ext_bundle->get<bool>(name);
-#endif
-}
-
-event_handler::event_handler(Modules::dylib_list const& extensions) : ext_bundle(make_bundle("extensions"))
-{
- for (std::shared_ptr<dylib> const& lib : extensions)
- {
- std::shared_ptr<IExtension> ext(reinterpret_cast<IExtension*>(lib->Constructor()));
- std::shared_ptr<IExtensionDialog> dlg(reinterpret_cast<IExtensionDialog*>(lib->Dialog()));
- std::shared_ptr<Metadata_> m(lib->Meta());
-
- const ext_mask mask = ext->hook_types();
-
- if (!is_enabled(lib->module_name))
- continue;
-
-#if 0
- qDebug() << "extension" << lib->module_name << "mask" << (void*)mask;
-#endif
-
- for (event_type_mapping const& mapping : ordinal_to_function)
- {
- const unsigned i = mapping.idx;
- const ext_mask mask_ = mapping.mask;
-
- if (mask & mask_)
- extensions_for_event[i].push_back({ ext, dlg, m });
- }
- }
-}
-
-void event_handler::run_events(event_ordinal k, Pose& pose)
-{
-#if 0
- auto fun = std::mem_fn(ordinal_to_function[k].ptr);
-
- for (extension& x : extensions_for_event[k])
- fun(*x.logic, pose);
-#else
- (void)k; (void)pose;
-#endif
-}
diff --git a/logic/extensions.hpp b/logic/extensions.hpp
deleted file mode 100644
index 3368b118..00000000
--- a/logic/extensions.hpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#pragma once
-
-/* Copyright (c) 2017 Stanislaw Halik
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- */
-
-#include "api/plugin-support.hpp"
-#include "options/options.hpp"
-
-#include <vector>
-#include <array>
-
-#include "export.hpp"
-
-struct OTR_LOGIC_EXPORT event_handler final
-{
- using event_ordinal = IExtension::event_ordinal;
-
- struct extension
- {
- using ext = std::shared_ptr<IExtension>;
- using dlg = std::shared_ptr<IExtensionDialog>;
- using m = std::shared_ptr<Metadata_>;
-
- ext logic;
- dlg dialog;
- m metadata;
- };
-
- void run_events(event_ordinal k, Pose& pose);
- event_handler(Modules::dylib_list const& extensions);
-
-private:
- using ext_list = std::vector<extension>;
- std::array<ext_list, IExtension::event_count> extensions_for_event;
-
- options::bundle ext_bundle;
-
- bool is_enabled(const QString& name);
-};
-
diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp
index 074cce24..4bb11424 100644
--- a/logic/pipeline.cpp
+++ b/logic/pipeline.cpp
@@ -184,8 +184,8 @@ Pose_ reltrans::apply_neck(const rmat& R, int nz, bool disable_tz) const
return neck;
}
-pipeline::pipeline(const Mappings& m, const runtime_libraries& libs, event_handler& ev, TrackLogger& logger) :
- m(m), ev(ev), libs(libs), logger(logger)
+pipeline::pipeline(const Mappings& m, const runtime_libraries& libs, TrackLogger& logger) :
+ m(m), libs(libs), logger(logger)
{
}
@@ -422,7 +422,6 @@ Pose pipeline::apply_reltrans(Pose value, vec6_bool disabled, bool centerp)
void pipeline::logic()
{
using namespace euler;
- using EV = event_handler::event_ordinal;
logger.write_dt();
logger.reset_dt();
@@ -435,7 +434,6 @@ void pipeline::logic()
{
Pose tmp;
libs.pTracker->data(tmp);
- ev.run_events(EV::ev_raw, tmp);
newpose = tmp;
}
@@ -454,7 +452,6 @@ void pipeline::logic()
}
{
- ev.run_events(EV::ev_before_filter, value);
// we must proceed with all the filtering since the filter
// needs fresh values to prevent deconvergence
if (center_ordered)
@@ -466,7 +463,6 @@ void pipeline::logic()
}
{
- ev.run_events(EV::ev_before_mapping, value);
// CAVEAT rotation only, due to reltrans
for (int i = 3; i < 6; i++)
value(i) = map(value(i), m(i));
@@ -508,7 +504,6 @@ ok:
last_value = value;
value = apply_zero_pos(value);
- ev.run_events(EV::ev_finished, value);
libs.pProtocol->pose(value, raw);
QMutexLocker foo(&mtx);
diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp
index 80d4d8a7..a539525d 100644
--- a/logic/pipeline.hpp
+++ b/logic/pipeline.hpp
@@ -8,7 +8,6 @@
#include "compat/euler.hpp"
#include "compat/enum-operators.hpp"
#include "runtime-libraries.hpp"
-#include "extensions.hpp"
#include "spline/spline.hpp"
#include "main-settings.hpp"
@@ -85,7 +84,6 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
mutable QMutex mtx;
main_settings s;
const Mappings& m;
- event_handler& ev;
Timer t;
Pose output_pose, raw_6dof, last_value;
@@ -125,7 +123,7 @@ class OTR_LOGIC_EXPORT pipeline : private QThread
bits b;
public:
- pipeline(const Mappings& m, const runtime_libraries& libs, event_handler& ev, TrackLogger& logger);
+ pipeline(const Mappings& m, const runtime_libraries& libs, TrackLogger& logger);
~pipeline() override;
void raw_and_mapped_pose(double* mapped, double* raw) const;
diff --git a/logic/state.cpp b/logic/state.cpp
index 357430d8..8218e5c3 100644
--- a/logic/state.cpp
+++ b/logic/state.cpp
@@ -22,7 +22,6 @@ std::tuple<dylib_ptr, int> State::module_by_name(const QString& name, dylib_list
State::State(const QString& library_path) :
modules(library_path),
- ev(modules.extensions()),
pose(s.all_axis_opts)
{}
diff --git a/logic/state.hpp b/logic/state.hpp
index abce1daf..809ca458 100644
--- a/logic/state.hpp
+++ b/logic/state.hpp
@@ -12,7 +12,6 @@
#include "api/plugin-support.hpp"
#include "main-settings.hpp"
#include "mappings.hpp"
-#include "extensions.hpp"
#include "work.hpp"
#include "export.hpp"
@@ -32,7 +31,6 @@ struct OTR_LOGIC_EXPORT State
dylib_ptr current_filter();
Modules modules;
- event_handler ev;
main_settings s;
module_settings m;
Mappings pose;
diff --git a/logic/work.cpp b/logic/work.cpp
index 7689f916..8c6a3a62 100644
--- a/logic/work.cpp
+++ b/logic/work.cpp
@@ -57,10 +57,10 @@ std::unique_ptr<TrackLogger> Work::make_logger(main_settings &s)
}
-Work::Work(const Mappings& m, event_handler& ev, QFrame* frame,
+Work::Work(const Mappings& m, QFrame* frame,
const dylibptr& tracker, const dylibptr& filter, const dylibptr& proto) :
libs(frame, tracker, filter, proto),
- pipeline_{ m, libs, ev, *logger }
+ pipeline_{ m, libs, *logger }
{
if (!is_ok())
return;
diff --git a/logic/work.hpp b/logic/work.hpp
index 6521c09d..ef839257 100644
--- a/logic/work.hpp
+++ b/logic/work.hpp
@@ -59,7 +59,7 @@ public:
key_tuple(s.key_zero_press2, [this](bool x) { pipeline_.set_zero(x); }, false),
};
- Work(const Mappings& m, event_handler& ev, QFrame* frame,
+ Work(const Mappings& m, QFrame* frame,
const dylibptr& tracker, const dylibptr& filter, const dylibptr& proto);
void reload_shortcuts();
bool is_ok() const;