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
37 : keyToValue(
label, entries + 1);
41 constexpr
char const* valueToKey(
T value, entry<T>
const* entries) {
42 return !entries->label ? entries->label
43 : entries->value ==
value ? entries->label
44 : valueToKey(
value, entries + 1);
46 constexpr entry<L1GtBoardType> l1GtBoardTypeStringToEnumMap[] = {{
"GTFE",
GTFE},
55 constexpr entry<L1GtPsbQuad> l1GtPsbQuadStringToEnumMap[] = {{
"Free",
Free},
84 constexpr entry<L1GtConditionType> l1GtConditionTypeStringToEnumMap[] = {{
"TypeNull",
TypeNull},
104 constexpr entry<L1GtConditionCategory> l1GtConditionCategoryStringToEnumMap[] = {
123 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" <<
label <<
"' is not a recognized L1GtBoardType. \n Return BoardNull.";
128 edm::LogInfo(
"L1GtDefinitions") <<
"\n BoardNull means no valid board type defined!";
135 char const*
result = valueToKey(boardType, l1GtBoardTypeStringToEnumMap);
137 edm::LogInfo(
"L1GtDefinitions") <<
"\n BoardNull means no valid board type defined!";
140 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" << boardType <<
"' is not a recognized L1GtBoardType. "
141 <<
"\n Return BoardNull, which means no valid board type defined!";
154 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" <<
label <<
"' is not a recognized L1GtPsbQuad. \n Return PsbQuadNull.";
159 edm::LogInfo(
"L1GtDefinitions") <<
"\n PsbQuadNull means no valid PSB quadruplet defined!";
166 char const*
result = valueToKey(psbQuad, l1GtPsbQuadStringToEnumMap);
168 edm::LogInfo(
"L1GtDefinitions") <<
"\n PsbQuadNull means no valid PSB quadruplet defined!";
171 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" << psbQuad <<
"' is not a recognized L1GtPsbQuad. "
172 <<
"\n Return PsbQuadNull, which means no valid PSB quadruplet defined!";
185 <<
"' is not a recognized L1GtConditionType. \n Return TypeNull.";
191 edm::LogInfo(
"L1GtDefinitions") <<
"\n TypeNull means no valid condition type defined!";
200 edm::LogInfo(
"L1GtDefinitions") <<
"\n Return TypeNull, which means no valid condition type defined!";
204 <<
"\n Return TypeNull, which means no valid condition type defined!";
215 <<
"' is not a recognized L1GtConditionCategory. \n Return CondNull.";
221 edm::LogInfo(
"L1GtDefinitions") <<
"\n CondNull means no valid condition category defined!";
228 char const*
result = valueToKey(conditionCategory, l1GtConditionCategoryStringToEnumMap);
230 edm::LogInfo(
"L1GtDefinitions") <<
"\n Return CondNull, which means no valid condition category defined!";
234 edm::LogInfo(
"L1GtDefinitions") <<
"\n '" << conditionCategory <<
"' is not a recognized L1GtConditionCategory. "
235 <<
"\n Return CondNull, which means no valid condition category defined!";