From 150b20f6de393711b4ddfad6d86a36d62e03e69f Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Mon, 9 Sep 2024 16:28:55 +0300 Subject: [PATCH] refactoring --- src/bedsidemon/settings.hpp | 2 +- src/bedsidemon/signal.hpp | 70 ------------------- src/bedsidemon/spo2/spo2_parameter_window.hpp | 1 - 3 files changed, 1 insertion(+), 72 deletions(-) delete mode 100644 src/bedsidemon/signal.hpp diff --git a/src/bedsidemon/settings.hpp b/src/bedsidemon/settings.hpp index 1ea2324..e183a3f 100644 --- a/src/bedsidemon/settings.hpp +++ b/src/bedsidemon/settings.hpp @@ -23,7 +23,7 @@ along with this program. If not, see . #include -#include "signal.hpp" +#include namespace bedsidemon { diff --git a/src/bedsidemon/signal.hpp b/src/bedsidemon/signal.hpp deleted file mode 100644 index d625559..0000000 --- a/src/bedsidemon/signal.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/* -bedsidemon - Bed-side monitor example GUI project - -Copyright (C) 2024 Gagistech Oy - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -/* ================ LICENSE END ================ */ - -#pragma once - -#include -#include - -namespace utki { - -template -class signal -{ -public: - using callback_type = std::function; - -private: - std::list callbacks; - -public: - using connection = typename decltype(callbacks)::iterator; - - connection connect(callback_type callback) - { - this->callbacks.push_back(std::move(callback)); - return std::prev(this->callbacks.end()); - } - - void disconnect(connection conn) - { - this->callbacks.erase(conn); - } - - void emit(args_type... a) - { - for (const auto& c : this->callbacks) { - c(a...); - } - } - - size_t size() const noexcept - { - return this->callbacks.size(); - } - - bool empty() const noexcept - { - return this->size() == 0; - } -}; - -} // namespace utki diff --git a/src/bedsidemon/spo2/spo2_parameter_window.hpp b/src/bedsidemon/spo2/spo2_parameter_window.hpp index 03fa9f9..4ec8c69 100644 --- a/src/bedsidemon/spo2/spo2_parameter_window.hpp +++ b/src/bedsidemon/spo2/spo2_parameter_window.hpp @@ -26,7 +26,6 @@ along with this program. If not, see . #include #include "../settings.hpp" -#include "../signal.hpp" #include "../waveform.hpp" #include "spo2_measurement.hpp"