18 <<
"When adding a ParameterSwitch to a ParameterSetDescription the values\n"
19 <<
"associated with the different cases must be unique. Duplicate\n"
20 <<
"values were found for the switch with label: \"" << switchLabel
27 std::set<std::string> & usedLabels,
28 std::set<std::string> &
labels)
const {
30 std::pair<std::set<std::string>::iterator,
bool>
status = labels.insert(switchLabel);
31 if (status.second ==
false) {
33 <<
"The label used for the switch parameter in a ParameterSetDescription\n"
34 <<
"must be different from the labels used in the associated cases. The following\n"
35 <<
"duplicate label was found: \"" << switchLabel <<
"\"\n";
37 usedLabels.insert(labels.begin(), labels.end());
44 std::set<ParameterTypes>
const& caseParameterTypes,
45 std::set<ParameterTypes>
const& caseWildcardTypes,
46 std::set<ParameterTypes> & parameterTypes,
47 std::set<ParameterTypes> & wildcardTypes)
const {
49 if (caseWildcardTypes.find(switchType) != caseWildcardTypes.end()) {
51 <<
"The type used for the switch parameter in a ParameterSetDescription\n"
52 <<
"must be different from the types used for wildcards in the associated cases. The following\n"
55 parameterTypes.insert(switchType);
56 parameterTypes.insert(caseParameterTypes.begin(), caseParameterTypes.end());
57 wildcardTypes.insert(caseWildcardTypes.begin(), caseWildcardTypes.end());
64 <<
"The default value used for the switch parameter in a ParameterSetDescription\n"
65 <<
"must match the value used to select one of the associated cases. This is not\n"
66 <<
"true for the switch named \"" << switchLabel <<
"\"\n";
82 std::string
const& switchLabel,
84 std::string
const& typeString)
const {
86 if (dfh.
pass() == 0) {
96 if (dfh.
pass() == 1) {
102 std::stringstream ss;
103 ss << switchLabel <<
" (switch)";
104 std::ios::fmtflags oldFlags = os.flags();
105 os << std::left << std::setw(dfh.
column1()) << ss.str();
108 os << std::setw(dfh.
column2());
113 std::stringstream ss1;
114 ss1 <<
"untracked " << typeString;
118 os <<
" " << std::setw(dfh.
column3());
119 if (optional) os <<
"optional";
122 if (!writeToCfi) os <<
" (do not write to cfi)";
124 os <<
" see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"\n";
130 os << switchLabel <<
" (switch)\n";
134 if (!isTracked) os <<
"untracked ";
135 os << typeString <<
" ";
137 if (optional) os <<
"optional";
139 if (!writeToCfi) os <<
" (do not write to cfi)";
143 os <<
"see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"\n";
167 std::string
const& switchLabel) {
174 std::stringstream ss;
176 std::string newSection = ss.str();
179 os <<
"Section " << newSection
180 <<
" " << switchLabel <<
" (switch):\n";
184 os <<
"The value of \"" << switchLabel <<
"\" controls which other parameters\n";
186 os <<
"are required or allowed to be in the PSet.\n";
188 if (!dfh.
brief()) os <<
"\n";
203 std::string
const& switchLabel) {
204 if (dfh.
pass() == 0) {
205 p.second->print(os,
false,
true, dfh);
207 if (dfh.
pass() == 1) {
209 os <<
"if " << switchLabel <<
" = ";
210 if (
p.first) os <<
"True";
213 p.second->print(os,
false,
true, dfh);
215 if (dfh.
pass() == 2) {
216 p.second->printNestedContent(os,
false, dfh);
226 std::string
const& switchLabel) {
227 if (dfh.
pass() == 0) {
228 p.second->print(os,
false,
true, dfh);
230 if (dfh.
pass() == 1) {
232 os <<
"if " << switchLabel <<
" = " <<
p.first <<
"\n";
233 p.second->print(os,
false,
true, dfh);
235 if (dfh.
pass() == 2) {
236 p.second->printNestedContent(os,
false, dfh);
246 std::string
const& switchLabel) {
247 if (dfh.
pass() == 0) {
248 p.second->print(os,
false,
true, dfh);
250 if (dfh.
pass() == 1) {
252 os <<
"if " << switchLabel <<
" = \"" <<
p.first <<
"\"\n";
253 p.second->print(os,
false,
true, dfh);
255 if (dfh.
pass() == 2) {
256 p.second->printNestedContent(os,
false, dfh);
269 return exists(pset) ? 1 : 0;
void insertAndCheckTypes(ParameterTypes switchType, std::set< ParameterTypes > const &caseParameterTypes, std::set< ParameterTypes > const &caseWildcardTypes, std::set< ParameterTypes > ¶meterTypes, std::set< ParameterTypes > &wildcardTypes) const
virtual ~ParameterSwitchBase()
void insertAndCheckLabels(std::string const &switchLabel, std::set< std::string > &usedLabels, std::set< std::string > &labels) const
std::string parameterTypeEnumToString(ParameterTypes iType)
static void printCase(std::pair< bool, edm::value_ptr< ParameterDescriptionNode > > const &p, std::ostream &os, bool optional, DocFormatHelper &dfh, std::string const &switchLabel)
void throwDuplicateCaseValues(std::string const &switchLabel) const
std::string const & comment() const
void throwNoCaseForDefault(std::string const &switchLabel) const
virtual bool hasNestedContent_()
static void printSpaces(std::ostream &os, int n)
bool exists(ParameterSet const &pset) const
void printBase(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh, std::string const &switchLabel, bool isTracked, std::string const &typeString) const
void throwNoCaseForSwitchValue(std::string const &message) const
virtual int howManyXORSubNodesExist_(ParameterSet const &pset) const
void printNestedContentBase(std::ostream &os, DocFormatHelper &dfh, DocFormatHelper &new_dfh, std::string const &switchLabel)
virtual bool partiallyExists_(ParameterSet const &pset) const