CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::ParameterWildcardBase Class Reference

#include <ParameterWildcardBase.h>

Inheritance diagram for edm::ParameterWildcardBase:
edm::ParameterDescriptionNode edm::ParameterWildcard< T > edm::ParameterWildcard< ParameterSetDescription > edm::ParameterWildcard< std::vector< ParameterSet > >

Public Member Functions

WildcardValidationCriteria criteria () const
 
bool isTracked () const
 
ParameterTypes type () const
 
virtual ~ParameterWildcardBase ()
 
- Public Member Functions inherited from edm::ParameterDescriptionNode
void checkAndGetLabelsAndTypes (std::set< std::string > &usedLabels, std::set< ParameterTypes > &parameterTypes, std::set< ParameterTypes > &wildcardTypes) const
 
virtual ParameterDescriptionNodeclone () const =0
 
std::string const & comment () const
 
bool exists (ParameterSet const &pset) const
 
bool hasNestedContent ()
 
int howManyXORSubNodesExist (ParameterSet const &pset) const
 
bool partiallyExists (ParameterSet const &pset) const
 
void print (std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh)
 
void printNestedContent (std::ostream &os, bool optional, DocFormatHelper &dfh)
 
void setComment (std::string const &value)
 
void setComment (char const *value)
 
void validate (ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const
 
void writeCfi (std::ostream &os, bool &startWithComma, int indentation, bool &wroteSomething) const
 
virtual ~ParameterDescriptionNode ()
 

Protected Member Functions

 ParameterWildcardBase (ParameterTypes iType, bool isTracked, WildcardValidationCriteria criteria)
 
void throwIfInvalidPattern (char const *pattern) const
 
void throwIfInvalidPattern (std::string const &pattern) const
 
void validateMatchingNames (std::vector< std::string > const &matchingNames, std::set< std::string > &validatedLabels, bool optional) const
 
- Protected Member Functions inherited from edm::ParameterDescriptionNode
virtual bool exists_ (ParameterSet const &pset) const =0
 
virtual bool hasNestedContent_ ()
 
virtual void printNestedContent_ (std::ostream &, bool, DocFormatHelper &)
 
virtual void validate_ (ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const =0
 

Private Member Functions

virtual void checkAndGetLabelsAndTypes_ (std::set< std::string > &usedLabels, std::set< ParameterTypes > &parameterTypes, std::set< ParameterTypes > &wildcardTypes) const
 
virtual int howManyXORSubNodesExist_ (ParameterSet const &pset) const
 
virtual bool partiallyExists_ (ParameterSet const &pset) const
 
virtual void print_ (std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh)
 
virtual void writeCfi_ (std::ostream &os, bool &startWithComma, int indentation, bool &wroteSomething) const
 

Private Attributes

WildcardValidationCriteria criteria_
 
bool isTracked_
 
ParameterTypes type_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::ParameterDescriptionNode
static void printSpaces (std::ostream &os, int n)
 
- Protected Attributes inherited from edm::ParameterDescriptionNode
std::string comment_
 

Detailed Description

Definition at line 24 of file ParameterWildcardBase.h.

Constructor & Destructor Documentation

edm::ParameterWildcardBase::~ParameterWildcardBase ( )
virtual

Definition at line 13 of file ParameterWildcardBase.cc.

13 { }
edm::ParameterWildcardBase::ParameterWildcardBase ( ParameterTypes  iType,
bool  isTracked,
WildcardValidationCriteria  criteria 
)
protected

Definition at line 15 of file ParameterWildcardBase.cc.

18  :type_(iType),
21  }
WildcardValidationCriteria criteria_
WildcardValidationCriteria criteria() const

Member Function Documentation

void edm::ParameterWildcardBase::checkAndGetLabelsAndTypes_ ( std::set< std::string > &  usedLabels,
std::set< ParameterTypes > &  parameterTypes,
std::set< ParameterTypes > &  wildcardTypes 
) const
privatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 69 of file ParameterWildcardBase.cc.

References type().

71  {
72  wildcardTypes.insert(type());
73  }
ParameterTypes type() const
WildcardValidationCriteria edm::ParameterWildcardBase::criteria ( ) const
inline
int edm::ParameterWildcardBase::howManyXORSubNodesExist_ ( ParameterSet const &  pset) const
privatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 183 of file ParameterWildcardBase.cc.

References edm::ParameterDescriptionNode::exists().

183  {
184  return exists(pset) ? 1 : 0;
185  }
bool exists(ParameterSet const &pset) const
bool edm::ParameterWildcardBase::isTracked ( ) const
inline
bool edm::ParameterWildcardBase::partiallyExists_ ( ParameterSet const &  pset) const
privatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 177 of file ParameterWildcardBase.cc.

References edm::ParameterDescriptionNode::exists().

177  {
178  return exists(pset);
179  }
bool exists(ParameterSet const &pset) const
void edm::ParameterWildcardBase::print_ ( std::ostream &  os,
bool  optional,
bool  writeToCfi,
DocFormatHelper dfh 
)
privatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 77 of file ParameterWildcardBase.cc.

References edm::DocFormatHelper::brief(), edm::DocFormatHelper::column1(), edm::DocFormatHelper::column2(), edm::DocFormatHelper::column3(), edm::ParameterDescriptionNode::comment(), edm::DocFormatHelper::commentWidth(), edm::DocFormatHelper::counter(), criteria(), relativeConstraints::empty, edm::ParameterDescriptionNode::hasNestedContent(), edm::DocFormatHelper::indent(), edm::DocFormatHelper::indent2(), isTracked(), edm::parameterTypeEnumToString(), edm::DocFormatHelper::pass(), edm::RequireAtLeastOne, edm::RequireExactlyOne, edm::RequireZeroOrMore, edm::DocFormatHelper::section(), edm::DocFormatHelper::setAtLeast1(), edm::DocFormatHelper::setAtLeast2(), edm::DocFormatHelper::setAtLeast3(), findQualityFiles::size, contentValuesCheck::ss, edm::DocFormatHelper::startColumn2(), type(), and edm::DocFormatHelper::wrapAndPrintText().

80  {
81  if(dfh.pass() == 0) {
82  dfh.setAtLeast1(11U);
83  if(isTracked()) {
84  dfh.setAtLeast2(parameterTypeEnumToString(type()).size());
85  } else {
86  dfh.setAtLeast2(parameterTypeEnumToString(type()).size() + 10U);
87  }
88  dfh.setAtLeast3(8U);
89  } else {
90 
91  if(dfh.brief()) {
92 
93  dfh.indent(os);
94  std::ios::fmtflags oldFlags = os.flags();
95  os << std::left << std::setw(dfh.column1()) << "wildcard: *" << " ";
96 
97  if(isTracked()) {
98  os << std::setw(dfh.column2()) << parameterTypeEnumToString(type());
99  } else {
100  std::stringstream ss;
101  ss << "untracked " << parameterTypeEnumToString(type());
102  os << ss.str();
103  }
104 
105  os << " ";
106  os << std::setw(dfh.column3());
107  if(optional) os << "optional";
108  else os << "";
109 
110  if(criteria() == RequireZeroOrMore) {
111  os << " (require zero or more)";
112  } else if(criteria() == RequireAtLeastOne) {
113  os << " (require at least one)";
114  } else if(criteria() == RequireExactlyOne) {
115  os << " (require exactly one)";
116  }
117  os << "\n";
118  if(hasNestedContent()) {
119  dfh.indent(os);
120  os << " (see Section " << dfh.section()
121  << "." << dfh.counter() << ")\n";
122  }
123  os.flags(oldFlags);
124  } else {
125  // not brief
126 
127  dfh.indent(os);
128  os << "labels must match this wildcard pattern: *\n";
129 
130  dfh.indent2(os);
131  os << "type: ";
132  if(isTracked()) {
134  } else {
135  os << "untracked " << parameterTypeEnumToString(type());
136  }
137 
138  if(optional) os << " optional";
139  os << "\n";
140 
141  dfh.indent2(os);
142  os << "criteria: ";
143  if(criteria() == RequireZeroOrMore) os << "require zero or more";
144  else if(criteria() == RequireAtLeastOne) os << "require at least one";
145  else if(criteria() == RequireExactlyOne) os << "require exactly one";
146  os << "\n";
147 
148  if(hasNestedContent()) {
149  dfh.indent2(os);
150  os << "(see Section " << dfh.section()
151  << "." << dfh.counter() << ")\n";
152  }
153 
154  if(!comment().empty()) {
156  comment(),
157  dfh.startColumn2(),
158  dfh.commentWidth());
159  }
160  os << "\n";
161  }
162  }
163  }
static void wrapAndPrintText(std::ostream &os, std::string const &text, size_t indent, size_t suggestedWidth)
ParameterTypes type() const
std::string parameterTypeEnumToString(ParameterTypes iType)
std::string const & comment() const
WildcardValidationCriteria criteria() const
tuple size
Write out results.
void edm::ParameterWildcardBase::throwIfInvalidPattern ( char const *  pattern) const
protected
void edm::ParameterWildcardBase::throwIfInvalidPattern ( std::string const &  pattern) const
protected

Definition at line 32 of file ParameterWildcardBase.cc.

References edm::errors::Configuration, edm::hlt::Exception, edm::parameterTypeEnumToString(), AlCaHLTBitMon_QueryRunRegistry::string, and type().

32  {
33  if(pattern != std::string("*")) {
35  << "Currently, the only supported wildcard in ParameterSetDescriptions\n"
36  << "is the single character \"*\". The configuration contains a wildcard\n"
37  << "with pattern \"" << pattern << "\" and type \"" << parameterTypeEnumToString(type()) << "\"\n"
38  << "At some future date, globbing or regular expression support may be added\n"
39  << "if there are any requests for it from users.\n";
40  }
41  }
ParameterTypes type() const
list pattern
Definition: chain.py:104
std::string parameterTypeEnumToString(ParameterTypes iType)
ParameterTypes edm::ParameterWildcardBase::type ( ) const
inline
void edm::ParameterWildcardBase::validateMatchingNames ( std::vector< std::string > const &  matchingNames,
std::set< std::string > &  validatedLabels,
bool  optional 
) const
protected

Definition at line 45 of file ParameterWildcardBase.cc.

References edm::errors::Configuration, criteria_, edm::hlt::Exception, edm::parameterTypeEnumToString(), edm::RequireAtLeastOne, edm::RequireExactlyOne, edm::RequireZeroOrMore, and type().

Referenced by edm::ParameterWildcard< T >::validate_(), and edm::ParameterWildcard< ParameterSetDescription >::validate_().

47  {
48  validatedLabels.insert(matchingNames.begin(), matchingNames.end());
49  if(criteria_ == RequireZeroOrMore) return;
50  if(criteria_ == RequireAtLeastOne && matchingNames.size() < 1U && !optional) {
52  << "Parameter wildcard of type \"" << parameterTypeEnumToString(type()) << "\" requires "
53  << "at least one match\n"
54  << "and there are no parameters in the configuration matching\n"
55  << "that type.\n";
56  } else if(criteria_ == RequireExactlyOne) {
57  if((matchingNames.size() < 1U && !optional) ||
58  matchingNames.size() > 1U) {
60  << "Parameter wildcard of type \"" << parameterTypeEnumToString(type()) << "\" requires\n"
61  << "exactly one match and there are " << matchingNames.size() << " matching parameters\n"
62  << "in the configuration.\n";
63  }
64  }
65  }
ParameterTypes type() const
std::string parameterTypeEnumToString(ParameterTypes iType)
WildcardValidationCriteria criteria_
void edm::ParameterWildcardBase::writeCfi_ ( std::ostream &  os,
bool &  startWithComma,
int  indentation,
bool &  wroteSomething 
) const
privatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 167 of file ParameterWildcardBase.cc.

170  {
171  // Until we implement default labels and values there is nothing
172  // to do here.
173  }

Member Data Documentation

WildcardValidationCriteria edm::ParameterWildcardBase::criteria_
private

Definition at line 68 of file ParameterWildcardBase.h.

Referenced by criteria(), and validateMatchingNames().

bool edm::ParameterWildcardBase::isTracked_
private

Definition at line 67 of file ParameterWildcardBase.h.

Referenced by isTracked().

ParameterTypes edm::ParameterWildcardBase::type_
private