29 constexpr
bool same(
char const*
x,
char const*
y) {
30 return !*
x && !*
y ?
true : (*
x == *
y && same(
x + 1,
y + 1));
34 constexpr
T keyToValue(
char const*
label, entry<T>
const* entries) {
35 return !entries->label ? entries->value
36 : same(entries->label,
label) ? entries->value : keyToValue(
label, entries + 1);
40 constexpr
char const* valueToKey(
T value, entry<T>
const* entries) {
41 return !entries->label ? entries->label
42 : entries->value ==
value ? entries->label : valueToKey(
value, entries + 1);
44 constexpr entry<L1GtBoardType> l1GtBoardTypeStringToEnumMap[] = {{
"GTFE",
GTFE},
53 constexpr entry<L1GtPsbQuad> l1GtPsbQuadStringToEnumMap[] = {{
"Free",
Free},
82 constexpr entry<L1GtConditionType> l1GtConditionTypeStringToEnumMap[] = {{
"TypeNull",
TypeNull},
102 constexpr entry<L1GtConditionCategory> l1GtConditionCategoryStringToEnumMap[] = {
121 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" <<
label <<
"' is not a recognized L1GtBoardType. \n Return BoardNull.";
126 edm::LogInfo(
"L1GtDefinitions") <<
"\n BoardNull means no valid board type defined!";
133 char const*
result = valueToKey(boardType, l1GtBoardTypeStringToEnumMap);
135 edm::LogInfo(
"L1GtDefinitions") <<
"\n BoardNull means no valid board type defined!";
138 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" << boardType <<
"' is not a recognized L1GtBoardType. "
139 <<
"\n Return BoardNull, which means no valid board type defined!";
152 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" <<
label <<
"' is not a recognized L1GtPsbQuad. \n Return PsbQuadNull.";
157 edm::LogInfo(
"L1GtDefinitions") <<
"\n PsbQuadNull means no valid PSB quadruplet defined!";
164 char const*
result = valueToKey(psbQuad, l1GtPsbQuadStringToEnumMap);
166 edm::LogInfo(
"L1GtDefinitions") <<
"\n PsbQuadNull means no valid PSB quadruplet defined!";
169 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" << psbQuad <<
"' is not a recognized L1GtPsbQuad. "
170 <<
"\n Return PsbQuadNull, which means no valid PSB quadruplet defined!";
183 <<
"' is not a recognized L1GtConditionType. \n Return TypeNull.";
189 edm::LogInfo(
"L1GtDefinitions") <<
"\n TypeNull means no valid condition type defined!";
198 edm::LogInfo(
"L1GtDefinitions") <<
"\n Return TypeNull, which means no valid condition type defined!";
202 <<
"\n Return TypeNull, which means no valid condition type defined!";
213 <<
"' is not a recognized L1GtConditionCategory. \n Return CondNull.";
219 edm::LogInfo(
"L1GtDefinitions") <<
"\n CondNull means no valid condition category defined!";
226 char const*
result = valueToKey(conditionCategory, l1GtConditionCategoryStringToEnumMap);
228 edm::LogInfo(
"L1GtDefinitions") <<
"\n Return CondNull, which means no valid condition category defined!";
232 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" << conditionCategory <<
"' is not a recognized L1GtConditionCategory. "
233 <<
"\n Return CondNull, which means no valid condition category defined!";