@@ -70,6 +70,11 @@ namespace edm {
70
70
71
71
std::string parameterTypeEnumToString (ParameterTypes iType);
72
72
73
+ enum class ParameterModifier : unsigned char { kNone , kOptional , kObsolete };
74
+ inline ParameterModifier modifierIsOptional (bool iOptional) {
75
+ return iOptional ? ParameterModifier::kOptional : ParameterModifier::kNone ;
76
+ }
77
+
73
78
namespace cfi {
74
79
struct Paths {
75
80
// This is the 'path' through the cms.PSet hierarchy.
@@ -204,6 +209,8 @@ namespace edm {
204
209
205
210
class ParameterDescriptionNode {
206
211
public:
212
+ using Modifier = ParameterModifier;
213
+
207
214
ParameterDescriptionNode () {}
208
215
209
216
explicit ParameterDescriptionNode (Comment const & iComment) : comment_(iComment.comment()) {}
@@ -219,11 +226,11 @@ namespace edm {
219
226
// The validate function should do one of three things, find that the
220
227
// node "exists", make the node "exist" by inserting missing parameters
221
228
// or throw. The only exception to this rule occurs when the argument
222
- // named "optional " is true , which should only be possible for the
229
+ // named "modifier " is kOptional or kObsolete , which should only be possible for the
223
230
// top level nodes of a ParameterSetDescription. When a parameter is
224
231
// found or inserted its label is added into the list of validatedLabels.
225
- void validate (ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional ) const {
226
- validate_ (pset, validatedLabels, optional );
232
+ void validate (ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier ) const {
233
+ validate_ (pset, validatedLabels, modifier );
227
234
}
228
235
229
236
// As long as it has default values, this will attempt to write
@@ -237,16 +244,16 @@ namespace edm {
237
244
// a valid cfi, in some cases the description can be so pathological
238
245
// that it is impossible to write a cfi that will pass validation.
239
246
void writeCfi (std::ostream& os,
240
- bool optional ,
247
+ Modifier modifier ,
241
248
bool & startWithComma,
242
249
int indentation,
243
250
CfiOptions& options,
244
251
bool & wroteSomething) const {
245
- writeCfi_ (os, optional , startWithComma, indentation, options, wroteSomething);
252
+ writeCfi_ (os, modifier , startWithComma, indentation, options, wroteSomething);
246
253
}
247
254
248
255
// Print out the description in human readable format
249
- void print (std::ostream& os, bool optional , bool writeToCfi, DocFormatHelper& dfh) const ;
256
+ void print (std::ostream& os, Modifier modifier , bool writeToCfi, DocFormatHelper& dfh) const ;
250
257
251
258
bool hasNestedContent () const { return hasNestedContent_ (); }
252
259
@@ -346,16 +353,16 @@ namespace edm {
346
353
std::set<ParameterTypes>& parameterTypes,
347
354
std::set<ParameterTypes>& wildcardTypes) const = 0;
348
355
349
- virtual void validate_ (ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional ) const = 0;
356
+ virtual void validate_ (ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier ) const = 0;
350
357
351
358
virtual void writeCfi_ (std::ostream& os,
352
- bool optional ,
359
+ Modifier modifier ,
353
360
bool & startWithComma,
354
361
int indentation,
355
362
CfiOptions&,
356
363
bool & wroteSomething) const = 0;
357
364
358
- virtual void print_ (std::ostream&, bool /* optional */ , bool /* writeToCfi*/ , DocFormatHelper&) const {}
365
+ virtual void print_ (std::ostream&, Modifier /* modifier */ , bool /* writeToCfi*/ , DocFormatHelper&) const {}
359
366
360
367
virtual bool hasNestedContent_ () const { return false ; }
361
368
0 commit comments