Extract States & Transitions to own header, use in plugins

This commit is contained in:
Alexey Rybalchenko
2019-07-17 11:39:44 +02:00
committed by Dennis Klein
parent 8bb6a9518a
commit 4487b81de8
8 changed files with 206 additions and 308 deletions

66
fairmq/States.h Normal file
View File

@@ -0,0 +1,66 @@
/********************************************************************************
* Copyright (C) 2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIRMQSTATES_H_
#define FAIRMQSTATES_H_
#include <string>
#include <ostream>
namespace fair
{
namespace mq
{
enum class State : int
{
Ok,
Error,
Idle,
InitializingDevice,
Initialized,
Binding,
Bound,
Connecting,
DeviceReady,
InitializingTask,
Ready,
Running,
ResettingTask,
ResettingDevice,
Exiting
};
enum class Transition : int
{
Auto,
InitDevice,
CompleteInit,
Bind,
Connect,
InitTask,
Run,
Stop,
ResetTask,
ResetDevice,
End,
ErrorFound
};
std::string GetStateName(const State);
std::string GetTransitionName(const Transition);
State GetState(const std::string& state);
Transition GetTransition(const std::string& transition);
inline std::ostream& operator<<(std::ostream& os, const State& state) { return os << GetStateName(state); }
inline std::ostream& operator<<(std::ostream& os, const Transition& transition) { return os << GetTransitionName(transition); }
} // namespace mq
} // namespace fair
#endif /* FAIRMQSTATES_H_ */