Coverage Report

Created: 2025-08-03 06:23

/src/opendnp3/cpp/lib/src/gen/CommandStatus.cpp
Line
Count
Source (jump to first uncovered line)
1
//
2
//  _   _         ______    _ _ _   _             _ _ _
3
// | \ | |       |  ____|  | (_) | (_)           | | | |
4
// |  \| | ___   | |__   __| |_| |_ _ _ __   __ _| | | |
5
// | . ` |/ _ \  |  __| / _` | | __| | '_ \ / _` | | | |
6
// | |\  | (_) | | |___| (_| | | |_| | | | | (_| |_|_|_|
7
// |_| \_|\___/  |______\__,_|_|\__|_|_| |_|\__, (_|_|_)
8
//                                           __/ |
9
//                                          |___/
10
// 
11
// This file is auto-generated. Do not edit manually
12
// 
13
// Copyright 2013-2022 Step Function I/O, LLC
14
// 
15
// Licensed to Green Energy Corp (www.greenenergycorp.com) and Step Function I/O
16
// LLC (https://stepfunc.io) under one or more contributor license agreements.
17
// See the NOTICE file distributed with this work for additional information
18
// regarding copyright ownership. Green Energy Corp and Step Function I/O LLC license
19
// this file to you under the Apache License, Version 2.0 (the "License"); you
20
// may not use this file except in compliance with the License. You may obtain
21
// a copy of the License at:
22
// 
23
//   http://www.apache.org/licenses/LICENSE-2.0
24
// 
25
// Unless required by applicable law or agreed to in writing, software
26
// distributed under the License is distributed on an "AS IS" BASIS,
27
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
// See the License for the specific language governing permissions and
29
// limitations under the License.
30
//
31
32
#include "opendnp3/gen/CommandStatus.h"
33
#include <stdexcept>
34
35
namespace opendnp3 {
36
37
uint8_t CommandStatusSpec::to_type(CommandStatus arg)
38
35.9k
{
39
35.9k
  return static_cast<uint8_t>(arg);
40
35.9k
}
41
42
CommandStatus CommandStatusSpec::from_type(uint8_t arg)
43
52.8k
{
44
52.8k
  switch(arg)
45
52.8k
  {
46
8.45k
    case(0):
47
8.45k
      return CommandStatus::SUCCESS;
48
4.41k
    case(1):
49
4.41k
      return CommandStatus::TIMEOUT;
50
3.18k
    case(2):
51
3.18k
      return CommandStatus::NO_SELECT;
52
1.98k
    case(3):
53
1.98k
      return CommandStatus::FORMAT_ERROR;
54
2.03k
    case(4):
55
2.03k
      return CommandStatus::NOT_SUPPORTED;
56
2.13k
    case(5):
57
2.13k
      return CommandStatus::ALREADY_ACTIVE;
58
3.14k
    case(6):
59
3.14k
      return CommandStatus::HARDWARE_ERROR;
60
600
    case(7):
61
600
      return CommandStatus::LOCAL;
62
747
    case(8):
63
747
      return CommandStatus::TOO_MANY_OPS;
64
902
    case(9):
65
902
      return CommandStatus::NOT_AUTHORIZED;
66
760
    case(10):
67
760
      return CommandStatus::AUTOMATION_INHIBIT;
68
472
    case(11):
69
472
      return CommandStatus::PROCESSING_LIMITED;
70
774
    case(12):
71
774
      return CommandStatus::OUT_OF_RANGE;
72
411
    case(13):
73
411
      return CommandStatus::DOWNSTREAM_LOCAL;
74
338
    case(14):
75
338
      return CommandStatus::ALREADY_COMPLETE;
76
421
    case(15):
77
421
      return CommandStatus::BLOCKED;
78
1.16k
    case(16):
79
1.16k
      return CommandStatus::CANCELLED;
80
342
    case(17):
81
342
      return CommandStatus::BLOCKED_OTHER_MASTER;
82
540
    case(18):
83
540
      return CommandStatus::DOWNSTREAM_FAIL;
84
495
    case(126):
85
495
      return CommandStatus::NON_PARTICIPATING;
86
19.5k
    default:
87
19.5k
      return CommandStatus::UNDEFINED;
88
52.8k
  }
89
52.8k
}
90
91
char const* CommandStatusSpec::to_string(CommandStatus arg)
92
0
{
93
0
  switch(arg)
94
0
  {
95
0
    case(CommandStatus::SUCCESS):
96
0
      return "SUCCESS";
97
0
    case(CommandStatus::TIMEOUT):
98
0
      return "TIMEOUT";
99
0
    case(CommandStatus::NO_SELECT):
100
0
      return "NO_SELECT";
101
0
    case(CommandStatus::FORMAT_ERROR):
102
0
      return "FORMAT_ERROR";
103
0
    case(CommandStatus::NOT_SUPPORTED):
104
0
      return "NOT_SUPPORTED";
105
0
    case(CommandStatus::ALREADY_ACTIVE):
106
0
      return "ALREADY_ACTIVE";
107
0
    case(CommandStatus::HARDWARE_ERROR):
108
0
      return "HARDWARE_ERROR";
109
0
    case(CommandStatus::LOCAL):
110
0
      return "LOCAL";
111
0
    case(CommandStatus::TOO_MANY_OPS):
112
0
      return "TOO_MANY_OPS";
113
0
    case(CommandStatus::NOT_AUTHORIZED):
114
0
      return "NOT_AUTHORIZED";
115
0
    case(CommandStatus::AUTOMATION_INHIBIT):
116
0
      return "AUTOMATION_INHIBIT";
117
0
    case(CommandStatus::PROCESSING_LIMITED):
118
0
      return "PROCESSING_LIMITED";
119
0
    case(CommandStatus::OUT_OF_RANGE):
120
0
      return "OUT_OF_RANGE";
121
0
    case(CommandStatus::DOWNSTREAM_LOCAL):
122
0
      return "DOWNSTREAM_LOCAL";
123
0
    case(CommandStatus::ALREADY_COMPLETE):
124
0
      return "ALREADY_COMPLETE";
125
0
    case(CommandStatus::BLOCKED):
126
0
      return "BLOCKED";
127
0
    case(CommandStatus::CANCELLED):
128
0
      return "CANCELLED";
129
0
    case(CommandStatus::BLOCKED_OTHER_MASTER):
130
0
      return "BLOCKED_OTHER_MASTER";
131
0
    case(CommandStatus::DOWNSTREAM_FAIL):
132
0
      return "DOWNSTREAM_FAIL";
133
0
    case(CommandStatus::NON_PARTICIPATING):
134
0
      return "NON_PARTICIPATING";
135
0
    default:
136
0
      return "UNDEFINED";
137
0
  }
138
0
}
139
140
char const* CommandStatusSpec::to_human_string(CommandStatus arg)
141
0
{
142
0
  switch(arg)
143
0
  {
144
0
    case(CommandStatus::SUCCESS):
145
0
      return "SUCCESS";
146
0
    case(CommandStatus::TIMEOUT):
147
0
      return "TIMEOUT";
148
0
    case(CommandStatus::NO_SELECT):
149
0
      return "NO_SELECT";
150
0
    case(CommandStatus::FORMAT_ERROR):
151
0
      return "FORMAT_ERROR";
152
0
    case(CommandStatus::NOT_SUPPORTED):
153
0
      return "NOT_SUPPORTED";
154
0
    case(CommandStatus::ALREADY_ACTIVE):
155
0
      return "ALREADY_ACTIVE";
156
0
    case(CommandStatus::HARDWARE_ERROR):
157
0
      return "HARDWARE_ERROR";
158
0
    case(CommandStatus::LOCAL):
159
0
      return "LOCAL";
160
0
    case(CommandStatus::TOO_MANY_OPS):
161
0
      return "TOO_MANY_OPS";
162
0
    case(CommandStatus::NOT_AUTHORIZED):
163
0
      return "NOT_AUTHORIZED";
164
0
    case(CommandStatus::AUTOMATION_INHIBIT):
165
0
      return "AUTOMATION_INHIBIT";
166
0
    case(CommandStatus::PROCESSING_LIMITED):
167
0
      return "PROCESSING_LIMITED";
168
0
    case(CommandStatus::OUT_OF_RANGE):
169
0
      return "OUT_OF_RANGE";
170
0
    case(CommandStatus::DOWNSTREAM_LOCAL):
171
0
      return "DOWNSTREAM_LOCAL";
172
0
    case(CommandStatus::ALREADY_COMPLETE):
173
0
      return "ALREADY_COMPLETE";
174
0
    case(CommandStatus::BLOCKED):
175
0
      return "BLOCKED";
176
0
    case(CommandStatus::CANCELLED):
177
0
      return "CANCELLED";
178
0
    case(CommandStatus::BLOCKED_OTHER_MASTER):
179
0
      return "BLOCKED_OTHER_MASTER";
180
0
    case(CommandStatus::DOWNSTREAM_FAIL):
181
0
      return "DOWNSTREAM_FAIL";
182
0
    case(CommandStatus::NON_PARTICIPATING):
183
0
      return "NON_PARTICIPATING";
184
0
    default:
185
0
      return "UNDEFINED";
186
0
  }
187
0
}
188
189
CommandStatus CommandStatusSpec::from_string(const std::string& arg)
190
0
{
191
0
  if(arg == "SUCCESS") return CommandStatus::SUCCESS;
192
0
  if(arg == "TIMEOUT") return CommandStatus::TIMEOUT;
193
0
  if(arg == "NO_SELECT") return CommandStatus::NO_SELECT;
194
0
  if(arg == "FORMAT_ERROR") return CommandStatus::FORMAT_ERROR;
195
0
  if(arg == "NOT_SUPPORTED") return CommandStatus::NOT_SUPPORTED;
196
0
  if(arg == "ALREADY_ACTIVE") return CommandStatus::ALREADY_ACTIVE;
197
0
  if(arg == "HARDWARE_ERROR") return CommandStatus::HARDWARE_ERROR;
198
0
  if(arg == "LOCAL") return CommandStatus::LOCAL;
199
0
  if(arg == "TOO_MANY_OPS") return CommandStatus::TOO_MANY_OPS;
200
0
  if(arg == "NOT_AUTHORIZED") return CommandStatus::NOT_AUTHORIZED;
201
0
  if(arg == "AUTOMATION_INHIBIT") return CommandStatus::AUTOMATION_INHIBIT;
202
0
  if(arg == "PROCESSING_LIMITED") return CommandStatus::PROCESSING_LIMITED;
203
0
  if(arg == "OUT_OF_RANGE") return CommandStatus::OUT_OF_RANGE;
204
0
  if(arg == "DOWNSTREAM_LOCAL") return CommandStatus::DOWNSTREAM_LOCAL;
205
0
  if(arg == "ALREADY_COMPLETE") return CommandStatus::ALREADY_COMPLETE;
206
0
  if(arg == "BLOCKED") return CommandStatus::BLOCKED;
207
0
  if(arg == "CANCELLED") return CommandStatus::CANCELLED;
208
0
  if(arg == "BLOCKED_OTHER_MASTER") return CommandStatus::BLOCKED_OTHER_MASTER;
209
0
  if(arg == "DOWNSTREAM_FAIL") return CommandStatus::DOWNSTREAM_FAIL;
210
0
  if(arg == "NON_PARTICIPATING") return CommandStatus::NON_PARTICIPATING;
211
0
  else return CommandStatus::UNDEFINED;
212
0
}
213
214
215
}