diff options
Diffstat (limited to 'logic/selected-libraries.cpp')
-rw-r--r-- | logic/selected-libraries.cpp | 30 |
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); + } +} |