Coverage Report

Created: 2025-11-24 06:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opendnp3/cpp/lib/src/gen/TripCloseCode.cpp
Line
Count
Source
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/TripCloseCode.h"
33
#include <stdexcept>
34
35
namespace opendnp3 {
36
37
uint8_t TripCloseCodeSpec::to_type(TripCloseCode arg)
38
1.20k
{
39
1.20k
  return static_cast<uint8_t>(arg);
40
1.20k
}
41
42
TripCloseCode TripCloseCodeSpec::from_type(uint8_t arg)
43
1.20k
{
44
1.20k
  switch(arg)
45
1.20k
  {
46
773
    case(0x0):
47
773
      return TripCloseCode::NUL;
48
161
    case(0x1):
49
161
      return TripCloseCode::CLOSE;
50
56
    case(0x2):
51
56
      return TripCloseCode::TRIP;
52
214
    case(0x3):
53
214
      return TripCloseCode::RESERVED;
54
0
    default:
55
0
      throw new std::invalid_argument("Unknown value");
56
1.20k
  }
57
1.20k
}
58
59
char const* TripCloseCodeSpec::to_string(TripCloseCode arg)
60
0
{
61
0
  switch(arg)
62
0
  {
63
0
    case(TripCloseCode::NUL):
64
0
      return "NUL";
65
0
    case(TripCloseCode::CLOSE):
66
0
      return "CLOSE";
67
0
    case(TripCloseCode::TRIP):
68
0
      return "TRIP";
69
0
    case(TripCloseCode::RESERVED):
70
0
      return "RESERVED";
71
0
    default:
72
0
      return "UNDEFINED";
73
0
  }
74
0
}
75
76
char const* TripCloseCodeSpec::to_human_string(TripCloseCode arg)
77
1.20k
{
78
1.20k
  switch(arg)
79
1.20k
  {
80
773
    case(TripCloseCode::NUL):
81
773
      return "NUL";
82
161
    case(TripCloseCode::CLOSE):
83
161
      return "CLOSE";
84
56
    case(TripCloseCode::TRIP):
85
56
      return "TRIP";
86
214
    case(TripCloseCode::RESERVED):
87
214
      return "RESERVED";
88
0
    default:
89
0
      return "UNDEFINED";
90
1.20k
  }
91
1.20k
}
92
93
TripCloseCode TripCloseCodeSpec::from_string(const std::string& arg)
94
0
{
95
0
  if(arg == "NUL") return TripCloseCode::NUL;
96
0
  if(arg == "CLOSE") return TripCloseCode::CLOSE;
97
0
  if(arg == "TRIP") return TripCloseCode::TRIP;
98
0
  if(arg == "RESERVED") return TripCloseCode::RESERVED;
99
0
  else throw std::invalid_argument(std::string("Unknown value: ") + arg);
100
0
}
101
102
103
}