Skip to content

Source · fairmq/

States.hpublic header

Defines struct fair::mq::DeviceErrorState.

Described in Device states, States and transitions.

fairmq/States.h67 lines · C++API: DeviceErrorStateGitHub ↗
1/********************************************************************************2 *    Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH    *3 *                                                                              *4 *              This software is distributed under the terms of the             *5 *              GNU Lesser General Public Licence (LGPL) version 3,             *6 *                  copied verbatim in the file "LICENSE"                       *7 ********************************************************************************/8 9#ifndef FAIRMQSTATES_H_10#define FAIRMQSTATES_H_11 12#include <string>13#include <ostream>14#include <stdexcept>15 16namespace fair::mq17{18 19enum class State : int20{21    Undefined = 0,22    Ok,23    Error,24    Idle,25    InitializingDevice,26    Initialized,27    Binding,28    Bound,29    Connecting,30    DeviceReady,31    InitializingTask,32    Ready,33    Running,34    ResettingTask,35    ResettingDevice,36    Exiting37};38 39enum class Transition : int40{41    Auto = 0,42    InitDevice,43    CompleteInit,44    Bind,45    Connect,46    InitTask,47    Run,48    Stop,49    ResetTask,50    ResetDevice,51    End,52    ErrorFound53};54 55std::string GetStateName(State);56std::string GetTransitionName(Transition);57State GetState(const std::string& state);58Transition GetTransition(const std::string& transition);59 60struct DeviceErrorState : std::runtime_error { using std::runtime_error::runtime_error; };61 62inline std::ostream& operator<<(std::ostream& os, const State& state) { return os << GetStateName(state); }63inline std::ostream& operator<<(std::ostream& os, const Transition& transition) { return os << GetTransitionName(transition); }64 65} // namespace fair::mq66 67#endif /* FAIRMQSTATES_H_ */