#include <XORGroupDescription.h>
Public Member Functions | |
virtual ParameterDescriptionNode * | clone () const |
XORGroupDescription (std::auto_ptr< ParameterDescriptionNode > node_left, ParameterDescriptionNode const &node_right) | |
XORGroupDescription (std::auto_ptr< ParameterDescriptionNode > node_left, std::auto_ptr< ParameterDescriptionNode > node_right) | |
XORGroupDescription (ParameterDescriptionNode const &node_left, std::auto_ptr< ParameterDescriptionNode > node_right) | |
XORGroupDescription (ParameterDescriptionNode const &node_left, ParameterDescriptionNode const &node_right) | |
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 bool | hasNestedContent_ () |
virtual int | howManyXORSubNodesExist_ (ParameterSet const &pset) const |
virtual bool | partiallyExists_ (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) |
void | throwAfterValidation () const |
void | throwMoreThanOneParameter () const |
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 |
Private Attributes | |
edm::value_ptr < ParameterDescriptionNode > | node_left_ |
edm::value_ptr < ParameterDescriptionNode > | node_right_ |
Definition at line 18 of file XORGroupDescription.h.
edm::XORGroupDescription::XORGroupDescription | ( | ParameterDescriptionNode const & | node_left, |
ParameterDescriptionNode const & | node_right | ||
) |
Definition at line 12 of file XORGroupDescription.cc.
Referenced by clone().
: node_left_(node_left.clone()), node_right_(node_right.clone()) { }
edm::XORGroupDescription::XORGroupDescription | ( | std::auto_ptr< ParameterDescriptionNode > | node_left, |
ParameterDescriptionNode const & | node_right | ||
) |
Definition at line 19 of file XORGroupDescription.cc.
: node_left_(node_left), node_right_(node_right.clone()) { }
edm::XORGroupDescription::XORGroupDescription | ( | ParameterDescriptionNode const & | node_left, |
std::auto_ptr< ParameterDescriptionNode > | node_right | ||
) |
Definition at line 26 of file XORGroupDescription.cc.
: node_left_(node_left.clone()), node_right_(node_right) { }
edm::XORGroupDescription::XORGroupDescription | ( | std::auto_ptr< ParameterDescriptionNode > | node_left, |
std::auto_ptr< ParameterDescriptionNode > | node_right | ||
) |
Definition at line 33 of file XORGroupDescription.cc.
: node_left_(node_left), node_right_(node_right) { }
void edm::XORGroupDescription::checkAndGetLabelsAndTypes_ | ( | std::set< std::string > & | usedLabels, |
std::set< ParameterTypes > & | parameterTypes, | ||
std::set< ParameterTypes > & | wildcardTypes | ||
) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 41 of file XORGroupDescription.cc.
References node_left_, and node_right_.
{ std::set<std::string> labelsLeft; std::set<ParameterTypes> parameterTypesLeft; std::set<ParameterTypes> wildcardTypesLeft; node_left_->checkAndGetLabelsAndTypes(labelsLeft, parameterTypesLeft, wildcardTypesLeft); std::set<std::string> labelsRight; std::set<ParameterTypes> parameterTypesRight; std::set<ParameterTypes> wildcardTypesRight; node_right_->checkAndGetLabelsAndTypes(labelsRight, parameterTypesRight, wildcardTypesRight); usedLabels.insert(labelsLeft.begin(), labelsLeft.end()); usedLabels.insert(labelsRight.begin(), labelsRight.end()); parameterTypes.insert(parameterTypesRight.begin(), parameterTypesRight.end()); parameterTypes.insert(parameterTypesLeft.begin(), parameterTypesLeft.end()); wildcardTypes.insert(wildcardTypesRight.begin(), wildcardTypesRight.end()); wildcardTypes.insert(wildcardTypesLeft.begin(), wildcardTypesLeft.end()); }
virtual ParameterDescriptionNode* edm::XORGroupDescription::clone | ( | void | ) | const [inline, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 32 of file XORGroupDescription.h.
References XORGroupDescription().
{ return new XORGroupDescription(*this); }
bool edm::XORGroupDescription::exists_ | ( | ParameterSet const & | pset | ) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 222 of file XORGroupDescription.cc.
References node_left_, and node_right_.
{ int nTotal = node_left_->howManyXORSubNodesExist(pset) + node_right_->howManyXORSubNodesExist(pset); return nTotal == 1; }
virtual bool edm::XORGroupDescription::hasNestedContent_ | ( | ) | [inline, private, virtual] |
Reimplemented from edm::ParameterDescriptionNode.
Definition at line 56 of file XORGroupDescription.h.
{ return true; }
int edm::XORGroupDescription::howManyXORSubNodesExist_ | ( | ParameterSet const & | pset | ) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 236 of file XORGroupDescription.cc.
References node_left_, and node_right_.
{ return node_left_->howManyXORSubNodesExist(pset) + node_right_->howManyXORSubNodesExist(pset); }
bool edm::XORGroupDescription::partiallyExists_ | ( | ParameterSet const & | pset | ) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 230 of file XORGroupDescription.cc.
References edm::ParameterDescriptionNode::exists().
{ return exists(pset); }
void edm::XORGroupDescription::print_ | ( | std::ostream & | os, |
bool | optional, | ||
bool | writeToCfi, | ||
DocFormatHelper & | dfh | ||
) | [private, virtual] |
Reimplemented from edm::ParameterDescriptionNode.
Definition at line 113 of file XORGroupDescription.cc.
References edm::DocFormatHelper::brief(), edm::ParameterDescriptionNode::comment(), edm::DocFormatHelper::commentWidth(), edm::DocFormatHelper::counter(), edm::DocFormatHelper::decrementCounter(), relativeConstraints::empty, edm::DocFormatHelper::indent(), edm::DocFormatHelper::indent2(), node_left_, node_right_, edm::DocFormatHelper::parent(), edm::DocFormatHelper::pass(), edm::DocFormatHelper::section(), edm::DocFormatHelper::startColumn2(), edm::DocFormatHelper::wrapAndPrintText(), and edm::DocFormatHelper::XOR.
{ if (dfh.parent() == DocFormatHelper::XOR) { dfh.decrementCounter(); node_left_->print(os, false, true, dfh); node_right_->print(os, false, true, dfh); return; } if (dfh.pass() == 1) { dfh.indent(os); os << "XOR group:"; if (dfh.brief()) { if (optional) os << " optional"; if (!writeToCfi) os << " (do not write to cfi)"; os << " see Section " << dfh.section() << "." << dfh.counter() << "\n"; } // not brief else { os << "\n"; dfh.indent2(os); if (optional) os << "optional"; if (!writeToCfi) os << " (do not write to cfi)"; if (optional || !writeToCfi) { os << "\n"; dfh.indent2(os); } os << "see Section " << dfh.section() << "." << dfh.counter() << "\n"; if (!comment().empty()) { DocFormatHelper::wrapAndPrintText(os, comment(), dfh.startColumn2(), dfh.commentWidth()); } os << "\n"; } } }
void edm::XORGroupDescription::printNestedContent_ | ( | std::ostream & | os, |
bool | optional, | ||
DocFormatHelper & | dfh | ||
) | [private, virtual] |
Reimplemented from edm::ParameterDescriptionNode.
Definition at line 166 of file XORGroupDescription.cc.
References edm::DocFormatHelper::brief(), edm::DocFormatHelper::counter(), edm::DocFormatHelper::decrementCounter(), edm::DocFormatHelper::indentation(), edm::DocFormatHelper::init(), node_left_, node_right_, edm::DocFormatHelper::offsetSectionContent(), edm::DocFormatHelper::parent(), edm::ParameterDescriptionNode::printSpaces(), edm::DocFormatHelper::section(), edm::DocFormatHelper::setCounter(), edm::DocFormatHelper::setIndentation(), edm::DocFormatHelper::setParent(), edm::DocFormatHelper::setPass(), edm::DocFormatHelper::setSection(), pat::TOP, and edm::DocFormatHelper::XOR.
{ if (dfh.parent() == DocFormatHelper::XOR) { dfh.decrementCounter(); node_left_->printNestedContent(os, false, dfh); node_right_->printNestedContent(os, false, dfh); return; } int indentation = dfh.indentation(); if (dfh.parent() != DocFormatHelper::TOP) { indentation -= DocFormatHelper::offsetSectionContent(); } std::stringstream ss; ss << dfh.section() << "." << dfh.counter(); std::string newSection = ss.str(); printSpaces(os, indentation); os << "Section " << newSection << " XOR group description:\n"; printSpaces(os, indentation); if (optional) { os << "This optional XOR group requires exactly one or none of the following to be in the PSet\n"; } else { os << "This XOR group requires exactly one of the following to be in the PSet\n"; } if (!dfh.brief()) os << "\n"; DocFormatHelper new_dfh(dfh); new_dfh.init(); new_dfh.setSection(newSection); new_dfh.setIndentation(indentation + DocFormatHelper::offsetSectionContent()); new_dfh.setParent(DocFormatHelper::XOR); node_left_->print(os, false, true, new_dfh); node_right_->print(os, false, true, new_dfh); new_dfh.setPass(1); new_dfh.setCounter(0); node_left_->print(os, false, true, new_dfh); node_right_->print(os, false, true, new_dfh); new_dfh.setPass(2); new_dfh.setCounter(0); node_left_->printNestedContent(os, false, new_dfh); node_right_->printNestedContent(os, false, new_dfh); }
void edm::XORGroupDescription::throwAfterValidation | ( | ) | const [private] |
Definition at line 257 of file XORGroupDescription.cc.
References Exception, and edm::errors::LogicError.
Referenced by validate_().
{ // Need to expand this error message to print more information // I guess I need to print out the entire node structure of // of the xor node and all the nodes it contains. throw edm::Exception(errors::LogicError) << "Exactly one parameter can exist in a ParameterSet from a list of\n" << "parameters described by an \"xor\" operator in a ParameterSetDescription.\n" << "This rule also applies in a more general sense to the other types\n" << "of nodes that can appear within a ParameterSetDescription. Only one\n" << "can pass validation as \"existing\". This error has occurred after an\n" << "attempt to insert missing parameters to fix the problem.\n"; }
void edm::XORGroupDescription::throwMoreThanOneParameter | ( | ) | const [private] |
Definition at line 243 of file XORGroupDescription.cc.
References Exception, and edm::errors::LogicError.
Referenced by validate_().
{ // Need to expand this error message to print more information // I guess I need to print out the entire node structure of // of the xor node and all the nodes it contains. throw edm::Exception(errors::LogicError) << "Exactly one parameter can exist in a ParameterSet from a list of\n" << "parameters described by an \"xor\" operator in a ParameterSetDescription.\n" << "This rule also applies in a more general sense to the other types\n" << "of nodes that can appear within a ParameterSetDescription. Only one\n" << "can pass validation as \"existing\".\n"; }
void edm::XORGroupDescription::validate_ | ( | ParameterSet & | pset, |
std::set< std::string > & | validatedLabels, | ||
bool | optional | ||
) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 67 of file XORGroupDescription.cc.
References node_left_, node_right_, throwAfterValidation(), and throwMoreThanOneParameter().
{ int nExistLeft = node_left_->howManyXORSubNodesExist(pset); int nExistRight = node_right_->howManyXORSubNodesExist(pset); int nTotal = nExistLeft + nExistRight; if (nTotal == 0 && optional) return; if (nTotal > 1) { throwMoreThanOneParameter(); } if (nExistLeft == 1) { node_left_->validate(pset, validatedLabels, false); } else if (nExistRight == 1) { node_right_->validate(pset, validatedLabels, false); } else if (nTotal == 0) { node_left_->validate(pset, validatedLabels, false); // When missing parameters get inserted, both nodes could // be affected so we have to recheck both nodes. nExistLeft = node_left_->howManyXORSubNodesExist(pset); nExistRight = node_right_->howManyXORSubNodesExist(pset); nTotal = nExistLeft + nExistRight; if (nTotal != 1) { throwAfterValidation(); } } }
void edm::XORGroupDescription::writeCfi_ | ( | std::ostream & | os, |
bool & | startWithComma, | ||
int | indentation, | ||
bool & | wroteSomething | ||
) | const [private, virtual] |
Implements edm::ParameterDescriptionNode.
Definition at line 104 of file XORGroupDescription.cc.
References node_left_.
{ node_left_->writeCfi(os, startWithComma, indentation, wroteSomething); }
Definition at line 73 of file XORGroupDescription.h.
Referenced by checkAndGetLabelsAndTypes_(), exists_(), howManyXORSubNodesExist_(), print_(), printNestedContent_(), validate_(), and writeCfi_().
Definition at line 74 of file XORGroupDescription.h.
Referenced by checkAndGetLabelsAndTypes_(), exists_(), howManyXORSubNodesExist_(), print_(), printNestedContent_(), and validate_().