11 #include <fmt/format.h>
12 #include <fmt/ostream.h>
13 #include <boost/algorithm/string/predicate.hpp>
15 using namespace std::string_view_literals;
21 if (boost::iequals(state,
"StateAcquiring"sv)) {
22 return DaqState::StateAcquiring;
24 if (boost::iequals(state,
"StateMerging"sv)) {
25 return DaqState::StateMerging;
27 if (boost::iequals(state,
"StateCompleted"sv)) {
28 return DaqState::StateCompleted;
30 throw std::invalid_argument(fmt::format(
"Invalid DaqState '{}'", state));
35 if (boost::iequals(state,
"NotStarted"sv)) {
36 return DaqSubState::NotStarted;
38 if (boost::iequals(state,
"Starting"sv)) {
39 return DaqSubState::Starting;
41 if (boost::iequals(state,
"Acquiring"sv)) {
42 return DaqSubState::Acquiring;
44 if (boost::iequals(state,
"Stopping"sv)) {
45 return DaqSubState::Stopping;
47 if (boost::iequals(state,
"Stopped"sv)) {
48 return DaqSubState::Stopped;
50 if (boost::iequals(state,
"Aborting"sv)) {
51 return DaqSubState::Aborting;
53 if (boost::iequals(state,
"NotScheduled"sv)) {
54 return DaqSubState::NotScheduled;
56 if (boost::iequals(state,
"Scheduled"sv)) {
57 return DaqSubState::Scheduled;
59 if (boost::iequals(state,
"Transferring"sv)) {
60 return DaqSubState::Transferring;
62 if (boost::iequals(state,
"Merging"sv)) {
63 return DaqSubState::Merging;
65 if (boost::iequals(state,
"Releasing"sv)) {
66 return DaqSubState::Releasing;
68 if (boost::iequals(state,
"Completed"sv)) {
69 return DaqSubState::Completed;
71 if (boost::iequals(state,
"Aborted"sv)) {
72 return DaqSubState::Aborted;
74 throw std::invalid_argument(fmt::format(
"Invalid DaqSubState '{}'", state));