FairMQ  1.4.33
C++ Message Queuing Library and Framework
States.h
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 
16 namespace fair::mq
17 {
18 
19 enum class State : int
20 {
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  Exiting
37 };
38 
39 enum class Transition : int
40 {
41  Auto = 0,
42  InitDevice,
43  CompleteInit,
44  Bind,
45  Connect,
46  InitTask,
47  Run,
48  Stop,
49  ResetTask,
50  ResetDevice,
51  End,
52  ErrorFound
53 };
54 
55 std::string GetStateName(State);
56 std::string GetTransitionName(Transition);
57 State GetState(const std::string& state);
58 Transition GetTransition(const std::string& transition);
59 
60 struct DeviceErrorState : std::runtime_error { using std::runtime_error::runtime_error; };
61 
62 inline std::ostream& operator<<(std::ostream& os, const State& state) { return os << GetStateName(state); }
63 inline std::ostream& operator<<(std::ostream& os, const Transition& transition) { return os << GetTransitionName(transition); }
64 
65 } // namespace fair::mq
66 
67 #endif /* FAIRMQSTATES_H_ */
fair::mq
Tools for interfacing containers to the transport via polymorphic allocators.
Definition: DeviceRunner.h:23

privacy