fair::mq::StateMachine Class Reference

Implements the state machine for FairMQ devices. More...

`#include <fairmq/StateMachine.h>`

## Classes

struct | IllegalTransition
struct | StateChange
struct | StateQueued

## Public Types

enum | State : int { Ok, Error, Idle, InitializingDevice, DeviceReady, InitializingTask, Ready, Running, ResettingTask, ResettingDevice, Exiting }
enum | StateTransition : int { InitDevice, InitTask, Run, Stop, ResetTask, ResetDevice, End, ErrorFound, Automatic }

## Public Member Functions

auto | SubscribeToStateChange (const std::string &subscriber, std::function< void(typename StateChange::KeyType newState, State lastState)> callback) -> void
auto | UnsubscribeFromStateChange (const std::string &subscriber) -> void
auto | SubscribeToStateQueued (const std::string &subscriber, std::function< void(typename StateQueued::KeyType newState, State lastState)> callback) -> void
auto | UnsubscribeFromStateQueued (const std::string &subscriber) -> void
auto | GetCurrentState () const -> State
auto | GetCurrentErrorState () const -> State
auto | GetLastQueuedState () const -> State
auto | ChangeState (StateTransition transition) -> void
auto | Run () -> void
auto | Reset () -> void
auto | NextStatePending () -> bool

## Static Public Member Functions

static auto | ToState (const std::string &state) -> State
| Convert string to State. More...
static auto | ToStateTransition (const std::string &transition) -> StateTransition
| Convert string to StateTransition. More...
static auto | ToStr (State state) -> std::string
| Convert State to string. More...
static auto | ToStr (StateTransition transition) -> std::string
| Convert StateTransition to string. More...

## Friends

auto | operator<< (std::ostream &os, const State &state) -> std::ostream &
auto | operator<< (std::ostream &os, const StateTransition &transition) -> std::ostream &

## Detailed Description

Implements the state machine for FairMQ devices.

See https://github.com/FairRootGroup/FairRoot/blob/dev/fairmq/docs/Device.md#13-state-machine

## Member Function Documentation

## ToState()

static auto fair::mq::StateMachine::ToState | ( | const std::string & | state | ) | -> State

inlinestatic

Convert string to State.

Parameters

  state | to convert

Returns
  State enum entry

Exceptions

  std::out_of_range | if a string cannot be resolved to a State

## ToStateTransition()

static auto fair::mq::StateMachine::ToStateTransition | ( | const std::string & | transition | ) | -> StateTransition

inlinestatic

Convert string to StateTransition.

Parameters

  transition | to convert

Returns
  StateTransition enum entry

Exceptions

  std::out_of_range | if a string cannot be resolved to a StateTransition

## ToStr() [1/2]

static auto fair::mq::StateMachine::ToStr | ( | State | state | ) | -> std::string

inlinestatic

Convert State to string.

Parameters

  state | to convert

Returns
  string representation of State enum entry

## ToStr() [2/2]

static auto fair::mq::StateMachine::ToStr | ( | StateTransition | transition | ) | -> std::string

inlinestatic

Convert StateTransition to string.

Parameters

  transition | to convert

Returns
  string representation of StateTransition enum entry

The documentation for this class was generated from the following files:

- fairmq/StateMachine.h
- fairmq/StateMachine.cxx