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 {
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 {
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";
105 ss <<
" " <<
iter->first <<
"\n";
113 bool & startWithComma,
115 bool & wroteSomething)
const {
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
virtual void checkAndGetLabelsAndTypes_(std::set< std::string > &usedLabels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const
void insertAndCheckTypes(ParameterTypes switchType, std::set< ParameterTypes > const &caseParameterTypes, std::set< ParameterTypes > const &caseWildcardTypes, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const
ParameterSwitch(ParameterDescription< T > const &switchParameter, std::auto_ptr< ParameterDescriptionCases< T > > cases)
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)
virtual void validate_(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const
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 throwNoCaseForDefault(std::string const &switchLabel) const
virtual void print_(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh)
virtual void printNestedContent_(std::ostream &os, bool optional, DocFormatHelper &dfh)
virtual void writeCfi_(std::ostream &os, bool &startWithComma, int indentation, bool &wroteSomething) const
std::map< T, edm::value_ptr< ParameterDescriptionNode > >::const_iterator CaseMapConstIter
virtual ParameterDescriptionNode * clone() const
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
void printNestedContentBase(std::ostream &os, DocFormatHelper &dfh, DocFormatHelper &new_dfh, std::string const &switchLabel)
ParameterDescription< T > switch_
virtual bool exists_(ParameterSet const &pset) const
std::string const & label() const