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)));
64 switch_.validate(pset, validatedLabels, optional);
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";
81 for (CaseMapConstIter iter =
cases_.begin(), iEnd =
cases_.end(); iter != iEnd; ++iter) {
82 ss <<
" " << iter->first <<
"\n";
89 void writeCfi_(std::ostream& os,
bool& startWithComma,
int indentation,
bool& wroteSomething)
const override {
90 switch_.writeCfi(os, startWithComma, indentation, wroteSomething);
92 typename CaseMap::const_iterator selectedCase =
cases_.find(
switch_.getDefaultValue());
93 if (selectedCase !=
cases_.end()) {
94 selectedCase->second->writeCfi(os, startWithComma, indentation, wroteSomething);
112 switch_.print(os, optional,
true, new_dfh);
114 std::bind(&ParameterSwitchBase::printCaseT<T>,
115 std::placeholders::_1,
126 switch_.print(os, optional,
true, new_dfh);
128 std::bind(&ParameterSwitchBase::printCaseT<T>,
129 std::placeholders::_1,
138 switch_.printNestedContent(os, optional, new_dfh);
140 std::bind(&ParameterSwitchBase::printCaseT<T>,
141 std::placeholders::_1,
151 std::set<std::string>&
labels,
152 std::set<ParameterTypes>& parameterTypes,
153 std::set<ParameterTypes>& wildcardTypes) {
154 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