1 #ifndef FWCore_ParameterSet_ParameterSwitch_h 2 #define FWCore_ParameterSet_ParameterSwitch_h 27 typedef std::map<T, edm::value_ptr<ParameterDescriptionNode> >
CaseMap;
28 typedef typename std::map<T, edm::value_ptr<ParameterDescriptionNode> >::const_iterator
CaseMapConstIter;
33 if (cases->duplicateCaseValues()) {
42 std::set<ParameterTypes>& parameterTypes,
43 std::set<ParameterTypes>& wildcardTypes)
const override {
44 std::set<std::string> caseLabels;
45 std::set<ParameterTypes> caseParameterTypes;
46 std::set<ParameterTypes> caseWildcardTypes;
49 std::placeholders::_1,
51 std::ref(caseParameterTypes),
52 std::ref(caseWildcardTypes)));
70 switchValue =
pset.getUntrackedParameter<
T>(
switch_.label());
72 typename CaseMap::const_iterator selectedCase =
cases_.find(switchValue);
73 if (selectedCase !=
cases_.end()) {
74 selectedCase->second->validate(
pset, validatedLabels,
false);
77 ss <<
"The switch parameter with label \"" <<
switch_.label() <<
"\" has been assigned an illegal value.\n" 78 <<
"The value from the configuration is \"" << switchValue <<
"\".\n" 79 <<
"The allowed values are:\n";
82 ss <<
" " << iter->first <<
"\n";
94 bool& wroteSomething)
const override {
97 if (std::holds_alternative<cfi::ClassFile>(
options)) {
98 std::set<std::string>
labels;
99 std::set<ParameterTypes> parameterTypes;
100 std::set<ParameterTypes> wildcardTypes;
102 n.second->checkAndGetLabelsAndTypes(
labels, parameterTypes, wildcardTypes);
109 typename CaseMap::const_iterator selectedCase =
cases_.find(
switch_.getDefaultValue());
110 if (selectedCase !=
cases_.end()) {
131 std::bind(&ParameterSwitchBase::printCaseT<T>,
132 std::placeholders::_1,
145 std::bind(&ParameterSwitchBase::printCaseT<T>,
146 std::placeholders::_1,
157 std::bind(&ParameterSwitchBase::printCaseT<T>,
158 std::placeholders::_1,
168 std::set<std::string>&
labels,
169 std::set<ParameterTypes>& parameterTypes,
170 std::set<ParameterTypes>& wildcardTypes) {
171 thePair.second->checkAndGetLabelsAndTypes(
labels, parameterTypes, wildcardTypes);
std::string const & label() const
void insertAndCheckTypes(ParameterTypes switchType, std::set< ParameterTypes > const &caseParameterTypes, std::set< ParameterTypes > const &caseWildcardTypes, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const
static void checkCaseLabels(std::pair< T, edm::value_ptr< ParameterDescriptionNode > > const &thePair, std::set< std::string > &labels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes)
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
void validate_(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override
std::string parameterTypeEnumToString(ParameterTypes iType)
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
void throwDuplicateCaseValues(std::string const &switchLabel) const
void parameterMustBeTyped(CfiOptions &iOps) noexcept
void printBase(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh, std::string const &switchLabel, bool isTracked, std::string const &typeString) const
std::map< T, edm::value_ptr< ParameterDescriptionNode > >::const_iterator CaseMapConstIter
void checkAndGetLabelsAndTypes_(std::set< std::string > &usedLabels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const override
void throwNoCaseForDefault(std::string const &switchLabel) const
std::map< T, edm::value_ptr< ParameterDescriptionNode > > CaseMap
void insertAndCheckLabels(std::string const &switchLabel, std::set< std::string > &usedLabels, std::set< std::string > &labels) const
ParameterDescription< T > switch_
ParameterSwitch(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T > > cases)
bool exists_(ParameterSet const &pset) const override
void printNestedContent_(std::ostream &os, bool optional, DocFormatHelper &dfh) const override
ParameterDescriptionNode * clone() const override
void print_(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) const override
void printNestedContentBase(std::ostream &os, DocFormatHelper &dfh, DocFormatHelper &new_dfh, std::string const &switchLabel) const
void throwNoCaseForSwitchValue(std::string const &message) const
void writeCfi_(std::ostream &os, bool optional, bool &startWithComma, int indentation, CfiOptions &options, bool &wroteSomething) const override
cfi::CfiOptions CfiOptions