-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathruntype_strings.go
More file actions
193 lines (170 loc) · 6.35 KB
/
runtype_strings.go
File metadata and controls
193 lines (170 loc) · 6.35 KB
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
// Code generated by "enumer -type=RunType -yaml -json -text -transform=upper -output=runtype_strings.go"; DO NOT EDIT.
package runtype
import (
"encoding/json"
"fmt"
"strings"
)
const _RunTypeName = "NONEPHYSICSTECHNICALPEDESTALPULSERLASERCALIBRATION_ITHR_TUNINGCALIBRATION_VCASN_TUNINGCALIBRATION_THR_SCANCALIBRATION_DIGITAL_SCANCALIBRATION_ANALOG_SCANCALIBRATION_FHRCALIBRATION_ALPIDE_SCANCALIBRATIONCOSMICSSYNTHETICNOISECALIBRATION_PULSE_LENGTHCALIBRATION_VRESETD"
var _RunTypeIndex = [...]uint16{0, 4, 11, 20, 28, 34, 39, 62, 86, 106, 130, 153, 168, 191, 202, 209, 218, 223, 247, 266}
const _RunTypeLowerName = "nonephysicstechnicalpedestalpulserlasercalibration_ithr_tuningcalibration_vcasn_tuningcalibration_thr_scancalibration_digital_scancalibration_analog_scancalibration_fhrcalibration_alpide_scancalibrationcosmicssyntheticnoisecalibration_pulse_lengthcalibration_vresetd"
func (i RunType) String() string {
if i < 0 || i >= RunType(len(_RunTypeIndex)-1) {
return fmt.Sprintf("RunType(%d)", i)
}
return _RunTypeName[_RunTypeIndex[i]:_RunTypeIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _RunTypeNoOp() {
var x [1]struct{}
_ = x[NONE-(0)]
_ = x[PHYSICS-(1)]
_ = x[TECHNICAL-(2)]
_ = x[PEDESTAL-(3)]
_ = x[PULSER-(4)]
_ = x[LASER-(5)]
_ = x[CALIBRATION_ITHR_TUNING-(6)]
_ = x[CALIBRATION_VCASN_TUNING-(7)]
_ = x[CALIBRATION_THR_SCAN-(8)]
_ = x[CALIBRATION_DIGITAL_SCAN-(9)]
_ = x[CALIBRATION_ANALOG_SCAN-(10)]
_ = x[CALIBRATION_FHR-(11)]
_ = x[CALIBRATION_ALPIDE_SCAN-(12)]
_ = x[CALIBRATION-(13)]
_ = x[COSMICS-(14)]
_ = x[SYNTHETIC-(15)]
_ = x[NOISE-(16)]
_ = x[CALIBRATION_PULSE_LENGTH-(17)]
_ = x[CALIBRATION_VRESETD-(18)]
}
var _RunTypeValues = []RunType{NONE, PHYSICS, TECHNICAL, PEDESTAL, PULSER, LASER, CALIBRATION_ITHR_TUNING, CALIBRATION_VCASN_TUNING, CALIBRATION_THR_SCAN, CALIBRATION_DIGITAL_SCAN, CALIBRATION_ANALOG_SCAN, CALIBRATION_FHR, CALIBRATION_ALPIDE_SCAN, CALIBRATION, COSMICS, SYNTHETIC, NOISE, CALIBRATION_PULSE_LENGTH, CALIBRATION_VRESETD}
var _RunTypeNameToValueMap = map[string]RunType{
_RunTypeName[0:4]: NONE,
_RunTypeLowerName[0:4]: NONE,
_RunTypeName[4:11]: PHYSICS,
_RunTypeLowerName[4:11]: PHYSICS,
_RunTypeName[11:20]: TECHNICAL,
_RunTypeLowerName[11:20]: TECHNICAL,
_RunTypeName[20:28]: PEDESTAL,
_RunTypeLowerName[20:28]: PEDESTAL,
_RunTypeName[28:34]: PULSER,
_RunTypeLowerName[28:34]: PULSER,
_RunTypeName[34:39]: LASER,
_RunTypeLowerName[34:39]: LASER,
_RunTypeName[39:62]: CALIBRATION_ITHR_TUNING,
_RunTypeLowerName[39:62]: CALIBRATION_ITHR_TUNING,
_RunTypeName[62:86]: CALIBRATION_VCASN_TUNING,
_RunTypeLowerName[62:86]: CALIBRATION_VCASN_TUNING,
_RunTypeName[86:106]: CALIBRATION_THR_SCAN,
_RunTypeLowerName[86:106]: CALIBRATION_THR_SCAN,
_RunTypeName[106:130]: CALIBRATION_DIGITAL_SCAN,
_RunTypeLowerName[106:130]: CALIBRATION_DIGITAL_SCAN,
_RunTypeName[130:153]: CALIBRATION_ANALOG_SCAN,
_RunTypeLowerName[130:153]: CALIBRATION_ANALOG_SCAN,
_RunTypeName[153:168]: CALIBRATION_FHR,
_RunTypeLowerName[153:168]: CALIBRATION_FHR,
_RunTypeName[168:191]: CALIBRATION_ALPIDE_SCAN,
_RunTypeLowerName[168:191]: CALIBRATION_ALPIDE_SCAN,
_RunTypeName[191:202]: CALIBRATION,
_RunTypeLowerName[191:202]: CALIBRATION,
_RunTypeName[202:209]: COSMICS,
_RunTypeLowerName[202:209]: COSMICS,
_RunTypeName[209:218]: SYNTHETIC,
_RunTypeLowerName[209:218]: SYNTHETIC,
_RunTypeName[218:223]: NOISE,
_RunTypeLowerName[218:223]: NOISE,
_RunTypeName[223:247]: CALIBRATION_PULSE_LENGTH,
_RunTypeLowerName[223:247]: CALIBRATION_PULSE_LENGTH,
_RunTypeName[247:266]: CALIBRATION_VRESETD,
_RunTypeLowerName[247:266]: CALIBRATION_VRESETD,
}
var _RunTypeNames = []string{
_RunTypeName[0:4],
_RunTypeName[4:11],
_RunTypeName[11:20],
_RunTypeName[20:28],
_RunTypeName[28:34],
_RunTypeName[34:39],
_RunTypeName[39:62],
_RunTypeName[62:86],
_RunTypeName[86:106],
_RunTypeName[106:130],
_RunTypeName[130:153],
_RunTypeName[153:168],
_RunTypeName[168:191],
_RunTypeName[191:202],
_RunTypeName[202:209],
_RunTypeName[209:218],
_RunTypeName[218:223],
_RunTypeName[223:247],
_RunTypeName[247:266],
}
// RunTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func RunTypeString(s string) (RunType, error) {
if val, ok := _RunTypeNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _RunTypeNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to RunType values", s)
}
// RunTypeValues returns all values of the enum
func RunTypeValues() []RunType {
return _RunTypeValues
}
// RunTypeStrings returns a slice of all String values of the enum
func RunTypeStrings() []string {
strs := make([]string, len(_RunTypeNames))
copy(strs, _RunTypeNames)
return strs
}
// IsARunType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i RunType) IsARunType() bool {
for _, v := range _RunTypeValues {
if i == v {
return true
}
}
return false
}
// MarshalJSON implements the json.Marshaler interface for RunType
func (i RunType) MarshalJSON() ([]byte, error) {
return json.Marshal(i.String())
}
// UnmarshalJSON implements the json.Unmarshaler interface for RunType
func (i *RunType) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return fmt.Errorf("RunType should be a string, got %s", data)
}
var err error
*i, err = RunTypeString(s)
return err
}
// MarshalText implements the encoding.TextMarshaler interface for RunType
func (i RunType) MarshalText() ([]byte, error) {
return []byte(i.String()), nil
}
// UnmarshalText implements the encoding.TextUnmarshaler interface for RunType
func (i *RunType) UnmarshalText(text []byte) error {
var err error
*i, err = RunTypeString(string(text))
return err
}
// MarshalYAML implements a YAML Marshaler for RunType
func (i RunType) MarshalYAML() (interface{}, error) {
return i.String(), nil
}
// UnmarshalYAML implements a YAML Unmarshaler for RunType
func (i *RunType) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
var err error
*i, err = RunTypeString(s)
return err
}