CMS 3D CMS Logo

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

#include <ParameterWildcardWithSpecifics.h>

Inheritance diagram for edm::ParameterWildcardWithSpecifics:
edm::ParameterWildcardBase edm::ParameterDescriptionNode

Public Member Functions

ParameterDescriptionNodeclone () const override
 
 ParameterWildcardWithSpecifics (std::string_view, WildcardValidationCriteria criteria, bool isTracked, ParameterSetDescription const &desc, std::map< std::string, ParameterSetDescription > exceptions)
 
- Public Member Functions inherited from edm::ParameterWildcardBase
WildcardValidationCriteria criteria () const
 
bool isTracked () const
 
ParameterTypes type () const
 
 ~ParameterWildcardBase () override
 
- Public Member Functions inherited from edm::ParameterDescriptionNode
void checkAndGetLabelsAndTypes (std::set< std::string > &usedLabels, std::set< ParameterTypes > &parameterTypes, std::set< ParameterTypes > &wildcardTypes) const
 
std::string const & comment () const
 
bool exists (ParameterSet const &pset) const
 
bool hasNestedContent () const
 
int howManyXORSubNodesExist (ParameterSet const &pset) const
 
 ParameterDescriptionNode ()
 
 ParameterDescriptionNode (Comment const &iComment)
 
bool partiallyExists (ParameterSet const &pset) const
 
void print (std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) const
 
void printNestedContent (std::ostream &os, bool optional, DocFormatHelper &dfh) const
 
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 optional, bool &startWithComma, int indentation, bool &wroteSomething) const
 
virtual ~ParameterDescriptionNode ()
 

Private Member Functions

bool exists_ (ParameterSet const &pset) const override
 
bool hasNestedContent_ () const override
 
void printNestedContent_ (std::ostream &os, bool optional, DocFormatHelper &dfh) const override
 
void validate_ (ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const override
 
void validateDescription (std::string const &parameterName, ParameterSet &pset) const
 
void validatePSetVector (std::string const &parameterName, ParameterSet &pset) const
 

Private Attributes

std::map< std::string,
ParameterSetDescription
exceptions_
 
ParameterSetDescription wildcardDesc_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::ParameterDescriptionNode
static void printSpaces (std::ostream &os, int n)
 
- Protected Member Functions inherited from edm::ParameterWildcardBase
 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 Attributes inherited from edm::ParameterDescriptionNode
std::string comment_
 

Detailed Description

Definition at line 15 of file ParameterWildcardWithSpecifics.h.

Constructor & Destructor Documentation

edm::ParameterWildcardWithSpecifics::ParameterWildcardWithSpecifics ( std::string_view  pattern,
WildcardValidationCriteria  criteria,
bool  isTracked,
ParameterSetDescription const &  desc,
std::map< std::string, ParameterSetDescription exceptions 
)

Definition at line 14 of file ParameterWildcardWithSpecifics.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, and edm::ParameterWildcardBase::throwIfInvalidPattern().

Referenced by clone().

22  }
std::map< std::string, ParameterSetDescription > exceptions_
def move
Definition: eostools.py:511
WildcardValidationCriteria criteria() const
void throwIfInvalidPattern(char const *pattern) const
ParameterWildcardBase(ParameterTypes iType, bool isTracked, WildcardValidationCriteria criteria)

Member Function Documentation

ParameterDescriptionNode * edm::ParameterWildcardWithSpecifics::clone ( void  ) const
overridevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 24 of file ParameterWildcardWithSpecifics.cc.

References ParameterWildcardWithSpecifics().

24  {
25  return new ParameterWildcardWithSpecifics(*this);
26  }
ParameterWildcardWithSpecifics(std::string_view, WildcardValidationCriteria criteria, bool isTracked, ParameterSetDescription const &desc, std::map< std::string, ParameterSetDescription > exceptions)
bool edm::ParameterWildcardWithSpecifics::exists_ ( ParameterSet const &  pset) const
overrideprivatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 90 of file ParameterWildcardWithSpecifics.cc.

References edm::ParameterWildcardBase::criteria(), edm::ParameterSet::empty(), edm::ParameterSet::getParameterNamesForType(), edm::ParameterWildcardBase::isTracked(), edm::RequireAtLeastOne, and edm::RequireZeroOrMore.

90  {
91  if (criteria() == RequireZeroOrMore)
92  return true;
93 
94  std::vector<std::string> parameterNames = pset.getParameterNamesForType<ParameterSet>(isTracked());
95 
96  if (criteria() == RequireAtLeastOne)
97  return !parameterNames.empty();
98  return parameterNames.size() == 1U;
99  }
WildcardValidationCriteria criteria() const
bool edm::ParameterWildcardWithSpecifics::hasNestedContent_ ( ) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 61 of file ParameterWildcardWithSpecifics.cc.

61 { return true; }
void edm::ParameterWildcardWithSpecifics::printNestedContent_ ( std::ostream &  os,
bool  optional,
DocFormatHelper dfh 
) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 63 of file ParameterWildcardWithSpecifics.cc.

References edm::DocFormatHelper::brief(), edm::DocFormatHelper::counter(), edm::DocFormatHelper::indentation(), edm::DocFormatHelper::offsetSectionContent(), edm::DocFormatHelper::OTHER, edm::DocFormatHelper::parent(), edm::ParameterSetDescription::print(), edm::ParameterDescriptionNode::printSpaces(), edm::DocFormatHelper::section(), edm::DocFormatHelper::setIndentation(), edm::DocFormatHelper::setParent(), edm::DocFormatHelper::setSection(), contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, edm::DocFormatHelper::TOP, and wildcardDesc_.

65  {
66  int indentation = dfh.indentation();
67  if (dfh.parent() != DocFormatHelper::TOP) {
69  }
70 
71  printSpaces(os, indentation);
72  os << "Section " << dfh.section() << "." << dfh.counter() << " description of PSet matching wildcard:";
73  os << "\n";
74  if (!dfh.brief())
75  os << "\n";
76 
77  std::stringstream ss;
78  ss << dfh.section() << "." << dfh.counter();
79  std::string newSection = ss.str();
80 
81  DocFormatHelper new_dfh(dfh);
82  new_dfh.setSection(newSection);
83  new_dfh.setIndentation(indentation + DocFormatHelper::offsetSectionContent());
84  new_dfh.setParent(DocFormatHelper::OTHER);
85 
86  wildcardDesc_.print(os, new_dfh);
87  //NOTE: need to extend to also include the specific cases.
88  }
void print(std::ostream &os, DocFormatHelper &dfh) const
static int offsetSectionContent()
static void printSpaces(std::ostream &os, int n)
void edm::ParameterWildcardWithSpecifics::validate_ ( ParameterSet pset,
std::set< std::string > &  validatedLabels,
bool  optional 
) const
overrideprivatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 28 of file ParameterWildcardWithSpecifics.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::addUntrackedParameter(), exceptions_, spr::find(), edm::ParameterSet::getParameterNamesForType(), edm::ParameterSet::insert(), edm::ParameterWildcardBase::isTracked(), mergeVDriftHistosByStation::name, findQualityFiles::v, validateDescription(), and edm::ParameterWildcardBase::validateMatchingNames().

30  {
31  std::vector<std::string> parameterNames = pset.getParameterNamesForType<ParameterSet>(isTracked());
32  validateMatchingNames(parameterNames, validatedLabels, optional);
33 
34  for (auto const& name : parameterNames) {
36  }
37  //inject exceptions if not already in the pset
38  for (auto const& v : exceptions_) {
39  if (std::find(parameterNames.begin(), parameterNames.end(), v.first) == parameterNames.end()) {
40  if (isTracked()) {
41  pset.addParameter<edm::ParameterSet>(v.first, edm::ParameterSet());
42  } else {
43  pset.addUntrackedParameter<edm::ParameterSet>(v.first, edm::ParameterSet());
44  }
45  validatedLabels.insert(v.first);
46  validateDescription(v.first, pset);
47  }
48  }
49  }
tuple optional
Definition: Types.py:198
void insert(bool ok_to_replace, char const *, Entry const &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::map< std::string, ParameterSetDescription > exceptions_
void validateDescription(std::string const &parameterName, ParameterSet &pset) const
void validateMatchingNames(std::vector< std::string > const &matchingNames, std::set< std::string > &validatedLabels, bool optional) const
void edm::ParameterWildcardWithSpecifics::validateDescription ( std::string const &  parameterName,
ParameterSet pset 
) const
private

Definition at line 51 of file ParameterWildcardWithSpecifics.cc.

References exceptions_, edm::ParameterSet::getPSetForUpdate(), edm::ParameterSetDescription::validate(), and wildcardDesc_.

Referenced by validate_().

51  {
52  ParameterSet* containedPSet = pset.getPSetForUpdate(parameterName);
53  auto itFound = exceptions_.find(parameterName);
54  if (itFound != exceptions_.end()) {
55  itFound->second.validate(*containedPSet);
56  } else {
57  wildcardDesc_.validate(*containedPSet);
58  }
59  }
void validate(ParameterSet &pset) const
std::map< std::string, ParameterSetDescription > exceptions_
void edm::ParameterWildcardWithSpecifics::validatePSetVector ( std::string const &  parameterName,
ParameterSet pset 
) const
private

Member Data Documentation

std::map<std::string, ParameterSetDescription> edm::ParameterWildcardWithSpecifics::exceptions_
private

Definition at line 39 of file ParameterWildcardWithSpecifics.h.

Referenced by validate_(), and validateDescription().

ParameterSetDescription edm::ParameterWildcardWithSpecifics::wildcardDesc_
private

Definition at line 38 of file ParameterWildcardWithSpecifics.h.

Referenced by printNestedContent_(), and validateDescription().