/src/opendnp3/cpp/lib/src/gen/IntervalUnits.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/IntervalUnits.h" |
33 | | #include <stdexcept> |
34 | | |
35 | | namespace opendnp3 { |
36 | | |
37 | | uint8_t IntervalUnitsSpec::to_type(IntervalUnits arg) |
38 | 0 | { |
39 | 0 | return static_cast<uint8_t>(arg); |
40 | 0 | } |
41 | | |
42 | | IntervalUnits IntervalUnitsSpec::from_type(uint8_t arg) |
43 | 1.62k | { |
44 | 1.62k | switch(arg) |
45 | 1.62k | { |
46 | 234 | case(0x0): |
47 | 234 | return IntervalUnits::NoRepeat; |
48 | 34 | case(0x1): |
49 | 34 | return IntervalUnits::Milliseconds; |
50 | 17 | case(0x2): |
51 | 17 | return IntervalUnits::Seconds; |
52 | 16 | case(0x3): |
53 | 16 | return IntervalUnits::Minutes; |
54 | 95 | case(0x4): |
55 | 95 | return IntervalUnits::Hours; |
56 | 22 | case(0x5): |
57 | 22 | return IntervalUnits::Days; |
58 | 8 | case(0x6): |
59 | 8 | return IntervalUnits::Weeks; |
60 | 174 | case(0x7): |
61 | 174 | return IntervalUnits::Months7; |
62 | 13 | case(0x8): |
63 | 13 | return IntervalUnits::Months8; |
64 | 9 | case(0x9): |
65 | 9 | return IntervalUnits::Months9; |
66 | 15 | case(0xA): |
67 | 15 | return IntervalUnits::Seasons; |
68 | 987 | default: |
69 | 987 | return IntervalUnits::Undefined; |
70 | 1.62k | } |
71 | 1.62k | } |
72 | | |
73 | | char const* IntervalUnitsSpec::to_string(IntervalUnits arg) |
74 | 0 | { |
75 | 0 | switch(arg) |
76 | 0 | { |
77 | 0 | case(IntervalUnits::NoRepeat): |
78 | 0 | return "NoRepeat"; |
79 | 0 | case(IntervalUnits::Milliseconds): |
80 | 0 | return "Milliseconds"; |
81 | 0 | case(IntervalUnits::Seconds): |
82 | 0 | return "Seconds"; |
83 | 0 | case(IntervalUnits::Minutes): |
84 | 0 | return "Minutes"; |
85 | 0 | case(IntervalUnits::Hours): |
86 | 0 | return "Hours"; |
87 | 0 | case(IntervalUnits::Days): |
88 | 0 | return "Days"; |
89 | 0 | case(IntervalUnits::Weeks): |
90 | 0 | return "Weeks"; |
91 | 0 | case(IntervalUnits::Months7): |
92 | 0 | return "Months7"; |
93 | 0 | case(IntervalUnits::Months8): |
94 | 0 | return "Months8"; |
95 | 0 | case(IntervalUnits::Months9): |
96 | 0 | return "Months9"; |
97 | 0 | case(IntervalUnits::Seasons): |
98 | 0 | return "Seasons"; |
99 | 0 | default: |
100 | 0 | return "Undefined"; |
101 | 0 | } |
102 | 0 | } |
103 | | |
104 | | char const* IntervalUnitsSpec::to_human_string(IntervalUnits arg) |
105 | 1.62k | { |
106 | 1.62k | switch(arg) |
107 | 1.62k | { |
108 | 234 | case(IntervalUnits::NoRepeat): |
109 | 234 | return "NoRepeat"; |
110 | 34 | case(IntervalUnits::Milliseconds): |
111 | 34 | return "Milliseconds"; |
112 | 17 | case(IntervalUnits::Seconds): |
113 | 17 | return "Seconds"; |
114 | 16 | case(IntervalUnits::Minutes): |
115 | 16 | return "Minutes"; |
116 | 95 | case(IntervalUnits::Hours): |
117 | 95 | return "Hours"; |
118 | 22 | case(IntervalUnits::Days): |
119 | 22 | return "Days"; |
120 | 8 | case(IntervalUnits::Weeks): |
121 | 8 | return "Weeks"; |
122 | 174 | case(IntervalUnits::Months7): |
123 | 174 | return "Months7"; |
124 | 13 | case(IntervalUnits::Months8): |
125 | 13 | return "Months8"; |
126 | 9 | case(IntervalUnits::Months9): |
127 | 9 | return "Months9"; |
128 | 15 | case(IntervalUnits::Seasons): |
129 | 15 | return "Seasons"; |
130 | 987 | default: |
131 | 987 | return "Undefined"; |
132 | 1.62k | } |
133 | 1.62k | } |
134 | | |
135 | | IntervalUnits IntervalUnitsSpec::from_string(const std::string& arg) |
136 | 0 | { |
137 | 0 | if(arg == "NoRepeat") return IntervalUnits::NoRepeat; |
138 | 0 | if(arg == "Milliseconds") return IntervalUnits::Milliseconds; |
139 | 0 | if(arg == "Seconds") return IntervalUnits::Seconds; |
140 | 0 | if(arg == "Minutes") return IntervalUnits::Minutes; |
141 | 0 | if(arg == "Hours") return IntervalUnits::Hours; |
142 | 0 | if(arg == "Days") return IntervalUnits::Days; |
143 | 0 | if(arg == "Weeks") return IntervalUnits::Weeks; |
144 | 0 | if(arg == "Months7") return IntervalUnits::Months7; |
145 | 0 | if(arg == "Months8") return IntervalUnits::Months8; |
146 | 0 | if(arg == "Months9") return IntervalUnits::Months9; |
147 | 0 | if(arg == "Seasons") return IntervalUnits::Seasons; |
148 | 0 | else return IntervalUnits::Undefined; |
149 | 0 | } |
150 | | |
151 | | |
152 | | } |