16 node_left_(node_left.
clone()),
17 node_right_(node_right.
clone()) {
29 std::unique_ptr<ParameterDescriptionNode> node_right) :
36 std::unique_ptr<ParameterDescriptionNode> node_right) :
44 std::set<ParameterTypes> & parameterTypes,
45 std::set<ParameterTypes> & wildcardTypes)
const {
47 std::set<std::string> labelsLeft;
48 std::set<ParameterTypes> parameterTypesLeft;
49 std::set<ParameterTypes> wildcardTypesLeft;
50 node_left_->checkAndGetLabelsAndTypes(labelsLeft, parameterTypesLeft, wildcardTypesLeft);
52 std::set<std::string> labelsRight;
53 std::set<ParameterTypes> parameterTypesRight;
54 std::set<ParameterTypes> wildcardTypesRight;
55 node_right_->checkAndGetLabelsAndTypes(labelsRight, parameterTypesRight, wildcardTypesRight);
61 usedLabels.insert(labelsLeft.begin(), labelsLeft.end());
62 usedLabels.insert(labelsRight.begin(), labelsRight.end());
64 parameterTypes.insert(parameterTypesRight.begin(), parameterTypesRight.end());
65 parameterTypes.insert(parameterTypesLeft.begin(), parameterTypesLeft.end());
67 wildcardTypes.insert(wildcardTypesRight.begin(), wildcardTypesRight.end());
68 wildcardTypes.insert(wildcardTypesLeft.begin(), wildcardTypesLeft.end());
74 std::set<std::string> & validatedLabels,
75 bool optional)
const {
80 if (leftExists || rightExists) {
81 if (leftExists)
node_left_->validate(pset, validatedLabels,
false);
82 if (rightExists)
node_right_->validate(pset, validatedLabels,
false);
88 node_left_->validate(pset, validatedLabels,
false);
94 bool & startWithComma,
96 bool & wroteSomething)
const {
97 node_left_->writeCfi(os, startWithComma, indentation, wroteSomething);
114 if (dfh.
pass() == 1) {
121 if (optional) os <<
" optional";
123 if (!writeToCfi) os <<
" (do not write to cfi)";
125 os <<
" see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"\n";
133 if (optional) os <<
"optional";
134 if (!writeToCfi) os <<
" (do not write to cfi)";
135 if (optional || !writeToCfi) {
140 os <<
"see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"\n";
161 node_left_->printNestedContent(os,
false, dfh);
171 std::stringstream ss;
176 os <<
"Section " << newSection
177 <<
" OR group description:\n";
183 os <<
"This optional OR group requires at least one or none of the following to be in the PSet\n";
186 os <<
"This OR group requires at least one of the following to be in the PSet\n";
188 if (!dfh.
brief()) os <<
"\n";
208 node_left_->printNestedContent(os,
false, new_dfh);
209 node_right_->printNestedContent(os,
false, new_dfh);
228 return exists(pset) ? 1 : 0;
234 std::set<std::string>
const& labelsRight)
const {
236 std::set<std::string> duplicateLabels;
237 std::insert_iterator<std::set<std::string> > insertIter(duplicateLabels, duplicateLabels.begin());
238 std::set_intersection(labelsLeft.begin(), labelsLeft.end(),
239 labelsRight.begin(), labelsRight.end(),
241 if (!duplicateLabels.empty()) {
242 std::stringstream ss;
243 for (std::set<std::string>::const_iterator iter = duplicateLabels.begin(),
244 iEnd = duplicateLabels.end();
247 ss <<
" \"" << *iter <<
"\"\n";
250 <<
"Labels used in a node of a ParameterSetDescription\n" 251 <<
"\"or\" expression must be not be the same as labels used\n" 252 <<
"in other nodes of the expression. The following duplicate\n" 253 <<
"labels were detected:\n" 262 std::set<ParameterTypes>
const& types2)
const 264 if (!types1.empty()) {
265 std::set<ParameterTypes> duplicateTypes;
266 std::insert_iterator<std::set<ParameterTypes> > insertIter(duplicateTypes, duplicateTypes.begin());
267 std::set_intersection(types1.begin(), types1.end(),
268 types2.begin(), types2.end(),
270 if (!duplicateTypes.empty()) {
271 std::stringstream ss;
272 for (std::set<ParameterTypes>::const_iterator iter = duplicateTypes.begin(),
273 iEnd = duplicateTypes.end();
279 <<
"Types used for wildcards in a node of a ParameterSetDescription\n" 280 <<
"\"or\" expression must be different from types used for other parameters\n" 281 <<
"in other nodes. The following duplicate types were detected:\n"
bool exists_(ParameterSet const &pset) const override
edm::value_ptr< ParameterDescriptionNode > node_left_
void validate_(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override
ParameterDescriptionNode * clone() const override
std::string parameterTypeEnumToString(ParameterTypes iType)
int howManyXORSubNodesExist_(ParameterSet const &pset) const override
std::string const & comment() const
void writeCfi_(std::ostream &os, bool &startWithComma, int indentation, bool &wroteSomething) const override
static void printSpaces(std::ostream &os, int n)
ORGroupDescription(ParameterDescriptionNode const &node_left, ParameterDescriptionNode const &node_right)
bool exists(ParameterSet const &pset) const
void print_(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) const override
bool partiallyExists_(ParameterSet const &pset) const override
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
void throwIfDuplicateTypes(std::set< ParameterTypes > const &types1, std::set< ParameterTypes > const &types2) const
void throwIfDuplicateLabels(std::set< std::string > const &labelsLeft, std::set< std::string > const &labelsRight) const
void checkAndGetLabelsAndTypes_(std::set< std::string > &usedLabels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const override
edm::value_ptr< ParameterDescriptionNode > node_right_
void printNestedContent_(std::ostream &os, bool optional, DocFormatHelper &dfh) const override