using DeviceState = fair::mq::StateNo comment in the header yet.
API · fair::mq
Facilitates communication between devices and plugins.
DeviceControlErrorstructusing DeviceState = fair::mq::StateNo comment in the header yet.
using DeviceStateTransition = fair::mq::TransitionNo comment in the header yet.
PluginServices() = deleteNo comment in the header yet.
PluginServices(ProgOptions& config, Device& device)No comment in the header yet.
~PluginServices()No comment in the header yet.
PluginServices(const PluginServices&) = deleteNo comment in the header yet.
PluginServices(PluginServices&&) = deleteNo comment in the header yet.
PluginServices& operator=(const PluginServices&) = deleteNo comment in the header yet.
PluginServices& operator=(PluginServices&&) = deleteNo comment in the header yet.
auto GetCurrentDeviceState() const -> DeviceStateauto TakeDeviceControl(const std::string& controller) -> voidBecome device controller.
Only one plugin can succeed to take control over device state transitions at a time.
controllerfair::mq::PluginServices::DeviceControlError throwsauto StealDeviceControl(const std::string& controller) -> voidBecome device controller by force.
Take over device controller privileges by force. Does not trigger the ReleaseDeviceControl condition! This function is intended to implement override/emergency control functionality (e.g. device shutdown on SIGINT).
controllerauto ReleaseDeviceControl(const std::string& controller) -> voidRelease device controller role.
controllerfair::mq::PluginServices::DeviceControlError throwsauto GetDeviceController() const -> boost::optional< std::string >Get current device controller.
auto WaitForReleaseDeviceControl() -> voidBlock until control is released.
auto ChangeDeviceState(
const std::string& controller,
DeviceStateTransition next
) -> boolRequest a device state transition.
The state transition may not happen immediately, but when the current state evaluates the pending transition event and terminates. In other words, the device states are scheduled cooperatively. If the device control role has not been taken yet, calling this function will take over control implicitely.
controllernextfair::mq::PluginServices::DeviceControlError throwsauto SubscribeToDeviceStateChange(
const std::string& subscriber,
std::function<void(DeviceState)> callback
) -> voidSubscribe with a callback to device state changes.
The callback will be called at the beginning of a new state. The callback is called from the thread the state is running in.
subscribercallbackauto UnsubscribeFromDeviceStateChange(const std::string& subscriber) -> voidUnsubscribe from device state changes.
subscriberauto GetNumberOfConnectedPeers(
const std::string& channelName,
int index = 0
) -> unsigned longDO NOT USE, ONLY FOR TESTING, WILL BE REMOVED (and info made available via property api)
auto PropertyExists(const std::string& key) const -> boolChecks a property with the given key exist in the configuration.
keytemplate<typename T>
auto SetProperty(const std::string& key, T val) -> voidSet config property.
Setting a config property will store the value in the FairMQ internal config store and notify any subscribers about the update. It is property dependent, if the call to this method will have an immediate, delayed or any effect at all.
keyvalvoid SetProperties(const fair::mq::Properties& props)Set multiple config properties.
propstemplate<typename T>
bool UpdateProperty(const std::string& key, T val)Updates an existing config property (or fails if it doesn't exist)
keyvalbool UpdateProperties(const fair::mq::Properties& input)Updates multiple existing config properties (or fails of any of then do not exist, leaving property store unchanged)
propsvoid DeleteProperty(const std::string& key)Deletes a property with the given key from the config store.
keytemplate<typename T>
auto GetProperty(const std::string& key) const -> TRead config property, throw if no property with this key exists.
keytemplate<typename T>
T GetProperty(const std::string& key, const T& ifNotFound) constRead config property, return provided value if no property with this key exists.
keyifNotFoundauto GetPropertyAsString(const std::string& key) const -> std::stringRead config property as string, throw if no property with this key exists.
Supports conversion to string for a fixed set of types, for custom/unsupported types add them via fair::mq::PropertyHelper::AddType<MyType>("optional label") the provided type must then be convertible to string via operator<<
keyauto GetPropertyAsString(
const std::string& key,
const std::string& ifNotFound
) const -> std::stringRead config property, return provided value if no property with this key exists.
Supports conversion to string for a fixed set of types, for custom/unsupported types add them via fair::mq::PropertyHelper::AddType<MyType>("optional label") the provided type must then be convertible to string via operator<<
keyifNotFoundfair::mq::Properties GetProperties(const std::string& q) constRead several config properties whose keys match the provided regular expression.
qfair::mq::Properties GetPropertiesStartingWith(const std::string& q) constRead several config properties whose keys start with the provided string.
Typically more performant than GetProperties with regex
qstd::map<std::string, std::string> GetPropertiesAsString(const std::string& q) constRead several config properties as string whose keys match the provided regular expression.
qstd::map<std::string, std::string> GetPropertiesAsStringStartingWith(const std::string& q) constRead several config properties as string whose keys start with the provided string.
Typically more performant than GetPropertiesAsString with regex
qauto GetChannelInfo() const -> std::unordered_map< std::string, int >Retrieve current channel information.
auto GetPropertyKeys() const -> std::vector< std::string >Discover the list of property keys.
template<typename T>
auto SubscribeToPropertyChange(
const std::string& subscriber,
std::function<void(const std::string&key, T)> callback
) const -> voidSubscribe to property updates of type T.
Subscribe to property changes with a callback to monitor property changes in an event based fashion.
subscribercallbacktemplate<typename T>
auto UnsubscribeFromPropertyChange(const std::string& subscriber) -> voidUnsubscribe from property updates of type T.
subscriberauto SubscribeToPropertyChangeAsString(
const std::string& subscriber,
std::function<void(const std::string&key, std::string)> callback
) const -> voidSubscribe to property updates.
Subscribe to property changes with a callback to monitor property changes in an event based fashion. Will convert the property to string.
subscribercallbackauto UnsubscribeFromPropertyChangeAsString(const std::string& subscriber) -> voidUnsubscribe from property updates that convert to string.
subscriberauto CycleLogConsoleSeverityUp() -> voidIncreases console logging severity, or sets it to lowest if it is already highest.
auto CycleLogConsoleSeverityDown() -> voidDecreases console logging severity, or sets it to highest if it is already lowest.
auto CycleLogVerbosityUp() -> voidIncreases logging verbosity, or sets it to lowest if it is already highest.
auto CycleLogVerbosityDown() -> voidDecreases logging verbosity, or sets it to highest if it is already lowest.
static auto ToDeviceState(const std::string& state) -> DeviceStateConvert string to DeviceState.
statestd::out_of_range throwsstatic auto ToDeviceStateTransition(const std::string& transition) -> DeviceStateTransitionConvert string to DeviceStateTransition.
transitionstd::out_of_range throwsstatic auto ToStr(DeviceState state) -> std::stringConvert DeviceState to string.
statestatic auto ToStr(DeviceStateTransition transition) -> std::stringConvert DeviceStateTransition to string.
transition