From 819e635af2b64213f1076eb4a99bba8c48cfdb68 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 30 Sep 2017 11:28:32 +0200 Subject: remove camel case --- logic/runtime-libraries.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++++ logic/runtime-libraries.hpp | 44 +++++++++++++++++++++++++ logic/selected-libraries.cpp | 76 -------------------------------------------- logic/selected-libraries.hpp | 44 ------------------------- logic/tracker.h | 2 +- logic/work.hpp | 2 +- 6 files changed, 122 insertions(+), 122 deletions(-) create mode 100644 logic/runtime-libraries.cpp create mode 100644 logic/runtime-libraries.hpp delete mode 100644 logic/selected-libraries.cpp delete mode 100644 logic/selected-libraries.hpp (limited to 'logic') diff --git a/logic/runtime-libraries.cpp b/logic/runtime-libraries.cpp new file mode 100644 index 00000000..fbe30fef --- /dev/null +++ b/logic/runtime-libraries.cpp @@ -0,0 +1,76 @@ +#include "selected-libraries.hpp" +#include "options/scoped.hpp" +#include + +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, }, +}; + +runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) : + pTracker(nullptr), + pFilter(nullptr), + pProtocol(nullptr), + correct(false) +{ + using namespace options; + + const bool prev_teardown_flag = opts::is_tracker_teardown(); + + opts::set_teardown_flag(true); + + pProtocol = make_dylib_instance(p); + + if (!pProtocol) + { + qDebug() << "protocol dylib load failure"; + goto end; + } + + if(!pProtocol->correct()) + { + qDebug() << "protocol load failure"; + pProtocol = nullptr; + goto end; + } + + pTracker = make_dylib_instance(t); + pFilter = make_dylib_instance(f); + + if (!pTracker) + { + qDebug() << "tracker dylib load failure"; + goto end; + } + + pTracker->start_tracker(frame); + + correct = true; +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); + } +} diff --git a/logic/runtime-libraries.hpp b/logic/runtime-libraries.hpp new file mode 100644 index 00000000..6cfd8b57 --- /dev/null +++ b/logic/runtime-libraries.hpp @@ -0,0 +1,44 @@ +/* Copyright (c) 2014-2015, 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. + */ + +#pragma once + +#include "api/plugin-support.hpp" +#include "export.hpp" + +#include +#include + +#include + +struct runtime_event_handler +{ + using ext_event_ordinal = IExtension::event_ordinal; + using ext = std::shared_ptr; + + enum : unsigned { ext_max_events = 64 }; + using ext_list = std::array; + + std::array extension_events; + + void run_events(ext_event_ordinal k, Pose& pose); +}; + +struct OTR_LOGIC_EXPORT runtime_libraries final : runtime_event_handler +{ + using dylibptr = std::shared_ptr; + + std::shared_ptr pTracker; + std::shared_ptr pFilter; + std::shared_ptr pProtocol; + + runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f); + runtime_libraries() : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) {} + + bool correct; +}; diff --git a/logic/selected-libraries.cpp b/logic/selected-libraries.cpp deleted file mode 100644 index fbe30fef..00000000 --- a/logic/selected-libraries.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "selected-libraries.hpp" -#include "options/scoped.hpp" -#include - -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, }, -}; - -runtime_libraries::runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) : - pTracker(nullptr), - pFilter(nullptr), - pProtocol(nullptr), - correct(false) -{ - using namespace options; - - const bool prev_teardown_flag = opts::is_tracker_teardown(); - - opts::set_teardown_flag(true); - - pProtocol = make_dylib_instance(p); - - if (!pProtocol) - { - qDebug() << "protocol dylib load failure"; - goto end; - } - - if(!pProtocol->correct()) - { - qDebug() << "protocol load failure"; - pProtocol = nullptr; - goto end; - } - - pTracker = make_dylib_instance(t); - pFilter = make_dylib_instance(f); - - if (!pTracker) - { - qDebug() << "tracker dylib load failure"; - goto end; - } - - pTracker->start_tracker(frame); - - correct = true; -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); - } -} diff --git a/logic/selected-libraries.hpp b/logic/selected-libraries.hpp deleted file mode 100644 index 586f7a57..00000000 --- a/logic/selected-libraries.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) 2014-2015, 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. - */ - -#pragma once - -#include "api/plugin-support.hpp" -#include "export.hpp" - -#include -#include - -#include - -struct runtime_event_handler -{ - using ext_event_ordinal = IExtension::event_ordinal; - using ext = std::shared_ptr; - - enum : unsigned { ext_max_events = 64 }; - using ext_list = std::array; - - std::array extension_events; - - void run_events(ext_event_ordinal k, Pose& pose); -}; - -struct OTR_LOGIC_EXPORT runtime_libraries : runtime_event_handler -{ - using dylibptr = std::shared_ptr; - - std::shared_ptr pTracker; - std::shared_ptr pFilter; - std::shared_ptr pProtocol; - - runtime_libraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f); - runtime_libraries() : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) {} - - bool correct; -}; diff --git a/logic/tracker.h b/logic/tracker.h index 1151d16b..afd57112 100644 --- a/logic/tracker.h +++ b/logic/tracker.h @@ -14,7 +14,7 @@ #include "api/plugin-support.hpp" #include "mappings.hpp" #include "compat/euler.hpp" -#include "selected-libraries.hpp" +#include "runtime-libraries.hpp" #include "spline/spline.hpp" #include "main-settings.hpp" diff --git a/logic/work.hpp b/logic/work.hpp index fa0e5c90..1aff5260 100644 --- a/logic/work.hpp +++ b/logic/work.hpp @@ -14,7 +14,7 @@ #include "shortcuts.h" #include "export.hpp" #include "tracklogger.hpp" -#include "logic/selected-libraries.hpp" +#include "logic/runtime-libraries.hpp" #include "api/plugin-support.hpp" #include -- cgit v1.2.3