31 constexpr
bool same(
char const *
x,
char const *
y) {
32 return !*
x && !*
y ?
true : (*
x == *
y && same(
x + 1,
y + 1));
36 constexpr
T keyToValue(
char const *
label, entry<T>
const *entries) {
37 return !entries->label ? entries->value
38 : same(entries->label,
label) ? entries->value
39 : keyToValue(
label, entries + 1);
43 constexpr
char const *valueToKey(
T value, entry<T>
const *entries) {
44 return !entries->label ? entries->label
45 : entries->value ==
value ? entries->label
46 : valueToKey(
value, entries + 1);
48 constexpr entry<l1t::L1GtBoardType> l1GtBoardTypeStringToEnumMap[] = {
52 constexpr entry<l1t::GtConditionType> l1GtConditionTypeStringToEnumMap[] = {
87 constexpr entry<l1t::GtConditionCategory> l1GtConditionCategoryStringToEnumMap[] = {
104 <<
"' is not a recognized l1t::L1GtBoardType. \n Return l1t::BoardNull.";
109 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::BoardNull means no valid board type defined!";
116 char const *
result = valueToKey(boardType, l1GtBoardTypeStringToEnumMap);
118 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::BoardNull means no valid board type defined!";
121 edm::LogInfo(
"L1TGlobal") <<
"\n '" << boardType <<
"' is not a recognized l1t::L1GtBoardType. "
122 <<
"\n Return l1t::BoardNull, which means no valid board type defined!";
123 return "l1t::BoardNull";
135 <<
"' is not a recognized l1t::GtConditionType. \n Return l1t::TypeNull.";
141 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::TypeNull means no valid condition type defined!";
150 edm::LogInfo(
"L1TGlobal") <<
"\n Return l1t::TypeNull, which means no valid condition type defined!";
154 <<
"\n Return l1t::TypeNull, which means no valid condition type defined!";
165 <<
"' is not a recognized l1t::GtConditionCategory. \n Return l1t::CondNull.";
171 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::CondNull means no valid condition category defined!";
178 char const *
result = valueToKey(conditionCategory, l1GtConditionCategoryStringToEnumMap);
180 edm::LogInfo(
"L1TGlobal") <<
"\n Return l1t::CondNull, which means no valid condition category defined!";
184 edm::LogInfo(
"L1TGlobal") <<
"\n '" << conditionCategory <<
"' is not a recognized l1t::GtConditionCategory. "
185 <<
"\n Return l1t::CondNull, which means no valid condition category defined!";