30 constexpr
bool same(
char const *
x,
char const *
y) {
31 return !*
x && !*
y ?
true : (*
x == *
y && same(
x + 1,
y + 1));
35 constexpr
T keyToValue(
char const *
label, entry<T>
const *entries) {
36 return !entries->label ? entries->value
37 : same(entries->label,
label) ? entries->value : 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 : valueToKey(
value, entries + 1);
45 constexpr entry<l1t::L1GtBoardType> l1GtBoardTypeStringToEnumMap[] = {
49 constexpr entry<l1t::GtConditionType> l1GtConditionTypeStringToEnumMap[] = {
84 constexpr entry<l1t::GtConditionCategory> l1GtConditionCategoryStringToEnumMap[] = {
100 <<
"' is not a recognized l1t::L1GtBoardType. \n Return l1t::BoardNull.";
105 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::BoardNull means no valid board type defined!";
112 char const *
result = valueToKey(boardType, l1GtBoardTypeStringToEnumMap);
114 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::BoardNull means no valid board type defined!";
117 edm::LogInfo(
"L1TGlobal") <<
"\n '" << boardType <<
"' is not a recognized l1t::L1GtBoardType. "
118 <<
"\n Return l1t::BoardNull, which means no valid board type defined!";
119 return "l1t::BoardNull";
131 <<
"' is not a recognized l1t::GtConditionType. \n Return l1t::TypeNull.";
137 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::TypeNull means no valid condition type defined!";
146 edm::LogInfo(
"L1TGlobal") <<
"\n Return l1t::TypeNull, which means no valid condition type defined!";
150 <<
"\n Return l1t::TypeNull, which means no valid condition type defined!";
161 <<
"' is not a recognized l1t::GtConditionCategory. \n Return l1t::CondNull.";
167 edm::LogInfo(
"L1TGlobal") <<
"\n l1t::CondNull means no valid condition category defined!";
174 char const *
result = valueToKey(conditionCategory, l1GtConditionCategoryStringToEnumMap);
176 edm::LogInfo(
"L1TGlobal") <<
"\n Return l1t::CondNull, which means no valid condition category defined!";
180 edm::LogInfo(
"L1TGlobal") <<
"\n '" << conditionCategory <<
"' is not a recognized l1t::GtConditionCategory. "
181 <<
"\n Return l1t::CondNull, which means no valid condition category defined!";