mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
Remove TransitionTo from plugin APIs
This commit is contained in:
parent
b0b271d1f4
commit
0f4595b8c1
|
@ -60,10 +60,10 @@ class Plugin
|
||||||
friend auto operator!=(const Plugin& lhs, const Plugin& rhs) -> bool { return !(lhs == rhs); }
|
friend auto operator!=(const Plugin& lhs, const Plugin& rhs) -> bool { return !(lhs == rhs); }
|
||||||
friend auto operator<<(std::ostream& os, const Plugin& p) -> std::ostream&
|
friend auto operator<<(std::ostream& os, const Plugin& p) -> std::ostream&
|
||||||
{
|
{
|
||||||
return os << "'" << p.GetName() << "', "
|
return os << "'" << p.GetName() << "', "
|
||||||
<< "version '" << p.GetVersion() << "', "
|
<< "version '" << p.GetVersion() << "', "
|
||||||
<< "maintainer '" << p.GetMaintainer() << "', "
|
<< "maintainer '" << p.GetMaintainer() << "', "
|
||||||
<< "homepage '" << p.GetHomepage() << "'";
|
<< "homepage '" << p.GetHomepage() << "'";
|
||||||
}
|
}
|
||||||
static auto NoProgramOptions() -> ProgOptions { return boost::none; }
|
static auto NoProgramOptions() -> ProgOptions { return boost::none; }
|
||||||
|
|
||||||
|
@ -80,7 +80,6 @@ class Plugin
|
||||||
auto StealDeviceControl() -> void { fPluginServices->StealDeviceControl(fkName); };
|
auto StealDeviceControl() -> void { fPluginServices->StealDeviceControl(fkName); };
|
||||||
auto ReleaseDeviceControl() -> void { fPluginServices->ReleaseDeviceControl(fkName); };
|
auto ReleaseDeviceControl() -> void { fPluginServices->ReleaseDeviceControl(fkName); };
|
||||||
auto ChangeDeviceState(const DeviceStateTransition next) -> bool { return fPluginServices->ChangeDeviceState(fkName, next); }
|
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<void(DeviceState)> callback) -> void { fPluginServices->SubscribeToDeviceStateChange(fkName, callback); }
|
auto SubscribeToDeviceStateChange(std::function<void(DeviceState)> callback) -> void { fPluginServices->SubscribeToDeviceStateChange(fkName, callback); }
|
||||||
auto UnsubscribeFromDeviceStateChange() -> void { fPluginServices->UnsubscribeFromDeviceStateChange(fkName); }
|
auto UnsubscribeFromDeviceStateChange() -> void { fPluginServices->UnsubscribeFromDeviceStateChange(fkName); }
|
||||||
|
|
||||||
|
|
|
@ -28,22 +28,6 @@ auto PluginServices::ChangeDeviceState(const string& controller, const DeviceSta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginServices::TransitionDeviceStateTo(const std::string& controller, DeviceState state)
|
|
||||||
{
|
|
||||||
lock_guard<mutex> 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
|
auto PluginServices::TakeDeviceControl(const string& controller) -> void
|
||||||
{
|
{
|
||||||
lock_guard<mutex> lock{fDeviceControllerMutex};
|
lock_guard<mutex> lock{fDeviceControllerMutex};
|
||||||
|
|
|
@ -124,8 +124,6 @@ class PluginServices
|
||||||
/// If the device control role has not been taken yet, calling this function will take over control implicitely.
|
/// 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;
|
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
|
/// @brief Subscribe with a callback to device state changes
|
||||||
/// @param subscriber id
|
/// @param subscriber id
|
||||||
/// @param callback
|
/// @param callback
|
||||||
|
|
Loading…
Reference in New Issue
Block a user