19 <<
"When adding a ParameterSwitch to a ParameterSetDescription the values\n" 20 <<
"associated with the different cases must be unique. Duplicate\n" 21 <<
"values were found for the switch with label: \"" << switchLabel
28 std::set<std::string>& usedLabels,
29 std::set<std::string>&
labels)
const {
31 std::pair<std::set<std::string>::iterator,
bool>
status = labels.insert(switchLabel);
32 if(status.second ==
false) {
34 <<
"The label used for the switch parameter in a ParameterSetDescription\n" 35 <<
"must be different from the labels used in the associated cases. The following\n" 36 <<
"duplicate label was found: \"" << switchLabel <<
"\"\n";
38 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";
101 std::stringstream ss;
102 ss << switchLabel <<
" (switch)";
103 std::ios::fmtflags oldFlags = os.flags();
104 os << std::left << std::setw(dfh.
column1()) << ss.str();
107 os << std::setw(dfh.
column2());
111 std::stringstream ss1;
112 ss1 <<
"untracked " << typeString;
116 os <<
" " << std::setw(dfh.
column3());
117 if(optional) os <<
"optional";
120 if(!writeToCfi) os <<
" (do not write to cfi)";
122 os <<
" see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"\n";
127 os << switchLabel <<
" (switch)\n";
131 if(!isTracked) os <<
"untracked ";
132 os << typeString <<
" ";
134 if(optional) os <<
"optional";
136 if(!writeToCfi) os <<
" (do not write to cfi)";
140 os <<
"see Section " << dfh.
section() <<
"." << dfh.
counter() <<
"\n";
171 std::stringstream ss;
176 os <<
"Section " << newSection
177 <<
" " << switchLabel <<
" (switch):\n";
181 os <<
"The value of \"" << switchLabel <<
"\" controls which other parameters\n";
183 os <<
"are required or allowed to be in the PSet.\n";
185 if(!dfh.
brief()) os <<
"\n";
201 if(dfh.
pass() == 0) {
202 p.second->print(os,
false,
true, dfh);
204 if(dfh.
pass() == 1) {
206 os <<
"if " << switchLabel <<
" = ";
207 if(
p.first) os <<
"True";
210 p.second->print(os,
false,
true, dfh);
212 if(dfh.
pass() == 2) {
213 p.second->printNestedContent(os,
false, dfh);
224 if(dfh.
pass() == 0) {
225 p.second->print(os,
false,
true, dfh);
227 if(dfh.
pass() == 1) {
229 os <<
"if " << switchLabel <<
" = " <<
p.first <<
"\n";
230 p.second->print(os,
false,
true, dfh);
232 if(dfh.
pass() == 2) {
233 p.second->printNestedContent(os,
false, dfh);
244 if(dfh.
pass() == 0) {
245 p.second->print(os,
false,
true, dfh);
247 if(dfh.
pass() == 1) {
249 os <<
"if " << switchLabel <<
" = \"" <<
p.first <<
"\"\n";
250 p.second->print(os,
false,
true, dfh);
252 if(dfh.
pass() == 2) {
253 p.second->printNestedContent(os,
false, dfh);
266 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
int howManyXORSubNodesExist_(ParameterSet const &pset) const override
bool partiallyExists_(ParameterSet const &pset) const override
void printNestedContentBase(std::ostream &os, DocFormatHelper &dfh, DocFormatHelper &new_dfh, std::string const &switchLabel) const
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
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
~ParameterSwitchBase() override
bool hasNestedContent_() const override