15 : node_left_(node_left.
clone()), node_right_(node_right.
clone()) {}
22 std::unique_ptr<ParameterDescriptionNode> node_right)
26 std::unique_ptr<ParameterDescriptionNode> node_right)
30 std::set<ParameterTypes>& parameterTypes,
31 std::set<ParameterTypes>& wildcardTypes)
const {
32 std::set<std::string> labelsLeft;
33 std::set<ParameterTypes> parameterTypesLeft;
34 std::set<ParameterTypes> wildcardTypesLeft;
35 node_left_->checkAndGetLabelsAndTypes(labelsLeft, parameterTypesLeft, wildcardTypesLeft);
37 std::set<std::string> labelsRight;
38 std::set<ParameterTypes> parameterTypesRight;
39 std::set<ParameterTypes> wildcardTypesRight;
40 node_right_->checkAndGetLabelsAndTypes(labelsRight, parameterTypesRight, wildcardTypesRight);
46 usedLabels.insert(labelsLeft.begin(), labelsLeft.end());
47 usedLabels.insert(labelsRight.begin(), labelsRight.end());
49 parameterTypes.insert(parameterTypesRight.begin(), parameterTypesRight.end());
50 parameterTypes.insert(parameterTypesLeft.begin(), parameterTypesLeft.end());
52 wildcardTypes.insert(wildcardTypesRight.begin(), wildcardTypesRight.end());
53 wildcardTypes.insert(wildcardTypesLeft.begin(), wildcardTypesLeft.end());
60 if (!leftExists && !rightExists) {
62 }
else if (leftExists && rightExists) {
63 node_left_->validate(pset, validatedLabels,
false);
64 node_right_->validate(pset, validatedLabels,
false);
65 }
else if (leftExists && !rightExists) {
66 node_left_->validate(pset, validatedLabels,
false);
68 node_right_->validate(pset, validatedLabels,
false);
69 }
else if (!leftExists && rightExists) {
70 node_left_->validate(pset, validatedLabels,
false);
71 node_right_->validate(pset, validatedLabels,
false);
78 bool& wroteSomething)
const {
79 node_left_->writeCfi(os, startWithComma, indentation, wroteSomething);
80 node_right_->writeCfi(os, startWithComma, indentation, wroteSomething);
84 if (dfh.
pass() == 1) {
86 os <<
"IfExists pair:";
93 os <<
" (do not write to cfi)";
95 os <<
" see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"\n";
105 os <<
" (do not write to cfi)";
106 if (optional || !writeToCfi) {
111 os <<
"see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"\n";
127 std::stringstream ss;
132 os <<
"Section " << newSection;
135 os <<
" IfExists pair description:\n";
138 os <<
"If the first parameter exists, then the second is allowed to exist\n";
140 os <<
"If the first parameter exists, then the second is required to exist\n";
163 node_left_->printNestedContent(os,
false, new_dfh);
164 node_right_->printNestedContent(os,
false, new_dfh);
171 if (leftExists && rightExists)
173 else if (!leftExists && !rightExists)
183 std::set<std::string>
const& labelsRight)
const {
184 std::set<std::string> duplicateLabels;
185 std::insert_iterator<std::set<std::string> > insertIter(duplicateLabels, duplicateLabels.begin());
186 std::set_intersection(labelsLeft.begin(), labelsLeft.end(), labelsRight.begin(), labelsRight.end(), insertIter);
187 if (!duplicateLabels.empty()) {
188 std::stringstream ss;
189 for (std::set<std::string>::const_iterator iter = duplicateLabels.begin(), iEnd = duplicateLabels.end();
192 ss <<
" \"" << *iter <<
"\"\n";
195 <<
"\"ifExists\" expression must be not be the same as labels used\n" 196 <<
"in other nodes of the expression. The following duplicate\n" 197 <<
"labels were detected:\n" 203 std::set<ParameterTypes>
const& types2)
const {
204 if (!types1.empty()) {
205 std::set<ParameterTypes> duplicateTypes;
206 std::insert_iterator<std::set<ParameterTypes> > insertIter(duplicateTypes, duplicateTypes.begin());
207 std::set_intersection(types1.begin(), types1.end(), types2.begin(), types2.end(), insertIter);
208 if (!duplicateTypes.empty()) {
209 std::stringstream ss;
210 for (std::set<ParameterTypes>::const_iterator iter = duplicateTypes.begin(), iEnd = duplicateTypes.end();
216 <<
"Types used for wildcards in a node of a ParameterSetDescription\n" 217 <<
"\"ifExists\" expression must be different from types used for other parameters\n" 218 <<
"in other nodes. The following duplicate types were detected:\n"
bool exists_(ParameterSet const &pset) const override
bool partiallyExists_(ParameterSet const &pset) const override
void print_(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) const override
void printNestedContent_(std::ostream &os, bool optional, DocFormatHelper &dfh) const override
ParameterDescriptionNode * clone() const override
std::string parameterTypeEnumToString(ParameterTypes iType)
IfExistsDescription(ParameterDescriptionNode const &node_left, ParameterDescriptionNode const &node_right)
void throwIfDuplicateLabels(std::set< std::string > const &labelsLeft, std::set< std::string > const &labelsRight) const
void validate_(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override
void throwIfDuplicateTypes(std::set< ParameterTypes > const &types1, std::set< ParameterTypes > const &types2) const
std::string const & comment() const
edm::value_ptr< ParameterDescriptionNode > node_right_
edm::value_ptr< ParameterDescriptionNode > node_left_
void checkAndGetLabelsAndTypes_(std::set< std::string > &usedLabels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const override
static void printSpaces(std::ostream &os, int n)
void writeCfi_(std::ostream &os, bool &startWithComma, int indentation, bool &wroteSomething) const override
bool exists(ParameterSet const &pset) const
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
int howManyXORSubNodesExist_(ParameterSet const &pset) const override