@@ -70,6 +70,11 @@ namespace edm {
7070
7171 std::string parameterTypeEnumToString (ParameterTypes iType);
7272
73+ enum class ParameterModifier : unsigned char { kNone , kOptional , kObsolete };
74+ inline ParameterModifier modifierIsOptional (bool iOptional) {
75+ return iOptional ? ParameterModifier::kOptional : ParameterModifier::kNone ;
76+ }
77+
7378 namespace cfi {
7479 struct Paths {
7580 // This is the 'path' through the cms.PSet hierarchy.
@@ -204,6 +209,8 @@ namespace edm {
204209
205210 class ParameterDescriptionNode {
206211 public:
212+ using Modifier = ParameterModifier;
213+
207214 ParameterDescriptionNode () {}
208215
209216 explicit ParameterDescriptionNode (Comment const & iComment) : comment_(iComment.comment()) {}
@@ -219,11 +226,11 @@ namespace edm {
219226 // The validate function should do one of three things, find that the
220227 // node "exists", make the node "exist" by inserting missing parameters
221228 // 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
223230 // top level nodes of a ParameterSetDescription. When a parameter is
224231 // 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 );
227234 }
228235
229236 // As long as it has default values, this will attempt to write
@@ -237,16 +244,16 @@ namespace edm {
237244 // a valid cfi, in some cases the description can be so pathological
238245 // that it is impossible to write a cfi that will pass validation.
239246 void writeCfi (std::ostream& os,
240- bool optional ,
247+ Modifier modifier ,
241248 bool & startWithComma,
242249 int indentation,
243250 CfiOptions& options,
244251 bool & wroteSomething) const {
245- writeCfi_ (os, optional , startWithComma, indentation, options, wroteSomething);
252+ writeCfi_ (os, modifier , startWithComma, indentation, options, wroteSomething);
246253 }
247254
248255 // 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 ;
250257
251258 bool hasNestedContent () const { return hasNestedContent_ (); }
252259
@@ -346,16 +353,16 @@ namespace edm {
346353 std::set<ParameterTypes>& parameterTypes,
347354 std::set<ParameterTypes>& wildcardTypes) const = 0;
348355
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;
350357
351358 virtual void writeCfi_ (std::ostream& os,
352- bool optional ,
359+ Modifier modifier ,
353360 bool & startWithComma,
354361 int indentation,
355362 CfiOptions&,
356363 bool & wroteSomething) const = 0;
357364
358- virtual void print_ (std::ostream&, bool /* optional */ , bool /* writeToCfi*/ , DocFormatHelper&) const {}
365+ virtual void print_ (std::ostream&, Modifier /* modifier */ , bool /* writeToCfi*/ , DocFormatHelper&) const {}
359366
360367 virtual bool hasNestedContent_ () const { return false ; }
361368
0 commit comments