#include <ParameterDescriptionBase.h>
Public Member Functions | |
bool | hasDefault () const |
bool | isTracked () const |
std::string const & | label () const |
virtual ParameterSetDescription * | parameterSetDescription () |
virtual ParameterSetDescription const * | parameterSetDescription () const |
ParameterTypes | type () const |
virtual | ~ParameterDescriptionBase () |
Protected Member Functions | |
ParameterDescriptionBase (std::string const &iLabel, ParameterTypes iType, bool isTracked, bool hasDefault) | |
ParameterDescriptionBase (char const *iLabel, ParameterTypes iType, bool isTracked, bool hasDefault) | |
void | throwMissingRequiredNoDefault () const |
void | throwParameterWrongTrackiness () const |
void | throwParameterWrongType () const |
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, bool isTracked) const =0 |
virtual int | howManyXORSubNodesExist_ (ParameterSet const &pset) const |
virtual void | insertDefault_ (ParameterSet &pset) const =0 |
virtual bool | partiallyExists_ (ParameterSet const &pset) const |
virtual void | print_ (std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) |
virtual void | printDefault_ (std::ostream &os, 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 |
virtual void | writeCfi_ (std::ostream &os, int indentation) const =0 |
virtual void | writeDoc_ (std::ostream &os, int indentation) const =0 |
Private Attributes | |
bool | hasDefault_ |
bool | isTracked_ |
std::string | label_ |
ParameterTypes | type_ |
Definition at line 33 of file ParameterDescriptionBase.h.
ParameterDescriptionBase::~ParameterDescriptionBase | ( | ) | [virtual] |
Definition at line 54 of file ParameterDescriptionBase.cc.
{ }
ParameterDescriptionBase::ParameterDescriptionBase | ( | std::string const & | iLabel, |
ParameterTypes | iType, | ||
bool | isTracked, | ||
bool | hasDefault | ||
) | [protected] |
Definition at line 24 of file ParameterDescriptionBase.cc.
References Exception, label_, and edm::errors::LogicError.
:label_(iLabel), type_(iType), isTracked_(isTracked), hasDefault_(hasDefault) { if(label_.empty()) { throw Exception(errors::LogicError) << "Empty string used as a label for a parameter. This is\n" "not allowed.\n"; } }
ParameterDescriptionBase::ParameterDescriptionBase | ( | char const * | iLabel, |
ParameterTypes | iType, | ||
bool | isTracked, | ||
bool | hasDefault | ||
) | [protected] |
Definition at line 39 of file ParameterDescriptionBase.cc.
References Exception, label_, and edm::errors::LogicError.
:label_(iLabel), type_(iType), isTracked_(isTracked), hasDefault_(hasDefault) { if(label_.empty()) { throw Exception(errors::LogicError) << "Empty string used as a label for a parameter. This is\n" "not allowed.\n"; } }
void ParameterDescriptionBase::checkAndGetLabelsAndTypes_ | ( | std::set< std::string > & | usedLabels, |
std::set< ParameterTypes > & | parameterTypes, | ||
std::set< ParameterTypes > & | wildcardTypes | ||
) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 98 of file ParameterDescriptionBase.cc.
virtual bool edm::ParameterDescriptionBase::exists_ | ( | ParameterSet const & | pset, |
bool | isTracked | ||
) | const [private, pure virtual] |
bool edm::ParameterDescriptionBase::hasDefault | ( | ) | const [inline] |
Definition at line 41 of file ParameterDescriptionBase.h.
References hasDefault_.
Referenced by edm::ParameterDescription< std::vector< std::string > >::hasNestedContent_(), printDefault_(), validate_(), and writeCfi_().
{ return hasDefault_; }
int ParameterDescriptionBase::howManyXORSubNodesExist_ | ( | ParameterSet const & | pset | ) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 276 of file ParameterDescriptionBase.cc.
References edm::ParameterDescriptionNode::exists().
{ return exists(pset) ? 1 : 0; }
virtual void edm::ParameterDescriptionBase::insertDefault_ | ( | ParameterSet & | pset | ) | const [private, pure virtual] |
bool edm::ParameterDescriptionBase::isTracked | ( | ) | const [inline] |
Definition at line 40 of file ParameterDescriptionBase.h.
References isTracked_.
Referenced by edm::ParameterDescription< std::vector< std::string > >::exists_(), edm::ParameterDescription< ParameterSetDescription >::exists_(), edm::ParameterDescription< std::vector< std::string > >::insertDefault_(), print_(), throwMissingRequiredNoDefault(), throwParameterWrongTrackiness(), throwParameterWrongType(), validate_(), edm::ParameterDescription< ParameterSetDescription >::validate_(), and writeCfi_().
{ return isTracked_; }
std::string const& edm::ParameterDescriptionBase::label | ( | ) | const [inline] |
Definition at line 38 of file ParameterDescriptionBase.h.
References label_.
Referenced by checkAndGetLabelsAndTypes_(), edm::ParameterDescription< std::vector< std::string > >::exists_(), edm::ParameterDescription< ParameterSetDescription >::exists_(), edm::ParameterDescription< std::vector< std::string > >::insertDefault_(), edm::ParameterSwitch< T >::ParameterSwitch(), edm::AllowedLabelsDescriptionBase::print_(), print_(), edm::ParameterDescription< ParameterSetDescription >::printNestedContent_(), printNestedContent_(), edm::AllowedLabelsDescriptionBase::printNestedContentBase_(), throwMissingRequiredNoDefault(), throwParameterWrongTrackiness(), throwParameterWrongType(), edm::AllowedLabelsDescriptionBase::validate_(), validate_(), edm::ParameterDescription< ParameterSetDescription >::validate_(), and writeCfi_().
{ return label_; }
virtual ParameterSetDescription const* edm::ParameterDescriptionBase::parameterSetDescription | ( | ) | const [inline, virtual] |
Reimplemented in edm::ParameterDescription< ParameterSetDescription >, and edm::ParameterDescription< std::vector< ParameterSet > >.
Definition at line 43 of file ParameterDescriptionBase.h.
{ return 0; }
virtual ParameterSetDescription* edm::ParameterDescriptionBase::parameterSetDescription | ( | ) | [inline, virtual] |
Reimplemented in edm::ParameterDescription< ParameterSetDescription >, and edm::ParameterDescription< std::vector< ParameterSet > >.
Definition at line 44 of file ParameterDescriptionBase.h.
{ return 0; }
bool ParameterDescriptionBase::partiallyExists_ | ( | ParameterSet const & | pset | ) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 270 of file ParameterDescriptionBase.cc.
References edm::ParameterDescriptionNode::exists().
{ return exists(pset); }
void ParameterDescriptionBase::print_ | ( | std::ostream & | os, |
bool | optional, | ||
bool | writeToCfi, | ||
DocFormatHelper & | dfh | ||
) | [private, virtual] |
Reimplemented from edm::ParameterDescriptionNode.
Definition at line 158 of file ParameterDescriptionBase.cc.
References edm::DocFormatHelper::brief(), edm::DocFormatHelper::column1(), edm::DocFormatHelper::column2(), edm::DocFormatHelper::column3(), edm::ParameterDescriptionNode::comment(), edm::DocFormatHelper::commentWidth(), relativeConstraints::empty, edm::DocFormatHelper::indent(), edm::DocFormatHelper::indent2(), isTracked(), label(), edm::parameterTypeEnumToString(), edm::DocFormatHelper::pass(), printDefault_(), edm::DocFormatHelper::setAtLeast1(), edm::DocFormatHelper::setAtLeast2(), edm::DocFormatHelper::setAtLeast3(), findQualityFiles::size, edm::DocFormatHelper::startColumn2(), type(), and edm::DocFormatHelper::wrapAndPrintText().
{ if(dfh.pass() == 0) { dfh.setAtLeast1(label().size()); if(isTracked()) { dfh.setAtLeast2(parameterTypeEnumToString(type()).size()); } else { dfh.setAtLeast2(parameterTypeEnumToString(type()).size() + 10U); } if(optional) { dfh.setAtLeast3(8U); } } else { if(dfh.brief()) { std::ios::fmtflags oldFlags = os.flags(); dfh.indent(os); os << std::left << std::setw(dfh.column1()) << label() << " "; if(isTracked()) { os << std::setw(dfh.column2()) << parameterTypeEnumToString(type()); } else { std::stringstream ss; ss << "untracked "; ss << parameterTypeEnumToString(type()); os << std::setw(dfh.column2()) << ss.str(); } os << " "; os << std::setw(dfh.column3()); if(optional) { os << "optional"; } else { os << ""; } os << " "; os.flags(oldFlags); printDefault_(os, writeToCfi, dfh); } else { // not brief dfh.indent(os); os << label() << "\n"; dfh.indent2(os); os << "type: "; if(!isTracked()) os << "untracked "; os << parameterTypeEnumToString(type()) << " "; if(optional) os << "optional"; os << "\n"; dfh.indent2(os); printDefault_(os, writeToCfi, dfh); if(!comment().empty()) { DocFormatHelper::wrapAndPrintText(os, comment(), dfh.startColumn2(), dfh.commentWidth()); } os << "\n"; } } }
void ParameterDescriptionBase::printDefault_ | ( | std::ostream & | os, |
bool | writeToCfi, | ||
DocFormatHelper & | dfh | ||
) | [private, virtual] |
Reimplemented in edm::ParameterDescription< ParameterSetDescription >, and edm::ParameterDescription< std::vector< ParameterSet > >.
Definition at line 229 of file ParameterDescriptionBase.cc.
References edm::DocFormatHelper::brief(), edm::DocFormatHelper::counter(), hasDefault(), edm::ParameterDescriptionNode::hasNestedContent(), edm::DocFormatHelper::indentation(), edm::DocFormatHelper::section(), edm::DocFormatHelper::startColumn2(), and writeDoc_().
Referenced by print_().
{ if(!dfh.brief()) os << "default: "; if(writeToCfi && hasDefault()) { if(hasNestedContent()) { os << "see Section " << dfh.section() << "." << dfh.counter(); } else { if(dfh.brief()) { writeDoc_(os, dfh.indentation()); } else { writeDoc_(os, dfh.startColumn2()); } } } else { os << "none (do not write to cfi)"; } os << "\n"; }
void ParameterDescriptionBase::printNestedContent_ | ( | std::ostream & | os, |
bool | optional, | ||
DocFormatHelper & | dfh | ||
) | [private, virtual] |
Reimplemented from edm::ParameterDescriptionNode.
Reimplemented in edm::ParameterDescription< ParameterSetDescription >, and edm::ParameterDescription< std::vector< ParameterSet > >.
Definition at line 252 of file ParameterDescriptionBase.cc.
References edm::DocFormatHelper::brief(), edm::DocFormatHelper::counter(), edm::DocFormatHelper::indentation(), label(), edm::DocFormatHelper::offsetSectionContent(), edm::DocFormatHelper::parent(), edm::ParameterDescriptionNode::printSpaces(), edm::DocFormatHelper::section(), pat::TOP, and writeDoc_().
{ int indentation = dfh.indentation(); if(dfh.parent() != DocFormatHelper::TOP) { indentation -= DocFormatHelper::offsetSectionContent(); } printSpaces(os, indentation); os << "Section " << dfh.section() << "." << dfh.counter() << " " << label() << " default contents: "; writeDoc_(os, indentation + 2); os << "\n"; if(!dfh.brief()) os << "\n"; }
void ParameterDescriptionBase::throwMissingRequiredNoDefault | ( | ) | const [protected] |
Definition at line 83 of file ParameterDescriptionBase.cc.
References edm::errors::Configuration, Exception, isTracked(), label(), edm::parameterTypeEnumToString(), and type().
Referenced by validate_().
{ std::string tr("untracked"); if(isTracked()) tr = "tracked"; throw Exception(errors::Configuration) << "Missing required parameter. It should have label \"" << label() << "\" and have type \"" << tr << " " << parameterTypeEnumToString(type()) << "\".\n" << "The description has no default. The parameter must be defined " "in the configuration\n"; }
void ParameterDescriptionBase::throwParameterWrongTrackiness | ( | ) | const [protected] |
Definition at line 57 of file ParameterDescriptionBase.cc.
References edm::errors::Configuration, Exception, isTracked(), label(), edm::parameterTypeEnumToString(), and type().
Referenced by validate_(), and edm::ParameterDescription< ParameterSetDescription >::validate_().
{ std::string tr("a tracked"); std::string shouldBe("untracked"); if(isTracked()) { tr = "an untracked"; shouldBe = "tracked"; } throw Exception(errors::Configuration) << "In the configuration, parameter \"" << label() << "\" is defined " "as " << tr << " " << parameterTypeEnumToString(type()) << ".\n" << "It should be " << shouldBe << ".\n"; }
void ParameterDescriptionBase::throwParameterWrongType | ( | ) | const [protected] |
Definition at line 72 of file ParameterDescriptionBase.cc.
References edm::errors::Configuration, Exception, isTracked(), label(), edm::parameterTypeEnumToString(), and type().
Referenced by validate_(), and edm::ParameterDescription< ParameterSetDescription >::validate_().
{ std::string tr("an untracked"); if(isTracked()) tr = "a tracked"; throw Exception(errors::Configuration) << "Parameter \"" << label() << "\" should be defined " "as " << tr << " " << parameterTypeEnumToString(type()) << ".\n" << "The type in the configuration is incorrect.\n"; }
ParameterTypes edm::ParameterDescriptionBase::type | ( | ) | const [inline] |
Definition at line 39 of file ParameterDescriptionBase.h.
References type_.
Referenced by checkAndGetLabelsAndTypes_(), print_(), throwMissingRequiredNoDefault(), throwParameterWrongTrackiness(), throwParameterWrongType(), and writeCfi_().
{ return type_; }
void ParameterDescriptionBase::validate_ | ( | ParameterSet & | pset, |
std::set< std::string > & | validatedLabels, | ||
bool | optional | ||
) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Reimplemented in edm::ParameterDescription< ParameterSetDescription >, and edm::ParameterDescription< std::vector< ParameterSet > >.
Definition at line 107 of file ParameterDescriptionBase.cc.
References edm::ParameterDescriptionNode::exists(), edm::ParameterSet::exists(), exists_(), hasDefault(), insertDefault_(), isTracked(), label(), throwMissingRequiredNoDefault(), throwParameterWrongTrackiness(), and throwParameterWrongType().
{ bool exists = exists_(pset, isTracked()); if(exists) { validatedLabels.insert(label()); } else if(exists_(pset, !isTracked())) { throwParameterWrongTrackiness(); } else if(pset.exists(label())) { throwParameterWrongType(); } if(!exists && !optional) { if(hasDefault()) { insertDefault_(pset); validatedLabels.insert(label()); } else { throwMissingRequiredNoDefault(); } } }
virtual void edm::ParameterDescriptionBase::writeCfi_ | ( | std::ostream & | os, |
int | indentation | ||
) | const [private, pure virtual] |
void ParameterDescriptionBase::writeCfi_ | ( | std::ostream & | os, |
bool & | startWithComma, | ||
int | indentation, | ||
bool & | wroteSomething | ||
) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 133 of file ParameterDescriptionBase.cc.
References hasDefault(), isTracked(), label(), edm::parameterTypeEnumToString(), edm::ParameterDescriptionNode::printSpaces(), and type().
{ if(!hasDefault()) return; wroteSomething = true; if(startWithComma) os << ","; startWithComma = true; os << "\n"; printSpaces(os, indentation); os << label() << " = cms."; if(!isTracked()) os << "untracked."; os << parameterTypeEnumToString(type()) << "("; writeCfi_(os, indentation); os << ")"; }
virtual void edm::ParameterDescriptionBase::writeDoc_ | ( | std::ostream & | os, |
int | indentation | ||
) | const [private, pure virtual] |
bool edm::ParameterDescriptionBase::hasDefault_ [private] |
Definition at line 106 of file ParameterDescriptionBase.h.
Referenced by hasDefault().
bool edm::ParameterDescriptionBase::isTracked_ [private] |
Definition at line 105 of file ParameterDescriptionBase.h.
Referenced by isTracked().
std::string edm::ParameterDescriptionBase::label_ [private] |
Definition at line 103 of file ParameterDescriptionBase.h.
Referenced by label(), and ParameterDescriptionBase().
Definition at line 104 of file ParameterDescriptionBase.h.
Referenced by type().