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;
73 entry.setWriteToCfi(writeToCfi);
79 using std::placeholders::_1;
83 std::set<std::string> validatedLabels;
86 std::vector<std::string> parameterNames =
pset.getParameterNames();
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);
115 if (
pset.exists(tryToContinue)) {
116 validatedLabels.insert(tryToContinue);
120 if (validatedLabels.size() != parameterNames.size()) {
129 using std::placeholders::_1;
130 bool wroteSomething =
false;
132 bool seenWildcard =
false;
135 if (
entry.node()->isWildcard()) {
136 if (seenWildcard ==
true) {
144 if (wroteSomething) {
145 char oldFill = os.fill();
146 os <<
"\n" << std::setfill(
' ') << std::setw(
indentation - 2) <<
"" << std::setfill(oldFill);
152 std::set<std::string>& validatedLabels) {
157 using std::placeholders::_1;
160 os <<
"Description is unknown. The configured PSet will not be validated\n";
162 os <<
"because the plugin has not defined this parameter set description.\n";
169 os <<
"Description allows anything. If the configured PSet contains illegal parameters,\n";
171 os <<
"then validation will ignore them instead of throwing an exception.\n";
178 os <<
"Description is empty\n";
206 std::set<std::string>
const& validatedLabels) {
207 std::set<std::string>
parNames(parameterNames.begin(), parameterNames.end());
209 std::set<std::string> diffNames;
210 std::insert_iterator<std::set<std::string> > insertIter(diffNames, diffNames.begin());
213 std::stringstream
ss;
214 for (std::set<std::string>::const_iterator iter = diffNames.begin(), iEnd = diffNames.end(); iter != iEnd; ++iter) {
215 ss <<
" '" << *iter <<
"'\n";
217 if (diffNames.size() == 1
U) {
219 <<
"Illegal parameter found in configuration. The parameter is named:\n" 220 <<
ss.str() <<
"You could be trying to use a parameter name that is not\n" 221 <<
"allowed for this plugin or it could be misspelled.\n";
224 <<
"Illegal parameters found in configuration. The parameters are named:\n" 225 <<
ss.str() <<
"You could be trying to use parameter names that are not\n" 226 <<
"allowed for this plugin or they could be misspelled.\n";
232 if (
entry.writeToCfi()) {
238 if (dfh.
pass() < 2) {
241 entry.node()->printNestedContent(os,
entry.optional(), dfh);
246 std::set<std::string> duplicateLabels;
247 std::insert_iterator<std::set<std::string> > insertIter(duplicateLabels, duplicateLabels.begin());
249 if (duplicateLabels.empty()) {
250 usedLabels_.insert(nodeLabels.begin(), nodeLabels.end());
252 std::stringstream
ss;
253 for (std::set<std::string>::const_iterator iter = duplicateLabels.begin(), iEnd = duplicateLabels.end();
256 ss <<
" \"" << *iter <<
"\"\n";
259 <<
"must be unique. The following duplicate labels were detected:\n" 265 std::set<ParameterTypes>
const& nodeWildcardTypes) {
277 if (!nodeWildcardTypes.empty()) {
278 std::set<ParameterTypes> duplicateTypes1;
279 std::insert_iterator<std::set<ParameterTypes> > insertIter1(duplicateTypes1, duplicateTypes1.begin());
282 nodeWildcardTypes.begin(),
283 nodeWildcardTypes.end(),
286 if (!duplicateTypes1.empty()) {
287 std::stringstream
ss;
288 for (std::set<ParameterTypes>::const_iterator iter = duplicateTypes1.begin(), iEnd = duplicateTypes1.end();
294 <<
"Within a ParameterSetDescription, the type used for a wildcard must\n" 295 <<
"not be the same as the type used for other parameters. This rule\n" 296 <<
"is violated for the following types:\n" 302 std::set<ParameterTypes> duplicateTypes2;
303 std::insert_iterator<std::set<ParameterTypes> > insertIter2(duplicateTypes2, duplicateTypes2.begin());
306 nodeParameterTypes.begin(),
307 nodeParameterTypes.end(),
310 if (!duplicateTypes2.empty()) {
311 std::stringstream
ss;
312 for (std::set<ParameterTypes>::const_iterator iter = duplicateTypes2.begin(), iEnd = duplicateTypes2.end();
318 <<
"Within a ParameterSetDescription, the type used for a wildcard must\n" 319 <<
"not be the same as the type used for other parameters. This rule is\n" 320 <<
"violated for the following types :\n" 333 std::unique_ptr<ParameterDescriptionNode> pdIfExists = std::make_unique<IfExistsDescription>(node1, node2);
SetDescriptionEntries entries_
bool isLabelUnused(std::string const &label) const
virtual ParameterDescriptionNode * clone() const =0
static void throwIllegalParameters(std::vector< std::string > const ¶meterNames, std::set< std::string > const &validatedNames)
void print(std::ostream &os, DocFormatHelper &dfh) const
void throwIfWildcardCollision(std::set< ParameterTypes > const &nodeParameterTypes, std::set< ParameterTypes > const &nodeWildcardTypes)
void setAllowAnything()
allow any parameter label/value pairs
std::set< std::string > usedLabels_
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)
std::string parameterTypeEnumToString(ParameterTypes iType)
void writeCfi(std::ostream &os, bool startWithComma, int indentation) const
std::set< ParameterTypes > typesUsedForParameters_
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
void setComment(std::string const &value)
void throwIfLabelsAlreadyUsed(std::set< std::string > const &nodeLabels)
ParameterDescriptionNode * addOptionalNode(ParameterDescriptionNode const &node, bool writeToCfi)
static void validateNode(SetDescriptionEntry const &entry, ParameterSet &pset, std::set< std::string > &validatedNames)
static void printNode(SetDescriptionEntry const &entry, std::ostream &os, DocFormatHelper &dfh)
void checkAndGetLabelsAndTypes(std::set< std::string > &usedLabels, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const
ParameterSetDescription()
void validate(ParameterSet &pset) const
static const uint16_t unknown_
std::set< ParameterTypes > typesUsedForWildcards_
bool anythingAllowed() const
virtual ~ParameterSetDescription()