|
|
Go to the documentation of this file. 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 throwNoCaseForSwitchValue(std::string const &message) const
std::map< T, edm::value_ptr< ParameterDescriptionNode > > CaseMap
std::map< T, edm::value_ptr< ParameterDescriptionNode > >::const_iterator CaseMapConstIter
std::string const & label() const
ParameterDescription< T > switch_
void checkAndGetLabelsAndTypes_(std::set< std::string > &usedLabels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const override
std::string parameterTypeEnumToString(ParameterTypes iType)
void printNestedContent_(std::ostream &os, bool optional, DocFormatHelper &dfh) const override
ParameterDescriptionNode * clone() const override
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
bool exists_(ParameterSet const &pset) const override
ParameterSwitch(ParameterDescription< T > const &switchParameter, std::unique_ptr< ParameterDescriptionCases< T > > cases)
void printNestedContentBase(std::ostream &os, DocFormatHelper &dfh, DocFormatHelper &new_dfh, std::string const &switchLabel) const
void print_(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) const override
void insertAndCheckLabels(std::string const &switchLabel, std::set< std::string > &usedLabels, std::set< std::string > &labels) const
void throwDuplicateCaseValues(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)
void insertAndCheckTypes(ParameterTypes switchType, std::set< ParameterTypes > const &caseParameterTypes, std::set< ParameterTypes > const &caseWildcardTypes, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const
void writeCfi_(std::ostream &os, bool optional, bool &startWithComma, int indentation, bool &wroteSomething) const override
void printBase(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh, std::string const &switchLabel, bool isTracked, std::string const &typeString) const
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
void throwNoCaseForDefault(std::string const &switchLabel) const
void validate_(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override