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";
90 std::ostream& os,
bool optional,
bool& startWithComma,
int indentation,
bool& wroteSomething)
const override {
93 typename CaseMap::const_iterator selectedCase =
cases_.find(
switch_.getDefaultValue());
94 if (selectedCase !=
cases_.end()) {
115 std::bind(&ParameterSwitchBase::printCaseT<T>,
116 std::placeholders::_1,
129 std::bind(&ParameterSwitchBase::printCaseT<T>,
130 std::placeholders::_1,
141 std::bind(&ParameterSwitchBase::printCaseT<T>,
142 std::placeholders::_1,
152 std::set<std::string>&
labels,
153 std::set<ParameterTypes>& parameterTypes,
154 std::set<ParameterTypes>& wildcardTypes) {
155 thePair.second->checkAndGetLabelsAndTypes(
labels, parameterTypes, wildcardTypes);
void writeCfi_(std::ostream &os, bool optional, bool &startWithComma, int indentation, bool &wroteSomething) const override
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 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