Project
Loading...
Searching...
No Matches
ProcessingPoliciesHelpers.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
12#include <ostream>
13#include <istream>
14
15namespace o2::framework
16{
17
18std::istream& operator>>(std::istream& in, enum TerminationPolicy& policy)
19{
20 std::string token;
21 in >> token;
22 if (token == "quit") {
24 } else if (token == "wait") {
26 } else {
27 in.setstate(std::ios_base::failbit);
28 }
29 return in;
30}
31
32std::ostream& operator<<(std::ostream& out, const enum DriverMode& mode)
33{
35 out << "standalone";
36 } else if (mode == DriverMode::EMBEDDED) {
37 out << "embedded";
38 } else {
39 out.setstate(std::ios_base::failbit);
40 }
41 return out;
42}
43
44std::istream& operator>>(std::istream& in, enum DriverMode& mode)
45{
46 std::string token;
47 in >> token;
48 if (token == "standalone") {
50 } else if (token == "embedded") {
52 } else {
53 in.setstate(std::ios_base::failbit);
54 }
55 return in;
56}
57
58std::ostream& operator<<(std::ostream& out, const enum TerminationPolicy& policy)
59{
60 if (policy == TerminationPolicy::QUIT) {
61 out << "quit";
62 } else if (policy == TerminationPolicy::WAIT) {
63 out << "wait";
64 } else {
65 out.setstate(std::ios_base::failbit);
66 }
67 return out;
68}
69
70std::istream& operator>>(std::istream& in, enum EarlyForwardPolicy& policy)
71{
72 std::string token;
73 in >> token;
74 if (token == "never") {
76 } else if (token == "noraw") {
78 } else if (token == "always") {
80 } else {
81 in.setstate(std::ios_base::failbit);
82 }
83 return in;
84}
85
86std::ostream& operator<<(std::ostream& out, const enum EarlyForwardPolicy& policy)
87{
88 if (policy == EarlyForwardPolicy::NEVER) {
89 out << "never";
90 } else if (policy == EarlyForwardPolicy::NORAW) {
91 out << "noraw";
92 } else if (policy == EarlyForwardPolicy::ALWAYS) {
93 out << "always";
94 } else {
95 out.setstate(std::ios_base::failbit);
96 }
97 return out;
98}
99
100std::istream& operator>>(std::istream& in, enum LogParsingHelpers::LogLevel& level)
101{
102 std::string token;
103 in >> token;
104 if (token == "debug") {
105 level = LogParsingHelpers::LogLevel::Debug;
106 } else if (token == "info") {
107 level = LogParsingHelpers::LogLevel::Info;
108 } else if (token == "warning") {
109 level = LogParsingHelpers::LogLevel::Warning;
110 } else if (token == "error") {
111 level = LogParsingHelpers::LogLevel::Error;
112 } else if (token == "fatal") {
113 level = LogParsingHelpers::LogLevel::Fatal;
114 } else {
115 in.setstate(std::ios_base::failbit);
116 }
117 return in;
118}
119
120std::ostream& operator<<(std::ostream& out, const enum LogParsingHelpers::LogLevel& level)
121{
122 if (level == LogParsingHelpers::LogLevel::Debug) {
123 out << "debug";
124 } else if (level == LogParsingHelpers::LogLevel::Info) {
125 out << "info";
126 } else if (level == LogParsingHelpers::LogLevel::Warning) {
127 out << "warning";
128 } else if (level == LogParsingHelpers::LogLevel::Error) {
129 out << "error";
130 } else if (level == LogParsingHelpers::LogLevel::Fatal) {
131 out << "fatal";
132 } else {
133 out.setstate(std::ios_base::failbit);
134 }
135 return out;
136}
137} // namespace o2::framework
GLenum mode
Definition glcorearb.h:266
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::ostream & operator<<(std::ostream &s, ChannelType const &type)
Stream operators so that we can use ChannelType with Boost.Test.
EarlyForwardPolicy
When to enable the early forwarding optimization:
@ STANDALONE
Default mode. The master is responsible for spawning and controlling the devices.
std::istream & operator>>(std::istream &in, enum TerminationPolicy &policy)
LogLevel
Possible log levels for device log entries.