FairMQ  1.4.14
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
17 {
18 namespace mq
19 {
20 
21 enum class State : int
22 {
23  Ok,
24  Error,
25  Idle,
26  InitializingDevice,
27  Initialized,
28  Binding,
29  Bound,
30  Connecting,
31  DeviceReady,
32  InitializingTask,
33  Ready,
34  Running,
35  ResettingTask,
36  ResettingDevice,
37  Exiting
38 };
39 
40 enum class Transition : int
41 {
42  Auto,
43  InitDevice,
44  CompleteInit,
45  Bind,
46  Connect,
47  InitTask,
48  Run,
49  Stop,
50  ResetTask,
51  ResetDevice,
52  End,
53  ErrorFound
54 };
55 
56 std::string GetStateName(State);
57 std::string GetTransitionName(Transition);
58 State GetState(const std::string& state);
59 Transition GetTransition(const std::string& transition);
60 
61 struct DeviceErrorState : std::runtime_error { using std::runtime_error::runtime_error; };
62 
63 inline std::ostream& operator<<(std::ostream& os, const State& state) { return os << GetStateName(state); }
64 inline std::ostream& operator<<(std::ostream& os, const Transition& transition) { return os << GetTransitionName(transition); }
65 
66 } // namespace mq
67 } // namespace fair
68 
69 #endif /* FAIRMQSTATES_H_ */
Definition: States.h:61
Tools for interfacing containers to the transport via polymorphic allocators.
Definition: DeviceRunner.h:23

privacy