From 0f4595b8c1926ed7cf8a4e4721ae762ba2015a5a Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Thu, 21 Nov 2019 10:54:47 +0100 Subject: [PATCH] Remove TransitionTo from plugin APIs --- fairmq/Plugin.h | 7 +++---- fairmq/PluginServices.cxx | 16 ---------------- fairmq/PluginServices.h | 2 -- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/fairmq/Plugin.h b/fairmq/Plugin.h index e9954384..43258441 100644 --- a/fairmq/Plugin.h +++ b/fairmq/Plugin.h @@ -60,10 +60,10 @@ class Plugin friend auto operator!=(const Plugin& lhs, const Plugin& rhs) -> bool { return !(lhs == rhs); } friend auto operator<<(std::ostream& os, const Plugin& p) -> std::ostream& { - return os << "'" << p.GetName() << "', " - << "version '" << p.GetVersion() << "', " + return os << "'" << p.GetName() << "', " + << "version '" << p.GetVersion() << "', " << "maintainer '" << p.GetMaintainer() << "', " - << "homepage '" << p.GetHomepage() << "'"; + << "homepage '" << p.GetHomepage() << "'"; } static auto NoProgramOptions() -> ProgOptions { return boost::none; } @@ -80,7 +80,6 @@ class Plugin auto StealDeviceControl() -> void { fPluginServices->StealDeviceControl(fkName); }; auto ReleaseDeviceControl() -> void { fPluginServices->ReleaseDeviceControl(fkName); }; auto ChangeDeviceState(const DeviceStateTransition next) -> bool { return fPluginServices->ChangeDeviceState(fkName, next); } - void TransitionDeviceStateTo(const DeviceState state) { return fPluginServices->TransitionDeviceStateTo(fkName, state); } auto SubscribeToDeviceStateChange(std::function callback) -> void { fPluginServices->SubscribeToDeviceStateChange(fkName, callback); } auto UnsubscribeFromDeviceStateChange() -> void { fPluginServices->UnsubscribeFromDeviceStateChange(fkName); } diff --git a/fairmq/PluginServices.cxx b/fairmq/PluginServices.cxx index 17deaa4f..ba039d41 100644 --- a/fairmq/PluginServices.cxx +++ b/fairmq/PluginServices.cxx @@ -28,22 +28,6 @@ auto PluginServices::ChangeDeviceState(const string& controller, const DeviceSta } } -void PluginServices::TransitionDeviceStateTo(const std::string& controller, DeviceState state) -{ - lock_guard lock{fDeviceControllerMutex}; - - if (!fDeviceController) fDeviceController = controller; - - if (fDeviceController == controller) { - fDevice.TransitionTo(state); - } else { - throw DeviceControlError{tools::ToString( - "Plugin '", controller, "' is not allowed to change device states. ", - "Currently, plugin '", *fDeviceController, "' has taken control." - )}; - } -} - auto PluginServices::TakeDeviceControl(const string& controller) -> void { lock_guard lock{fDeviceControllerMutex}; diff --git a/fairmq/PluginServices.h b/fairmq/PluginServices.h index 142b346d..c26f9696 100644 --- a/fairmq/PluginServices.h +++ b/fairmq/PluginServices.h @@ -124,8 +124,6 @@ class PluginServices /// If the device control role has not been taken yet, calling this function will take over control implicitely. auto ChangeDeviceState(const std::string& controller, const DeviceStateTransition next) -> bool; - void TransitionDeviceStateTo(const std::string& controller, DeviceState state); - /// @brief Subscribe with a callback to device state changes /// @param subscriber id /// @param callback