File indexing completed on 2025-03-26 01:51:12
0001
0002 #ifndef FWCore_ParameterSet_ParameterDescriptionBase_h
0003 #define FWCore_ParameterSet_ParameterDescriptionBase_h
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "FWCore/ParameterSet/interface/ParameterDescriptionNode.h"
0023
0024 #include <string>
0025 #include <set>
0026 #include <iosfwd>
0027
0028 namespace edm {
0029
0030 class ParameterSetDescription;
0031 class DocFormatHelper;
0032
0033 class ParameterDescriptionBase : public ParameterDescriptionNode {
0034 public:
0035 ~ParameterDescriptionBase() override;
0036
0037 std::string const& label() const { return label_; }
0038 ParameterTypes type() const { return type_; }
0039 bool isTracked() const { return isTracked_; }
0040 bool hasDefault() const { return hasDefault_; }
0041
0042 virtual ParameterSetDescription const* parameterSetDescription() const { return nullptr; }
0043 virtual ParameterSetDescription* parameterSetDescription() { return nullptr; }
0044
0045 protected:
0046 void throwParameterWrongTrackiness() const;
0047 void throwParameterWrongType() const;
0048 void throwMissingRequiredNoDefault() const;
0049
0050 ParameterDescriptionBase(
0051 std::string const& iLabel, ParameterTypes iType, bool isTracked, bool hasDefault, Comment const& iComment);
0052
0053 ParameterDescriptionBase(
0054 char const* iLabel, ParameterTypes iType, bool isTracked, bool hasDefault, Comment const& iComment);
0055
0056 private:
0057 void checkAndGetLabelsAndTypes_(std::set<std::string>& usedLabels,
0058 std::set<ParameterTypes>& parameterTypes,
0059 std::set<ParameterTypes>& wildcardTypes) const override;
0060
0061 void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, Modifier modifier) const override;
0062
0063 void writeCfi_(std::ostream& os,
0064 Modifier modifier,
0065 bool& startWithComma,
0066 int indentation,
0067 CfiOptions&,
0068 bool& wroteSomething) const override;
0069
0070 void writeLabelValueCfi(std::ostream& os,
0071 bool optional,
0072 bool& startWithComma,
0073 int indentation,
0074 CfiOptions&,
0075 bool& wroteSomething) const;
0076
0077 void writeFullCfi(std::ostream& os,
0078 Modifier modifier,
0079 bool& startWithComma,
0080 int indentation,
0081 CfiOptions&,
0082 bool& wroteSomething) const;
0083
0084 bool partiallyExists_(ParameterSet const& pset) const override;
0085
0086 int howManyXORSubNodesExist_(ParameterSet const& pset) const override;
0087
0088 virtual void writeCfi_(std::ostream& os, int indentation, CfiOptions&) const = 0;
0089
0090 virtual void writeDoc_(std::ostream& os, int indentation) const = 0;
0091
0092 void print_(std::ostream& os, Modifier modifier, bool writeToCfi, DocFormatHelper& dfh) const override;
0093
0094 virtual void printDefault_(std::ostream& os, bool writeToCfi, DocFormatHelper& dfh) const;
0095
0096 void printNestedContent_(std::ostream& os, bool optional, DocFormatHelper& dfh) const override;
0097
0098 using ParameterDescriptionNode::exists_;
0099 virtual bool exists_(ParameterSet const& pset, bool isTracked) const = 0;
0100
0101 virtual void insertDefault_(ParameterSet& pset) const = 0;
0102
0103 std::string label_;
0104 ParameterTypes type_;
0105 bool isTracked_;
0106 bool hasDefault_;
0107 };
0108 }
0109 #endif