CMS 3D CMS Logo

ParameterWildcard.h
Go to the documentation of this file.
1 #ifndef FWCore_ParameterSet_ParameterWildcard_h
2 #define FWCore_ParameterSet_ParameterWildcard_h
3 
9 
10 #include <string>
11 #include <set>
12 #include <iosfwd>
13 #include <vector>
14 
15 namespace edm {
16 
17  class ParameterSet;
18  class VParameterSetEntry;
20  class DocFormatHelper;
21 
22  template <class T>
24  public:
28  }
29 
33  }
34 
35  ~ParameterWildcard() override {}
36 
37  ParameterDescriptionNode* clone() const override { return new ParameterWildcard(*this); }
38 
39  private:
40  void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const override {
41  std::vector<std::string> parameterNames = pset.getParameterNamesForType<T>(isTracked());
42  validateMatchingNames(parameterNames, validatedLabels, optional);
43  }
44 
45  bool exists_(ParameterSet const& pset) const override {
46  if (criteria() == RequireZeroOrMore)
47  return true;
48 
49  std::vector<std::string> parameterNames = pset.getParameterNamesForType<T>(isTracked());
50 
51  if (criteria() == RequireAtLeastOne)
52  return !parameterNames.empty();
53  return parameterNames.size() == 1U;
54  }
55 
56  // In the future may need to add a data member of type T to hold a default value
57  };
58 
59  template <>
61  public:
64 
67  bool isTracked,
68  ParameterSetDescription const& desc);
69  ParameterWildcard(char const* pattern,
71  bool isTracked,
72  ParameterSetDescription const& desc);
73 
74  ~ParameterWildcard() override;
75 
76  ParameterDescriptionNode* clone() const override;
77 
78  private:
79  void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const override;
80 
81  bool hasNestedContent_() const override;
82 
83  void printNestedContent_(std::ostream& os, bool optional, DocFormatHelper& helper) const override;
84 
85  bool exists_(ParameterSet const& pset) const override;
86 
87  void validateDescription(std::string const& parameterName, ParameterSet& pset) const;
88 
90  };
91 
92  template <>
93  class ParameterWildcard<std::vector<ParameterSet> > : public ParameterWildcardBase {
94  public:
97 
100  bool isTracked,
101  ParameterSetDescription const& desc);
102  ParameterWildcard(char const* pattern,
104  bool isTracked,
105  ParameterSetDescription const& desc);
106 
107  ~ParameterWildcard() override;
108 
109  ParameterDescriptionNode* clone() const override;
110 
111  private:
112  void validate_(ParameterSet& pset, std::set<std::string>& validatedLabels, bool optional) const override;
113 
114  bool hasNestedContent_() const override;
115 
116  void printNestedContent_(std::ostream& os, bool optional, DocFormatHelper& dfh) const override;
117 
118  bool exists_(ParameterSet const& pset) const override;
119 
120  void validatePSetVector(std::string const& parameterName, ParameterSet& pset) const;
121 
123  };
124 } // namespace edm
125 #endif
edm::ParameterWildcardBase::throwIfInvalidPattern
void throwIfInvalidPattern(char const *pattern) const
Definition: ParameterWildcardBase.cc:20
ParameterSetDescriptionTraits.h
edm::ParameterWildcard::ParameterWildcard
ParameterWildcard(char const *pattern, WildcardValidationCriteria criteria, bool isTracked)
Definition: ParameterWildcard.h:30
edm::ParameterWildcard
Definition: ParameterWildcard.h:23
edm::ParameterWildcard::exists_
bool exists_(ParameterSet const &pset) const override
Definition: ParameterWildcard.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
Types.optional
optional
Definition: Types.py:167
edm::ParameterWildcardBase
Definition: ParameterWildcardBase.h:19
edm::DocFormatHelper
Definition: DocFormatHelper.h:15
edm::ParameterDescriptionNode::hasNestedContent_
virtual bool hasNestedContent_() const
Definition: ParameterDescriptionNode.h:227
edm::ParameterWildcard< std::vector< ParameterSet > >::psetDesc_
value_ptr< ParameterSetDescription > psetDesc_
Definition: ParameterWildcard.h:122
edm::RequireAtLeastOne
Definition: ParameterWildcardBase.h:17
edm::WildcardValidationCriteria
WildcardValidationCriteria
Definition: ParameterWildcardBase.h:17
ParameterDescriptionNode.h
edm::ParameterWildcardBase::isTracked
bool isTracked() const
Definition: ParameterWildcardBase.h:24
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::ParameterWildcard::clone
ParameterDescriptionNode * clone() const override
Definition: ParameterWildcard.h:37
value_ptr.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterWildcard::validate_
void validate_(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override
Definition: ParameterWildcard.h:40
edm::ParameterSet
Definition: ParameterSet.h:36
ParameterSet
Definition: Functions.h:16
edm::ParameterDescriptionNode::printNestedContent_
virtual void printNestedContent_(std::ostream &, bool, DocFormatHelper &) const
Definition: ParameterDescriptionNode.h:229
edm::value_ptr
Definition: value_ptr.h:63
helper
Definition: helper.py:1
edm::ParameterWildcard::ParameterWildcard
ParameterWildcard(std::string const &pattern, WildcardValidationCriteria criteria, bool isTracked)
Definition: ParameterWildcard.h:25
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
edm::ParameterWildcardBase::validateMatchingNames
void validateMatchingNames(std::vector< std::string > const &matchingNames, std::set< std::string > &validatedLabels, bool optional) const
Definition: ParameterWildcardBase.cc:36
std
Definition: JetResolutionObject.h:76
T
long double T
Definition: Basic3DVectorLD.h:48
ParameterWildcardBase.h
edm::ParameterWildcard< ParameterSetDescription >::psetDesc_
value_ptr< ParameterSetDescription > psetDesc_
Definition: ParameterWildcard.h:89
ParameterSetDescription
edm::ParameterWildcard::~ParameterWildcard
~ParameterWildcard() override
Definition: ParameterWildcard.h:35
edm::ParameterWildcardBase::criteria
WildcardValidationCriteria criteria() const
Definition: ParameterWildcardBase.h:25
ParameterSet.h
edm::ParameterTypeToEnum
Definition: ParameterDescriptionNode.h:66
edm::ParameterDescriptionNode
Definition: ParameterDescriptionNode.h:82
edm::RequireZeroOrMore
Definition: ParameterWildcardBase.h:17
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27