1 #ifndef FWCore_ParameterSet_ParameterSwitch_h 2 #define FWCore_ParameterSet_ParameterSwitch_h 28 typedef std::map<T, edm::value_ptr<ParameterDescriptionNode> >
CaseMap;
29 typedef typename std::map<T, edm::value_ptr<ParameterDescriptionNode> >::const_iterator
CaseMapConstIter;
36 if (cases->duplicateCaseValues()) {
48 std::set<ParameterTypes> & parameterTypes,
49 std::set<ParameterTypes> & wildcardTypes)
const override {
51 std::set<std::string> caseLabels;
52 std::set<ParameterTypes> caseParameterTypes;
53 std::set<ParameterTypes> caseWildcardTypes;
55 std::placeholders::_1,
57 std::ref(caseParameterTypes),
58 std::ref(caseWildcardTypes)));
76 std::set<std::string> & validatedLabels,
77 bool optional)
const override {
79 switch_.validate(pset, validatedLabels, optional);
88 typename CaseMap::const_iterator selectedCase =
cases_.find(switchValue);
89 if (selectedCase !=
cases_.end()) {
90 selectedCase->second->validate(pset, validatedLabels,
false);
94 ss <<
"The switch parameter with label \"" 96 <<
"\" has been assigned an illegal value.\n" 97 <<
"The value from the configuration is \"" 100 <<
"The allowed values are:\n";
102 for (CaseMapConstIter iter =
cases_.begin(), iEnd =
cases_.end();
105 ss <<
" " << iter->first <<
"\n";
113 bool & startWithComma,
115 bool & wroteSomething)
const override {
116 switch_.writeCfi(os, startWithComma, indentation, wroteSomething);
118 typename CaseMap::const_iterator selectedCase =
cases_.find(
switch_.getDefaultValue());
119 if (selectedCase !=
cases_.end()) {
120 selectedCase->second->writeCfi(os, startWithComma, indentation, wroteSomething);
138 switch_.print(os, optional,
true, new_dfh);
139 for_all(
cases_, std::bind(&ParameterSwitchBase::printCaseT<T>,
140 std::placeholders::_1,
151 switch_.print(os, optional,
true, new_dfh);
152 for_all(
cases_, std::bind(&ParameterSwitchBase::printCaseT<T>,
153 std::placeholders::_1,
162 switch_.printNestedContent(os, optional, new_dfh);
163 for_all(
cases_, std::bind(&ParameterSwitchBase::printCaseT<T>,
164 std::placeholders::_1,
174 std::set<std::string> &
labels,
175 std::set<ParameterTypes> & parameterTypes,
176 std::set<ParameterTypes> & wildcardTypes) {
177 thePair.second->checkAndGetLabelsAndTypes(labels, parameterTypes, wildcardTypes);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void writeCfi_(std::ostream &os, bool &startWithComma, int indentation, bool &wroteSomething) const override
void insertAndCheckTypes(ParameterTypes switchType, std::set< ParameterTypes > const &caseParameterTypes, std::set< ParameterTypes > const &caseWildcardTypes, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const
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
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)
ParameterDescriptionNode * clone() const override
void insertAndCheckLabels(std::string const &switchLabel, std::set< std::string > &usedLabels, std::set< std::string > &labels) const
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 checkAndGetLabelsAndTypes_(std::set< std::string > &usedLabels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const override
void throwNoCaseForDefault(std::string const &switchLabel) const
void validate_(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override
void printNestedContent_(std::ostream &os, bool optional, DocFormatHelper &dfh) const override
std::map< T, edm::value_ptr< ParameterDescriptionNode > >::const_iterator CaseMapConstIter
bool exists_(ParameterSet const &pset) const override
std::map< T, edm::value_ptr< ParameterDescriptionNode > > CaseMap
void printBase(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh, std::string const &switchLabel, bool isTracked, std::string const &typeString) const
void throwNoCaseForSwitchValue(std::string const &message) const
ParameterDescription< T > switch_
ParameterSwitch(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T > > cases)
std::string const & label() const