summaryrefslogtreecommitdiffhomepage
path: root/logic/selected-libraries.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-09-25 16:24:58 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-09-25 16:29:38 +0200
commiteca907d3c1240d04bbcfdf84a3a726353e56bc64 (patch)
treec7c35c7f3d5dd22b689be84287567e80aa57b46a /logic/selected-libraries.cpp
parent6932a00edd5074caf75b0d9624fc079775a44b1e (diff)
api, logic: support "extensions" for pose transform
Diffstat (limited to 'logic/selected-libraries.cpp')
-rw-r--r--logic/selected-libraries.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/logic/selected-libraries.cpp b/logic/selected-libraries.cpp
index ffa3e496..1fc3da86 100644
--- a/logic/selected-libraries.cpp
+++ b/logic/selected-libraries.cpp
@@ -2,6 +2,24 @@
#include "options/scoped.hpp"
#include <QDebug>
+using ext_ord = IExtension::event_ordinal;
+using ext_mask = IExtension::event_mask;
+using ext_fun_type = void(IExtension::*)(Pose&);
+
+static constexpr struct event_type_mapping
+{
+ ext_fun_type ptr;
+ ext_mask m;
+ ext_ord idx;
+} ordinal_to_function[] = {
+ { &IExtension::process_raw, ext_mask::on_raw, ext_ord::ev_raw, },
+ { &IExtension::process_after_center, ext_mask::on_after_center, ext_ord::ev_after_center, },
+ { &IExtension::process_before_filter, ext_mask::on_before_filter, ext_ord::ev_before_filter, },
+ { &IExtension::process_before_transform, ext_mask::on_before_transform, ext_ord::ev_before_transform, },
+ { &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, },
+};
+
SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) :
pTracker(nullptr),
pFilter(nullptr),
@@ -44,3 +62,15 @@ SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dyli
end:
opts::set_teardown_flag(prev_teardown_flag);
}
+
+void runtime_event_handler::run_events(ext_event_ordinal k, Pose& pose)
+{
+ auto fun = std::mem_fn(ordinal_to_function[k].ptr);
+
+ for (ext& x : extension_events[k])
+ {
+ if (x == nullptr)
+ break;
+ fun(x, pose);
+ }
+}