Skip to content

Can mark Parameters as obsolete in fillDescriptions #47642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions FWCore/ParameterSet/interface/AllowedLabelsDescriptionBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ namespace edm {
std::set<ParameterTypes>& parameterTypes,
std::set<ParameterTypes>& wildcardTypes) const override;

void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const override;
void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier) const override;

void writeCfi_(std::ostream& os,
bool optional,
Modifier modifier,
bool& startWithComma,
int indentation,
CfiOptions&,
bool& wroteSomething) const override;

void print_(std::ostream& os, bool optional, bool writeToCfi, DocFormatHelper& dfh) const override;
void print_(std::ostream& os, Modifier modifier, bool writeToCfi, DocFormatHelper& dfh) const override;

bool hasNestedContent_() const override;

Expand Down
6 changes: 3 additions & 3 deletions FWCore/ParameterSet/interface/EmptyGroupDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ namespace edm {
std::set<ParameterTypes>& parameterTypes,
std::set<ParameterTypes>& wildcardTypes) const override;

void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const override;
void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier) const override;

void writeCfi_(std::ostream& os,
bool optional,
Modifier modifier,
bool& startWithComma,
int indentation,
CfiOptions&,
bool& wroteSomething) const override;

void print_(std::ostream& os, bool optional, bool writeToCfi, DocFormatHelper& dfh) const override;
void print_(std::ostream& os, Modifier modifier, bool writeToCfi, DocFormatHelper& dfh) const override;

bool exists_(ParameterSet const& pset) const override;

Expand Down
6 changes: 3 additions & 3 deletions FWCore/ParameterSet/interface/IfExistsDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ namespace edm {
std::set<ParameterTypes>& parameterTypes,
std::set<ParameterTypes>& wildcardTypes) const override;

void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const override;
void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier) const override;

void writeCfi_(std::ostream& os,
bool optional,
Modifier modifier,
bool& startWithComma,
int indentation,
CfiOptions&,
bool& wroteSomething) const override;

void print_(std::ostream& os, bool optional, bool writeToCfi, DocFormatHelper& dfh) const override;
void print_(std::ostream& os, Modifier modifier, bool writeToCfi, DocFormatHelper& dfh) const override;

bool hasNestedContent_() const override { return true; }

Expand Down
4 changes: 2 additions & 2 deletions FWCore/ParameterSet/interface/ParameterDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ namespace edm {
ParameterDescriptionNode* clone() const override { return new ParameterDescription(*this); }

private:
void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const override;
void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier) const override;

void printDefault_(std::ostream& os, bool writeToCfi, DocFormatHelper& dfh) const override;

Expand Down Expand Up @@ -274,7 +274,7 @@ namespace edm {
void setPartOfDefaultOfVPSet(bool value) { partOfDefaultOfVPSet_ = value; }

private:
void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const override;
void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier) const override;

void printDefault_(std::ostream& os, bool writeToCfi, DocFormatHelper& dfh) const override;

Expand Down
8 changes: 4 additions & 4 deletions FWCore/ParameterSet/interface/ParameterDescriptionBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ namespace edm {
std::set<ParameterTypes>& parameterTypes,
std::set<ParameterTypes>& wildcardTypes) const override;

void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const override;
void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier) const override;

void writeCfi_(std::ostream& os,
bool optional,
Modifier modifier,
bool& startWithComma,
int indentation,
CfiOptions&,
Expand All @@ -75,7 +75,7 @@ namespace edm {
bool& wroteSomething) const;

void writeFullCfi(std::ostream& os,
bool optional,
Modifier modifier,
bool& startWithComma,
int indentation,
CfiOptions&,
Expand All @@ -89,7 +89,7 @@ namespace edm {

virtual void writeDoc_(std::ostream& os, int indentation) const = 0;

void print_(std::ostream& os, bool optional, bool writeToCfi, DocFormatHelper& dfh) const override;
void print_(std::ostream& os, Modifier modifier, bool writeToCfi, DocFormatHelper& dfh) const override;

virtual void printDefault_(std::ostream& os, bool writeToCfi, DocFormatHelper& dfh) const;

Expand Down
25 changes: 16 additions & 9 deletions FWCore/ParameterSet/interface/ParameterDescriptionNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ namespace edm {

std::string parameterTypeEnumToString(ParameterTypes iType);

enum class ParameterModifier : unsigned char { kNone, kOptional, kObsolete };
inline ParameterModifier modifierIsOptional(bool iOptional) {
return iOptional ? ParameterModifier::kOptional : ParameterModifier::kNone;
}

namespace cfi {
struct Paths {
//This is the 'path' through the cms.PSet hierarchy.
Expand Down Expand Up @@ -204,6 +209,8 @@ namespace edm {

class ParameterDescriptionNode {
public:
using Modifier = ParameterModifier;

ParameterDescriptionNode() {}

explicit ParameterDescriptionNode(Comment const& iComment) : comment_(iComment.comment()) {}
Expand All @@ -219,11 +226,11 @@ namespace edm {
// The validate function should do one of three things, find that the
// node "exists", make the node "exist" by inserting missing parameters
// or throw. The only exception to this rule occurs when the argument
// named "optional" is true, which should only be possible for the
// named "modifier" is kOptional or kObsolete, which should only be possible for the
// top level nodes of a ParameterSetDescription. When a parameter is
// found or inserted its label is added into the list of validatedLabels.
void validate(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const {
validate_(pset, validatedLabels, optional);
void validate(ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier) const {
validate_(pset, validatedLabels, modifier);
}

// As long as it has default values, this will attempt to write
Expand All @@ -237,16 +244,16 @@ namespace edm {
// a valid cfi, in some cases the description can be so pathological
// that it is impossible to write a cfi that will pass validation.
void writeCfi(std::ostream& os,
bool optional,
Modifier modifier,
bool& startWithComma,
int indentation,
CfiOptions& options,
bool& wroteSomething) const {
writeCfi_(os, optional, startWithComma, indentation, options, wroteSomething);
writeCfi_(os, modifier, startWithComma, indentation, options, wroteSomething);
}

// Print out the description in human readable format
void print(std::ostream& os, bool optional, bool writeToCfi, DocFormatHelper& dfh) const;
void print(std::ostream& os, Modifier modifier, bool writeToCfi, DocFormatHelper& dfh) const;

bool hasNestedContent() const { return hasNestedContent_(); }

Expand Down Expand Up @@ -346,16 +353,16 @@ namespace edm {
std::set<ParameterTypes>& parameterTypes,
std::set<ParameterTypes>& wildcardTypes) const = 0;

virtual void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const = 0;
virtual void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier) const = 0;

virtual void writeCfi_(std::ostream& os,
bool optional,
Modifier modifier,
bool& startWithComma,
int indentation,
CfiOptions&,
bool& wroteSomething) const = 0;

virtual void print_(std::ostream&, bool /*optional*/, bool /*writeToCfi*/, DocFormatHelper&) const {}
virtual void print_(std::ostream&, Modifier /*modifier*/, bool /*writeToCfi*/, DocFormatHelper&) const {}

virtual bool hasNestedContent_() const { return false; }

Expand Down
Loading