CMS 3D CMS Logo

AllowedLabelsDescription.cc
Go to the documentation of this file.
1 
5 
6 #include <cassert>
7 
8 namespace edm {
9 
11  : AllowedLabelsDescriptionBase(label, k_PSet, isTracked), psetDesc_() {}
12 
14  : AllowedLabelsDescriptionBase(label, k_PSet, isTracked), psetDesc_() {}
15 
18  bool isTracked)
19  : AllowedLabelsDescriptionBase(label, k_PSet, isTracked), psetDesc_(new ParameterSetDescription(value)) {}
20 
23  bool isTracked)
24  : AllowedLabelsDescriptionBase(label, k_PSet, isTracked), psetDesc_(new ParameterSetDescription(value)) {}
25 
27 
29  return new AllowedLabelsDescription(*this);
30  }
31 
33  bool optional,
34  DocFormatHelper& dfh) const {
35  printNestedContentBase_(os, optional, dfh);
36 
37  int indentation = dfh.indentation();
38  if (dfh.parent() != DocFormatHelper::TOP) {
40  }
41 
42  std::stringstream ss;
43  ss << dfh.section() << "." << dfh.counter() << ".1";
44  std::string newSection = ss.str();
45 
46  if (dfh.brief()) {
48  } else {
49  dfh.indent2(os);
50  }
51  os << "see Section " << newSection << "\n";
52  if (!dfh.brief())
53  os << "\n";
54 
55  printSpaces(os, indentation);
56  os << "Section " << newSection << " PSet description:\n";
57  if (!dfh.brief())
58  os << "\n";
59 
60  DocFormatHelper new_dfh(dfh);
61  new_dfh.setSection(newSection);
64 
65  psetDesc_->print(os, new_dfh);
66  }
67 
69  std::string const& allowedLabel, ParameterSet& pset, std::set<std::string>& validatedLabels) const {
70  if (pset.existsAs<ParameterSet>(allowedLabel, isTracked())) {
71  validatedLabels.insert(allowedLabel);
72  if (psetDesc_) {
73  ParameterSet* containedPSet = pset.getPSetForUpdate(allowedLabel);
74  psetDesc_->validate(*containedPSet);
75  }
76  }
77  }
78 
79  // -----------------------------------------------------------------------
80 
82  bool isTracked)
83  : AllowedLabelsDescriptionBase(label, k_VPSet, isTracked), psetDesc_() {}
84 
86  : AllowedLabelsDescriptionBase(label, k_VPSet, isTracked), psetDesc_() {}
87 
90  bool isTracked)
91  : AllowedLabelsDescriptionBase(label, k_VPSet, isTracked), psetDesc_(new ParameterSetDescription(value)) {}
92 
95  bool isTracked)
96  : AllowedLabelsDescriptionBase(label, k_VPSet, isTracked), psetDesc_(new ParameterSetDescription(value)) {}
97 
99 
101  return new AllowedLabelsDescription(*this);
102  }
103 
105  bool optional,
106  DocFormatHelper& dfh) const {
107  printNestedContentBase_(os, optional, dfh);
108 
109  int indentation = dfh.indentation();
110  if (dfh.parent() != DocFormatHelper::TOP) {
111  indentation -= DocFormatHelper::offsetSectionContent();
112  }
113 
114  std::stringstream ss;
115  ss << dfh.section() << "." << dfh.counter() << ".1";
116  std::string newSection = ss.str();
117 
118  if (dfh.brief()) {
120  } else {
121  dfh.indent2(os);
122  }
123  os << "see Section " << newSection << "\n";
124  if (!dfh.brief())
125  os << "\n";
126 
127  printSpaces(os, indentation);
128  os << "Section " << newSection << " PSet description used to validate all elements of VPSet's:\n";
129  if (!dfh.brief())
130  os << "\n";
131 
132  DocFormatHelper new_dfh(dfh);
133  new_dfh.setSection(newSection);
134  new_dfh.setIndentation(indentation + DocFormatHelper::offsetSectionContent());
136 
137  psetDesc_->print(os, new_dfh);
138  }
139 
141  std::string const& allowedLabel, ParameterSet& pset, std::set<std::string>& validatedLabels) const {
142  if (pset.existsAs<std::vector<ParameterSet> >(allowedLabel, isTracked())) {
143  validatedLabels.insert(allowedLabel);
144 
145  if (psetDesc_) {
146  VParameterSetEntry* vpsetEntry = pset.getPSetVectorForUpdate(allowedLabel);
147  assert(vpsetEntry);
148  for (unsigned i = 0; i < vpsetEntry->size(); ++i) {
149  psetDesc_->validate(vpsetEntry->psetInVector(i));
150  }
151  }
152  }
153  }
154 } // namespace edm
ParameterDescriptionNode * clone() const override
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:161
void printNestedContent_(std::ostream &os, bool optional, DocFormatHelper &dfh) const override
DescriptionParent parent() const
char const * label
int indentation() const
VParameterSetEntry * getPSetVectorForUpdate(std::string const &name)
void validateAllowedLabel_(std::string const &allowedLabel, ParameterSet &pset, std::set< std::string > &validatedLabels) const override
static int offsetSectionContent()
Definition: value.py:1
void indent2(std::ostream &os) const
static void printSpaces(std::ostream &os, int n)
void printNestedContentBase_(std::ostream &os, bool optional, DocFormatHelper &dfh) const
AllowedLabelsDescription(std::string const &label, bool isTracked)
HLT enums.
std::vector< ParameterSet >::size_type size() const
ParameterSet & psetInVector(int i)
void setSection(std::string const &value)
void setParent(DescriptionParent value)
void setIndentation(int value)
ParameterSet * getPSetForUpdate(std::string const &name, bool &isTracked)
std::string const & section() const