1 #ifndef FWCore_ParameterSet_ParameterSwitch_h
2 #define FWCore_ParameterSet_ParameterSwitch_h
13 #include "boost/bind.hpp"
30 typedef std::map<T, edm::value_ptr<ParameterDescriptionNode> >
CaseMap;
31 typedef typename std::map<T, edm::value_ptr<ParameterDescriptionNode> >::const_iterator
CaseMapConstIter;
38 if (cases->duplicateCaseValues()) {
50 std::set<ParameterTypes> & parameterTypes,
51 std::set<ParameterTypes> & wildcardTypes)
const {
53 std::set<std::string> caseLabels;
54 std::set<ParameterTypes> caseParameterTypes;
55 std::set<ParameterTypes> caseWildcardTypes;
58 boost::ref(caseLabels),
59 boost::ref(caseParameterTypes),
60 boost::ref(caseWildcardTypes)));
78 std::set<std::string> & validatedLabels,
79 bool optional)
const {
81 switch_.validate(pset, validatedLabels, optional);
90 typename CaseMap::const_iterator selectedCase =
cases_.find(switchValue);
91 if (selectedCase !=
cases_.end()) {
92 selectedCase->second->validate(pset, validatedLabels,
false);
96 ss <<
"The switch parameter with label \""
98 <<
"\" has been assigned an illegal value.\n"
99 <<
"The value from the configuration is \""
102 <<
"The allowed values are:\n";
107 ss <<
" " <<
iter->first <<
"\n";
115 bool & startWithComma,
117 bool & wroteSomething)
const {
118 switch_.writeCfi(os, startWithComma, indentation, wroteSomething);
120 typename CaseMap::const_iterator selectedCase =
cases_.find(
switch_.getDefaultValue());
121 if (selectedCase !=
cases_.end()) {
122 selectedCase->second->writeCfi(os, startWithComma, indentation, wroteSomething);
140 switch_.print(os, optional,
true, new_dfh);
141 for_all(
cases_, boost::bind(&ParameterSwitchBase::printCaseT<T>,
146 boost::cref(
switch_.label())));
153 switch_.print(os, optional,
true, new_dfh);
154 for_all(
cases_, boost::bind(&ParameterSwitchBase::printCaseT<T>,
159 boost::cref(
switch_.label())));
164 switch_.printNestedContent(os, optional, new_dfh);
165 for_all(
cases_, boost::bind(&ParameterSwitchBase::printCaseT<T>,
170 boost::cref(
switch_.label())));
176 std::set<std::string> &
labels,
177 std::set<ParameterTypes> & parameterTypes,
178 std::set<ParameterTypes> & wildcardTypes) {
179 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