30 anythingAllowed_(
false),
60 std::auto_ptr<ParameterDescriptionNode> clonedNode(node.
clone());
61 return addNode(clonedNode,
false,
true);
67 return addNode(node,
false,
true);
73 std::auto_ptr<ParameterDescriptionNode> clonedNode(node.
clone());
74 return addNode(clonedNode,
true, writeToCfi);
80 return addNode(node,
true, writeToCfi);
89 std::set<std::string> nodeLabels;
90 std::set<ParameterTypes> nodeParameterTypes;
91 std::set<ParameterTypes> nodeWildcardTypes;
100 return entries_.back().setNode(node);
106 using std::placeholders::_1;
109 std::set<std::string> validatedLabels;
114 if (validatedLabels.size() != parameterNames.size()) {
122 if (pset.
exists(module_label)) {
123 validatedLabels.insert(module_label);
127 if (pset.
exists(module_type)) {
128 validatedLabels.insert(module_type);
132 if (pset.
exists(module_edm_type)) {
133 validatedLabels.insert(module_edm_type);
137 if (pset.
exists(service_type)) {
138 validatedLabels.insert(service_type);
142 if (validatedLabels.size() != parameterNames.size()) {
154 int indentation)
const {
155 using std::placeholders::_1;
156 bool wroteSomething =
false;
161 std::ref(startWithComma),
163 std::ref(wroteSomething)));
165 if (wroteSomething) {
166 char oldFill = os.fill();
167 os <<
"\n" << std::setfill(
' ') << std::setw(indentation - 2) <<
"" << std::setfill(oldFill);
174 std::set<std::string> & validatedLabels) {
175 entry.
node()->validate(pset, validatedLabels, entry.
optional());
181 using std::placeholders::_1;
184 os <<
"Description is unknown. The configured PSet will not be validated\n";
186 os <<
"because the plugin has not defined this parameter set description.\n";
187 if (!dfh.
brief()) os <<
"\n";
192 os <<
"Description allows anything. If the configured PSet contains illegal parameters,\n";
194 os <<
"then validation will ignore them instead of throwing an exception.\n";
195 if (!dfh.
brief()) os <<
"\n";
200 os <<
"Description is empty\n";
201 if (!dfh.
brief()) os <<
"\n";
239 std::vector<std::string>
const& parameterNames,
240 std::set<std::string>
const& validatedLabels) {
242 std::set<std::string> parNames(parameterNames.begin(), parameterNames.end());
245 std::set<std::string> diffNames;
246 std::insert_iterator<std::set<std::string> > insertIter(diffNames, diffNames.begin());
247 std::set_difference(parNames.begin(), parNames.end(),
248 validatedLabels.begin(), validatedLabels.end(),
251 std::stringstream
ss;
252 for (std::set<std::string>::const_iterator
iter = diffNames.begin(),
253 iEnd = diffNames.end();
256 ss <<
" '" << *
iter <<
"'\n";
258 if (diffNames.size() == 1U) {
260 <<
"Illegal parameter found in configuration. The parameter is named:\n"
262 <<
"You could be trying to use a parameter name that is not\n"
263 <<
"allowed for this plugin or it could be misspelled.\n";
267 <<
"Illegal parameters found in configuration. The parameters are named:\n"
269 <<
"You could be trying to use parameter names that are not\n"
270 <<
"allowed for this plugin or they could be misspelled.\n";
277 bool & startWithComma,
279 bool & wroteSomething) {
281 entry.
node()->writeCfi(os, startWithComma, indentation, wroteSomething);
289 if (dfh.
pass() < 2) {
293 entry.
node()->printNestedContent(os, entry.
optional(), dfh);
301 std::set<std::string> duplicateLabels;
302 std::insert_iterator<std::set<std::string> > insertIter(duplicateLabels, duplicateLabels.begin());
303 std::set_intersection(nodeLabels.begin(), nodeLabels.end(),
306 if (duplicateLabels.empty()) {
307 usedLabels_.insert(nodeLabels.begin(), nodeLabels.end());
311 std::stringstream
ss;
312 for (std::set<std::string>::const_iterator
iter = duplicateLabels.begin(),
313 iEnd = duplicateLabels.end();
316 ss <<
" \"" << *
iter <<
"\"\n";
319 <<
"Labels used in different nodes of a ParameterSetDescription\n"
320 <<
"must be unique. The following duplicate labels were detected:\n"
329 std::set<ParameterTypes>
const& nodeWildcardTypes) {
342 if (!nodeWildcardTypes.empty()) {
344 std::set<ParameterTypes> duplicateTypes1;
345 std::insert_iterator<std::set<ParameterTypes> > insertIter1(duplicateTypes1, duplicateTypes1.begin());
347 nodeWildcardTypes.begin(), nodeWildcardTypes.end(),
350 if (!duplicateTypes1.empty()) {
352 std::stringstream
ss;
353 for (std::set<ParameterTypes>::const_iterator
iter = duplicateTypes1.begin(),
354 iEnd = duplicateTypes1.end();
360 <<
"Within a ParameterSetDescription, the type used for a wildcard must\n"
361 <<
"not be the same as the type used for other parameters. This rule\n"
362 <<
"is violated for the following types:\n"
370 std::set<ParameterTypes> duplicateTypes2;
371 std::insert_iterator<std::set<ParameterTypes> > insertIter2(duplicateTypes2, duplicateTypes2.begin());
373 nodeParameterTypes.begin(), nodeParameterTypes.end(),
376 if (!duplicateTypes2.empty()) {
378 std::stringstream
ss;
379 for (std::set<ParameterTypes>::const_iterator
iter = duplicateTypes2.begin(),
380 iEnd = duplicateTypes2.end();
386 <<
"Within a ParameterSetDescription, the type used for a wildcard must\n"
387 <<
"not be the same as the type used for other parameters. This rule is\n"
388 <<
"violated for the following types :\n"
402 bool optional,
bool writeToCfi) {
404 return addNode(pdIfExists, optional, writeToCfi);
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
volatile std::atomic< bool > shutdown_flag false
virtual ~ParameterSetDescription()