-
Notifications
You must be signed in to change notification settings - Fork 23
/
systemid_strings.go
253 lines (231 loc) · 5.95 KB
/
systemid_strings.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
// Code generated by "enumer -type=ID -yaml -json -text -transform=upper -output=systemid_strings.go"; DO NOT EDIT.
package system
import (
"encoding/json"
"fmt"
"strings"
)
const (
_IDName_0 = "PDPEPNFLP"
_IDLowerName_0 = "pdpepnflp"
_IDName_1 = "TPCTRDTOFHMPPHSCPV"
_IDLowerName_1 = "tpctrdtofhmpphscpv"
_IDName_2 = "MCH"
_IDLowerName_2 = "mch"
_IDName_3 = "ZDC"
_IDLowerName_3 = "zdc"
_IDName_4 = "TRGEMCTST"
_IDLowerName_4 = "trgemctst"
_IDName_5 = "ITSFDDFT0FV0MFTMIDDCSFOC"
_IDLowerName_5 = "itsfddft0fv0mftmiddcsfoc"
_IDName_6 = "FITNIL"
_IDLowerName_6 = "fitnil"
)
var (
_IDIndex_0 = [...]uint8{0, 3, 6, 9}
_IDIndex_1 = [...]uint8{0, 3, 6, 9, 12, 15, 18}
_IDIndex_2 = [...]uint8{0, 3}
_IDIndex_3 = [...]uint8{0, 3}
_IDIndex_4 = [...]uint8{0, 3, 6, 9}
_IDIndex_5 = [...]uint8{0, 3, 6, 9, 12, 15, 18, 21, 24}
_IDIndex_6 = [...]uint8{0, 3, 6}
)
func (i ID) String() string {
switch {
case -3 <= i && i <= -1:
i -= -3
return _IDName_0[_IDIndex_0[i]:_IDIndex_0[i+1]]
case 3 <= i && i <= 8:
i -= 3
return _IDName_1[_IDIndex_1[i]:_IDIndex_1[i+1]]
case i == 10:
return _IDName_2
case i == 15:
return _IDName_3
case 17 <= i && i <= 19:
i -= 17
return _IDName_4[_IDIndex_4[i]:_IDIndex_4[i+1]]
case 32 <= i && i <= 39:
i -= 32
return _IDName_5[_IDIndex_5[i]:_IDIndex_5[i+1]]
case 254 <= i && i <= 255:
i -= 254
return _IDName_6[_IDIndex_6[i]:_IDIndex_6[i+1]]
default:
return fmt.Sprintf("ID(%d)", i)
}
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _IDNoOp() {
var x [1]struct{}
_ = x[PDP-(-3)]
_ = x[EPN-(-2)]
_ = x[FLP-(-1)]
_ = x[TPC-(3)]
_ = x[TRD-(4)]
_ = x[TOF-(5)]
_ = x[HMP-(6)]
_ = x[PHS-(7)]
_ = x[CPV-(8)]
_ = x[MCH-(10)]
_ = x[ZDC-(15)]
_ = x[TRG-(17)]
_ = x[EMC-(18)]
_ = x[TST-(19)]
_ = x[ITS-(32)]
_ = x[FDD-(33)]
_ = x[FT0-(34)]
_ = x[FV0-(35)]
_ = x[MFT-(36)]
_ = x[MID-(37)]
_ = x[DCS-(38)]
_ = x[FOC-(39)]
_ = x[FIT-(254)]
_ = x[NIL-(255)]
}
var _IDValues = []ID{PDP, EPN, FLP, TPC, TRD, TOF, HMP, PHS, CPV, MCH, ZDC, TRG, EMC, TST, ITS, FDD, FT0, FV0, MFT, MID, DCS, FOC, FIT, NIL}
var _IDNameToValueMap = map[string]ID{
_IDName_0[0:3]: PDP,
_IDLowerName_0[0:3]: PDP,
_IDName_0[3:6]: EPN,
_IDLowerName_0[3:6]: EPN,
_IDName_0[6:9]: FLP,
_IDLowerName_0[6:9]: FLP,
_IDName_1[0:3]: TPC,
_IDLowerName_1[0:3]: TPC,
_IDName_1[3:6]: TRD,
_IDLowerName_1[3:6]: TRD,
_IDName_1[6:9]: TOF,
_IDLowerName_1[6:9]: TOF,
_IDName_1[9:12]: HMP,
_IDLowerName_1[9:12]: HMP,
_IDName_1[12:15]: PHS,
_IDLowerName_1[12:15]: PHS,
_IDName_1[15:18]: CPV,
_IDLowerName_1[15:18]: CPV,
_IDName_2[0:3]: MCH,
_IDLowerName_2[0:3]: MCH,
_IDName_3[0:3]: ZDC,
_IDLowerName_3[0:3]: ZDC,
_IDName_4[0:3]: TRG,
_IDLowerName_4[0:3]: TRG,
_IDName_4[3:6]: EMC,
_IDLowerName_4[3:6]: EMC,
_IDName_4[6:9]: TST,
_IDLowerName_4[6:9]: TST,
_IDName_5[0:3]: ITS,
_IDLowerName_5[0:3]: ITS,
_IDName_5[3:6]: FDD,
_IDLowerName_5[3:6]: FDD,
_IDName_5[6:9]: FT0,
_IDLowerName_5[6:9]: FT0,
_IDName_5[9:12]: FV0,
_IDLowerName_5[9:12]: FV0,
_IDName_5[12:15]: MFT,
_IDLowerName_5[12:15]: MFT,
_IDName_5[15:18]: MID,
_IDLowerName_5[15:18]: MID,
_IDName_5[18:21]: DCS,
_IDLowerName_5[18:21]: DCS,
_IDName_5[21:24]: FOC,
_IDLowerName_5[21:24]: FOC,
_IDName_6[0:3]: FIT,
_IDLowerName_6[0:3]: FIT,
_IDName_6[3:6]: NIL,
_IDLowerName_6[3:6]: NIL,
}
var _IDNames = []string{
_IDName_0[0:3],
_IDName_0[3:6],
_IDName_0[6:9],
_IDName_1[0:3],
_IDName_1[3:6],
_IDName_1[6:9],
_IDName_1[9:12],
_IDName_1[12:15],
_IDName_1[15:18],
_IDName_2[0:3],
_IDName_3[0:3],
_IDName_4[0:3],
_IDName_4[3:6],
_IDName_4[6:9],
_IDName_5[0:3],
_IDName_5[3:6],
_IDName_5[6:9],
_IDName_5[9:12],
_IDName_5[12:15],
_IDName_5[15:18],
_IDName_5[18:21],
_IDName_5[21:24],
_IDName_6[0:3],
_IDName_6[3:6],
}
// IDString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func IDString(s string) (ID, error) {
if val, ok := _IDNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _IDNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to ID values", s)
}
// IDValues returns all values of the enum
func IDValues() []ID {
return _IDValues
}
// IDStrings returns a slice of all String values of the enum
func IDStrings() []string {
strs := make([]string, len(_IDNames))
copy(strs, _IDNames)
return strs
}
// IsAID returns "true" if the value is listed in the enum definition. "false" otherwise
func (i ID) IsAID() bool {
for _, v := range _IDValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for ID
func (i ID) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for ID
func (i *ID) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("ID should be a string, got %s", data)
}
var err error
*i, err = IDString(s)
return err
}
// MarshalText implements the encoding.TextMarshaler interface for ID
func (i ID) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for ID
func (i *ID) UnmarshalText(text []byte) error {
var err error
*i, err = IDString(string(text))
return err
}
// MarshalYAML implements a YAML Marshaler for ID
func (i ID) MarshalYAML() (interface{}, error) {
return i.String(), nil
}
// UnmarshalYAML implements a YAML Unmarshaler for ID
func (i *ID) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = IDString(s)
return err
}