42 std::unique_ptr<ParameterDescriptionNode> clonedNode(node.
clone());
52 std::unique_ptr<ParameterDescriptionNode> clonedNode(node.
clone());
64 std::set<std::string> nodeLabels;
65 std::set<ParameterTypes> nodeParameterTypes;
66 std::set<ParameterTypes> nodeWildcardTypes;
79 using std::placeholders::_1;
83 std::set<std::string> validatedLabels;
87 if (validatedLabels.size() != parameterNames.size()) {
94 if (pset.
exists(module_label)) {
95 validatedLabels.insert(module_label);
99 if (pset.
exists(module_type)) {
100 validatedLabels.insert(module_type);
104 if (pset.
exists(module_edm_type)) {
105 validatedLabels.insert(module_edm_type);
109 if (pset.
exists(service_type)) {
110 validatedLabels.insert(service_type);
114 if (validatedLabels.size() != parameterNames.size()) {
123 using std::placeholders::_1;
124 bool wroteSomething =
false;
130 std::ref(startWithComma),
132 std::ref(wroteSomething)));
134 if (wroteSomething) {
135 char oldFill = os.fill();
136 os <<
"\n" << std::setfill(
' ') << std::setw(indentation - 2) <<
"" << std::setfill(oldFill);
142 std::set<std::string>& validatedLabels) {
143 entry.
node()->validate(pset, validatedLabels, entry.
optional());
147 using std::placeholders::_1;
150 os <<
"Description is unknown. The configured PSet will not be validated\n";
152 os <<
"because the plugin has not defined this parameter set description.\n";
159 os <<
"Description allows anything. If the configured PSet contains illegal parameters,\n";
161 os <<
"then validation will ignore them instead of throwing an exception.\n";
168 os <<
"Description is empty\n";
196 std::set<std::string>
const& validatedLabels) {
197 std::set<std::string> parNames(parameterNames.begin(), parameterNames.end());
199 std::set<std::string> diffNames;
200 std::insert_iterator<std::set<std::string> > insertIter(diffNames, diffNames.begin());
201 std::set_difference(parNames.begin(), parNames.end(), validatedLabels.begin(), validatedLabels.end(), insertIter);
203 std::stringstream
ss;
204 for (std::set<std::string>::const_iterator iter = diffNames.begin(), iEnd = diffNames.end(); iter != iEnd; ++iter) {
205 ss <<
" '" << *iter <<
"'\n";
207 if (diffNames.size() == 1U) {
209 <<
"Illegal parameter found in configuration. The parameter is named:\n"
210 << ss.str() <<
"You could be trying to use a parameter name that is not\n"
211 <<
"allowed for this plugin or it could be misspelled.\n";
214 <<
"Illegal parameters found in configuration. The parameters are named:\n"
215 << ss.str() <<
"You could be trying to use parameter names that are not\n"
216 <<
"allowed for this plugin or they could be misspelled.\n";
223 entry.
node()->writeCfi(os, entry.
optional(), startWithComma, indentation, wroteSomething);
228 if (dfh.
pass() < 2) {
231 entry.
node()->printNestedContent(os, entry.
optional(), dfh);
236 std::set<std::string> duplicateLabels;
237 std::insert_iterator<std::set<std::string> > insertIter(duplicateLabels, duplicateLabels.begin());
239 if (duplicateLabels.empty()) {
240 usedLabels_.insert(nodeLabels.begin(), nodeLabels.end());
242 std::stringstream
ss;
243 for (std::set<std::string>::const_iterator iter = duplicateLabels.begin(), iEnd = duplicateLabels.end();
246 ss <<
" \"" << *iter <<
"\"\n";
249 <<
"must be unique. The following duplicate labels were detected:\n"
255 std::set<ParameterTypes>
const& nodeWildcardTypes) {
267 if (!nodeWildcardTypes.empty()) {
268 std::set<ParameterTypes> duplicateTypes1;
269 std::insert_iterator<std::set<ParameterTypes> > insertIter1(duplicateTypes1, duplicateTypes1.begin());
272 nodeWildcardTypes.begin(),
273 nodeWildcardTypes.end(),
276 if (!duplicateTypes1.empty()) {
277 std::stringstream
ss;
278 for (std::set<ParameterTypes>::const_iterator iter = duplicateTypes1.begin(), iEnd = duplicateTypes1.end();
284 <<
"Within a ParameterSetDescription, the type used for a wildcard must\n"
285 <<
"not be the same as the type used for other parameters. This rule\n"
286 <<
"is violated for the following types:\n"
292 std::set<ParameterTypes> duplicateTypes2;
293 std::insert_iterator<std::set<ParameterTypes> > insertIter2(duplicateTypes2, duplicateTypes2.begin());
296 nodeParameterTypes.begin(),
297 nodeParameterTypes.end(),
300 if (!duplicateTypes2.empty()) {
301 std::stringstream
ss;
302 for (std::set<ParameterTypes>::const_iterator iter = duplicateTypes2.begin(), iEnd = duplicateTypes2.end();
308 <<
"Within a ParameterSetDescription, the type used for a wildcard must\n"
309 <<
"not be the same as the type used for other parameters. This rule is\n"
310 <<
"violated for the following types :\n"
323 std::unique_ptr<ParameterDescriptionNode> pdIfExists = std::make_unique<IfExistsDescription>(node1, node2);
SetDescriptionEntries entries_
virtual ParameterDescriptionNode * clone() const =0
static void throwIllegalParameters(std::vector< std::string > const ¶meterNames, std::set< std::string > const &validatedNames)
edm::value_ptr< ParameterDescriptionNode > const & node() const
void setOptional(bool value)
void throwIfWildcardCollision(std::set< ParameterTypes > const &nodeParameterTypes, std::set< ParameterTypes > const &nodeWildcardTypes)
void setAllowAnything()
allow any parameter label/value pairs
void validate(ParameterSet &pset) const
void setWriteToCfi(bool value)
std::set< std::string > usedLabels_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
static bool throwAnException()
ParameterDescriptionNode * ifExists(ParameterDescriptionNode const &node1, ParameterDescriptionNode const &node2)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
static void writeNode(SetDescriptionEntry const &entry, std::ostream &os, bool &startWithComma, int indentation, bool &wroteSomething)
void writeCfi(std::ostream &os, bool startWithComma, int indentation) const
std::string parameterTypeEnumToString(ParameterTypes iType)
std::set< ParameterTypes > typesUsedForParameters_
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
void setComment(std::string const &value)
bool anythingAllowed() const
void throwIfLabelsAlreadyUsed(std::set< std::string > const &nodeLabels)
void print(std::ostream &os, DocFormatHelper &dfh) const
ParameterDescriptionNode * addOptionalNode(ParameterDescriptionNode const &node, bool writeToCfi)
bool isLabelUnused(std::string const &label) const
std::vector< std::string > getParameterNames() const
static void validateNode(SetDescriptionEntry const &entry, ParameterSet &pset, std::set< std::string > &validatedNames)
static void printNode(SetDescriptionEntry const &entry, std::ostream &os, DocFormatHelper &dfh)
ParameterSetDescription()
static const uint16_t unknown_
std::set< ParameterTypes > typesUsedForWildcards_
void checkAndGetLabelsAndTypes(std::set< std::string > &usedLabels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const
virtual ~ParameterSetDescription()