#include <ParameterSwitch.h>
Public Types | |
typedef std::map< T, edm::value_ptr < ParameterDescriptionNode > > | CaseMap |
typedef std::map< T, edm::value_ptr < ParameterDescriptionNode > >::const_iterator | CaseMapConstIter |
Public Member Functions | |
virtual ParameterDescriptionNode * | clone () const |
ParameterSwitch (ParameterDescription< T > const &switchParameter, std::auto_ptr< ParameterDescriptionCases< T > > cases) | |
Private Member Functions | |
virtual void | checkAndGetLabelsAndTypes_ (std::set< std::string > &usedLabels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const |
virtual bool | exists_ (ParameterSet const &pset) 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 | validate_ (ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const |
virtual void | writeCfi_ (std::ostream &os, bool &startWithComma, int indentation, bool &wroteSomething) const |
Static Private Member Functions | |
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) |
Private Attributes | |
CaseMap | cases_ |
ParameterDescription< T > | switch_ |
Definition at line 27 of file ParameterSwitch.h.
typedef std::map<T, edm::value_ptr<ParameterDescriptionNode> > edm::ParameterSwitch< T >::CaseMap |
Definition at line 30 of file ParameterSwitch.h.
typedef std::map<T, edm::value_ptr<ParameterDescriptionNode> >::const_iterator edm::ParameterSwitch< T >::CaseMapConstIter |
Definition at line 31 of file ParameterSwitch.h.
edm::ParameterSwitch< T >::ParameterSwitch | ( | ParameterDescription< T > const & | switchParameter, |
std::auto_ptr< ParameterDescriptionCases< T > > | cases | ||
) | [inline] |
Definition at line 33 of file ParameterSwitch.h.
References edm::ParameterDescriptionBase::label(), and edm::ParameterSwitchBase::throwDuplicateCaseValues().
Referenced by edm::ParameterSwitch< T >::clone().
: switch_(switchParameter), cases_(*cases->caseMap()) { if (cases->duplicateCaseValues()) { throwDuplicateCaseValues(switchParameter.label()); } }
virtual void edm::ParameterSwitch< T >::checkAndGetLabelsAndTypes_ | ( | std::set< std::string > & | usedLabels, |
std::set< ParameterTypes > & | parameterTypes, | ||
std::set< ParameterTypes > & | wildcardTypes | ||
) | const [inline, private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 49 of file ParameterSwitch.h.
References edm::ParameterSwitch< T >::cases_, edm::ParameterSwitch< T >::checkCaseLabels(), edm::for_all(), edm::ParameterSwitchBase::insertAndCheckLabels(), edm::ParameterSwitchBase::insertAndCheckTypes(), edm::ParameterSwitch< T >::switch_, and edm::ParameterSwitchBase::throwNoCaseForDefault().
{ std::set<std::string> caseLabels; std::set<ParameterTypes> caseParameterTypes; std::set<ParameterTypes> caseWildcardTypes; for_all(cases_, boost::bind(&ParameterSwitch::checkCaseLabels, _1, boost::ref(caseLabels), boost::ref(caseParameterTypes), boost::ref(caseWildcardTypes))); insertAndCheckLabels(switch_.label(), usedLabels, caseLabels); insertAndCheckTypes(switch_.type(), caseParameterTypes, caseWildcardTypes, parameterTypes, wildcardTypes); if (cases_.find(switch_.getDefaultValue()) == cases_.end()) { throwNoCaseForDefault(switch_.label()); } }
static void edm::ParameterSwitch< T >::checkCaseLabels | ( | std::pair< T, edm::value_ptr< ParameterDescriptionNode > > const & | thePair, |
std::set< std::string > & | labels, | ||
std::set< ParameterTypes > & | parameterTypes, | ||
std::set< ParameterTypes > & | wildcardTypes | ||
) | [inline, static, private] |
Definition at line 175 of file ParameterSwitch.h.
Referenced by edm::ParameterSwitch< T >::checkAndGetLabelsAndTypes_().
{ thePair.second->checkAndGetLabelsAndTypes(labels, parameterTypes, wildcardTypes); }
virtual ParameterDescriptionNode* edm::ParameterSwitch< T >::clone | ( | void | ) | const [inline, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 43 of file ParameterSwitch.h.
References edm::ParameterSwitch< T >::ParameterSwitch().
{ return new ParameterSwitch(*this); }
virtual bool edm::ParameterSwitch< T >::exists_ | ( | ParameterSet const & | pset | ) | const [inline, private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 173 of file ParameterSwitch.h.
References edm::ParameterSwitch< T >::switch_.
virtual void edm::ParameterSwitch< T >::print_ | ( | std::ostream & | os, |
bool | optional, | ||
bool | writeToCfi, | ||
DocFormatHelper & | dfh | ||
) | [inline, private, virtual] |
Reimplemented from edm::ParameterDescriptionNode.
Definition at line 126 of file ParameterSwitch.h.
References edm::parameterTypeEnumToString(), edm::ParameterSwitchBase::printBase(), and edm::ParameterSwitch< T >::switch_.
{ printBase(os, optional, writeToCfi, dfh, switch_.label(), switch_.isTracked(), parameterTypeEnumToString(switch_.type())); }
virtual void edm::ParameterSwitch< T >::printNestedContent_ | ( | std::ostream & | os, |
bool | optional, | ||
DocFormatHelper & | dfh | ||
) | [inline, private, virtual] |
Reimplemented from edm::ParameterDescriptionNode.
Definition at line 133 of file ParameterSwitch.h.
References edm::ParameterSwitch< T >::cases_, edm::for_all(), edm::DocFormatHelper::indent(), edm::ParameterSwitchBase::printNestedContentBase(), edm::DocFormatHelper::setCounter(), edm::DocFormatHelper::setPass(), and edm::ParameterSwitch< T >::switch_.
{ DocFormatHelper new_dfh(dfh); printNestedContentBase(os, dfh, new_dfh, switch_.label()); switch_.print(os, optional, true, new_dfh); for_all(cases_, boost::bind(&ParameterSwitchBase::printCaseT<T>, _1, boost::ref(os), optional, boost::ref(new_dfh), boost::cref(switch_.label()))); new_dfh.setPass(1); new_dfh.setCounter(0); new_dfh.indent(os); os << "switch:\n"; switch_.print(os, optional, true, new_dfh); for_all(cases_, boost::bind(&ParameterSwitchBase::printCaseT<T>, _1, boost::ref(os), optional, boost::ref(new_dfh), boost::cref(switch_.label()))); new_dfh.setPass(2); new_dfh.setCounter(0); switch_.printNestedContent(os, optional, new_dfh); for_all(cases_, boost::bind(&ParameterSwitchBase::printCaseT<T>, _1, boost::ref(os), optional, boost::ref(new_dfh), boost::cref(switch_.label()))); }
virtual void edm::ParameterSwitch< T >::validate_ | ( | ParameterSet & | pset, |
std::set< std::string > & | validatedLabels, | ||
bool | optional | ||
) | const [inline, private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 77 of file ParameterSwitch.h.
References edm::ParameterSwitch< T >::cases_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSwitch< T >::switch_, and edm::ParameterSwitchBase::throwNoCaseForSwitchValue().
{ switch_.validate(pset, validatedLabels, optional); if (switch_.exists(pset)) { T switchValue; if (switch_.isTracked()) { switchValue = pset.getParameter<T>(switch_.label()); } else { switchValue = pset.getUntrackedParameter<T>(switch_.label()); } typename CaseMap::const_iterator selectedCase = cases_.find(switchValue); if (selectedCase != cases_.end()) { selectedCase->second->validate(pset, validatedLabels, false); } else { std::stringstream ss; ss << "The switch parameter with label \"" << switch_.label() << "\" has been assigned an illegal value.\n" << "The value from the configuration is \"" << switchValue << "\".\n" << "The allowed values are:\n"; for (CaseMapConstIter iter = cases_.begin(), iEnd = cases_.end(); iter != iEnd; ++iter) { ss << " " << iter->first << "\n"; } throwNoCaseForSwitchValue(ss.str()); } } }
virtual void edm::ParameterSwitch< T >::writeCfi_ | ( | std::ostream & | os, |
bool & | startWithComma, | ||
int | indentation, | ||
bool & | wroteSomething | ||
) | const [inline, private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 114 of file ParameterSwitch.h.
References edm::ParameterSwitch< T >::cases_, and edm::ParameterSwitch< T >::switch_.
CaseMap edm::ParameterSwitch< T >::cases_ [private] |
Definition at line 183 of file ParameterSwitch.h.
Referenced by edm::ParameterSwitch< T >::checkAndGetLabelsAndTypes_(), edm::ParameterSwitch< T >::printNestedContent_(), edm::ParameterSwitch< T >::validate_(), and edm::ParameterSwitch< T >::writeCfi_().
ParameterDescription<T> edm::ParameterSwitch< T >::switch_ [private] |
Definition at line 182 of file ParameterSwitch.h.
Referenced by edm::ParameterSwitch< T >::checkAndGetLabelsAndTypes_(), edm::ParameterSwitch< T >::exists_(), edm::ParameterSwitch< T >::print_(), edm::ParameterSwitch< T >::printNestedContent_(), edm::ParameterSwitch< T >::validate_(), and edm::ParameterSwitch< T >::writeCfi_().