CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::AllowedLabelsDescriptionBase Class Referenceabstract

#include <AllowedLabelsDescriptionBase.h>

Inheritance diagram for edm::AllowedLabelsDescriptionBase:
edm::ParameterDescriptionNode edm::AllowedLabelsDescription< T > edm::AllowedLabelsDescription< ParameterSetDescription > edm::AllowedLabelsDescription< std::vector< ParameterSet > >

Public Member Functions

bool isTracked () const
 
ParameterTypes type () const
 
 ~AllowedLabelsDescriptionBase () override
 
- 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 () 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 (char const *value)
 
void setComment (std::string 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 ()
 

Protected Member Functions

 AllowedLabelsDescriptionBase (char const *label, ParameterTypes iType, bool isTracked)
 
 AllowedLabelsDescriptionBase (std::string const &label, ParameterTypes iType, bool isTracked)
 
void printNestedContentBase_ (std::ostream &os, bool optional, DocFormatHelper &dfh) const
 

Private Member Functions

void checkAndGetLabelsAndTypes_ (std::set< std::string > &usedLabels, std::set< ParameterTypes > &parameterTypes, std::set< ParameterTypes > &wildcardTypes) const override
 
bool exists_ (ParameterSet const &pset) const override
 
bool hasNestedContent_ () const override
 
int howManyXORSubNodesExist_ (ParameterSet const &pset) const override
 
bool partiallyExists_ (ParameterSet const &pset) const override
 
void print_ (std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) 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
 
virtual void validateAllowedLabel_ (std::string const &allowedLabel, ParameterSet &pset, std::set< std::string > &validatedLabels) const =0
 
void writeCfi_ (std::ostream &os, bool optional, bool &startWithComma, int indentation, bool &wroteSomething) const override
 

Private Attributes

bool isTracked_
 
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
 
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 16 of file AllowedLabelsDescriptionBase.h.

Constructor & Destructor Documentation

◆ ~AllowedLabelsDescriptionBase()

edm::AllowedLabelsDescriptionBase::~AllowedLabelsDescriptionBase ( )
override

Definition at line 13 of file AllowedLabelsDescriptionBase.cc.

13 {}

◆ AllowedLabelsDescriptionBase() [1/2]

edm::AllowedLabelsDescriptionBase::AllowedLabelsDescriptionBase ( std::string const &  label,
ParameterTypes  iType,
bool  isTracked 
)
protected

Definition at line 15 of file AllowedLabelsDescriptionBase.cc.

18  : parameterHoldingLabels_(label, std::vector<std::string>(), isTracked), type_(iType), isTracked_(isTracked) {}

◆ AllowedLabelsDescriptionBase() [2/2]

edm::AllowedLabelsDescriptionBase::AllowedLabelsDescriptionBase ( char const *  label,
ParameterTypes  iType,
bool  isTracked 
)
protected

Definition at line 20 of file AllowedLabelsDescriptionBase.cc.

21  : parameterHoldingLabels_(label, std::vector<std::string>(), isTracked), type_(iType), isTracked_(isTracked) {}

Member Function Documentation

◆ checkAndGetLabelsAndTypes_()

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

Implements edm::ParameterDescriptionNode.

Definition at line 23 of file AllowedLabelsDescriptionBase.cc.

25  {
26  parameterHoldingLabels_.checkAndGetLabelsAndTypes(usedLabels, parameterTypes, wildcardTypes);
27  }

References edm::ParameterDescriptionNode::checkAndGetLabelsAndTypes(), and parameterHoldingLabels_.

◆ exists_()

bool edm::AllowedLabelsDescriptionBase::exists_ ( ParameterSet const &  pset) const
overrideprivatevirtual

◆ hasNestedContent_()

bool edm::AllowedLabelsDescriptionBase::hasNestedContent_ ( ) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 95 of file AllowedLabelsDescriptionBase.cc.

95 { return true; }

◆ howManyXORSubNodesExist_()

int edm::AllowedLabelsDescriptionBase::howManyXORSubNodesExist_ ( ParameterSet const &  pset) const
overrideprivatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 144 of file AllowedLabelsDescriptionBase.cc.

144  {
145  return exists(pset) ? 1 : 0;
146  }

References edm::ParameterDescriptionNode::exists(), and muonDTDigis_cfi::pset.

◆ isTracked()

bool edm::AllowedLabelsDescriptionBase::isTracked ( ) const
inline

◆ partiallyExists_()

bool edm::AllowedLabelsDescriptionBase::partiallyExists_ ( ParameterSet const &  pset) const
overrideprivatevirtual

◆ print_()

void edm::AllowedLabelsDescriptionBase::print_ ( std::ostream &  os,
bool  optional,
bool  writeToCfi,
DocFormatHelper dfh 
) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 54 of file AllowedLabelsDescriptionBase.cc.

57  {
58  if (dfh.pass() == 1) {
59  dfh.indent(os);
60  os << parameterHoldingLabels_.label() << " (list of allowed labels)";
61 
62  if (dfh.brief()) {
63  if (optional)
64  os << " optional";
65 
66  if (!writeToCfi)
67  os << " (do not write to cfi)";
68 
69  os << " see Section " << dfh.section() << "." << dfh.counter() << "\n";
70  }
71  // not brief
72  else {
73  os << "\n";
74  dfh.indent2(os);
75 
76  if (optional)
77  os << "optional";
78  if (!writeToCfi)
79  os << " (do not write to cfi)";
80  if (optional || !writeToCfi) {
81  os << "\n";
82  dfh.indent2(os);
83  }
84 
85  os << "see Section " << dfh.section() << "." << dfh.counter() << "\n";
86 
87  if (!comment().empty()) {
88  DocFormatHelper::wrapAndPrintText(os, comment(), dfh.startColumn2(), dfh.commentWidth());
89  }
90  os << "\n";
91  }
92  }
93  }

References edm::DocFormatHelper::brief(), edm::ParameterDescriptionNode::comment(), edm::DocFormatHelper::commentWidth(), edm::DocFormatHelper::counter(), relativeConstraints::empty, edm::DocFormatHelper::indent(), edm::DocFormatHelper::indent2(), edm::ParameterDescriptionBase::label(), Types::optional, parameterHoldingLabels_, edm::DocFormatHelper::pass(), edm::DocFormatHelper::section(), edm::DocFormatHelper::startColumn2(), and edm::DocFormatHelper::wrapAndPrintText().

◆ printNestedContent_()

void edm::AllowedLabelsDescriptionBase::printNestedContent_ ( std::ostream &  os,
bool  optional,
DocFormatHelper dfh 
) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 97 of file AllowedLabelsDescriptionBase.cc.

97  {
99  if (!dfh.brief())
100  os << "\n";
101  }

References edm::DocFormatHelper::brief(), Types::optional, and printNestedContentBase_().

◆ printNestedContentBase_()

void edm::AllowedLabelsDescriptionBase::printNestedContentBase_ ( std::ostream &  os,
bool  optional,
DocFormatHelper dfh 
) const
protected

Definition at line 103 of file AllowedLabelsDescriptionBase.cc.

105  {
106  int indentation = dfh.indentation();
107  if (dfh.parent() != DocFormatHelper::TOP) {
109  }
110 
112  os << "Section " << dfh.section() << "." << dfh.counter() << " " << parameterHoldingLabels_.label()
113  << " - allowed labels description\n";
115  os << "The following parameter contains a list of parameter labels\n";
117  os << "which are allowed to be in the PSet\n";
118  if (!dfh.brief())
119  os << "\n";
120 
121  DocFormatHelper new_dfh(dfh);
122  new_dfh.init();
123  new_dfh.setPass(1);
124  parameterHoldingLabels_.print(os, optional, true, new_dfh);
125  dfh.indent(os);
126  os << "type of allowed parameters:";
127  if (dfh.brief())
128  os << " ";
129  else {
130  os << "\n";
131  dfh.indent2(os);
132  }
133  if (!isTracked())
134  os << "untracked ";
135  os << parameterTypeEnumToString(type()) << "\n";
136  }

References edm::DocFormatHelper::brief(), edm::DocFormatHelper::counter(), edm::DocFormatHelper::indent(), edm::DocFormatHelper::indent2(), printContent_cfi::indentation, edm::DocFormatHelper::indentation(), edm::DocFormatHelper::init(), isTracked(), edm::ParameterDescriptionBase::label(), edm::DocFormatHelper::offsetSectionContent(), Types::optional, parameterHoldingLabels_, edm::parameterTypeEnumToString(), edm::DocFormatHelper::parent(), edm::ParameterDescriptionNode::print(), edm::ParameterDescriptionNode::printSpaces(), edm::DocFormatHelper::section(), edm::DocFormatHelper::setPass(), edm::DocFormatHelper::TOP, and type().

Referenced by printNestedContent_(), and edm::AllowedLabelsDescription< ParameterSetDescription >::printNestedContent_().

◆ type()

ParameterTypes edm::AllowedLabelsDescriptionBase::type ( ) const
inline

Definition at line 20 of file AllowedLabelsDescriptionBase.h.

20 { return type_; }

References type_.

Referenced by printNestedContentBase_().

◆ validate_()

void edm::AllowedLabelsDescriptionBase::validate_ ( ParameterSet pset,
std::set< std::string > &  validatedLabels,
bool  optional 
) const
overrideprivatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 29 of file AllowedLabelsDescriptionBase.cc.

31  {
32  parameterHoldingLabels_.validate(pset, validatedLabels, optional);
34  std::vector<std::string> allowedLabels;
35  if (isTracked()) {
36  allowedLabels = pset.getParameter<std::vector<std::string> >(parameterHoldingLabels_.label());
37  } else {
38  allowedLabels = pset.getUntrackedParameter<std::vector<std::string> >(parameterHoldingLabels_.label());
39  }
40  for_all(allowedLabels,
42  this,
43  std::placeholders::_1,
44  std::ref(pset),
45  std::ref(validatedLabels)));
46  }
47  }

References edm::ParameterDescriptionNode::exists(), edm::for_all(), isTracked(), edm::ParameterDescriptionBase::label(), Types::optional, parameterHoldingLabels_, muonDTDigis_cfi::pset, edm::ParameterDescriptionNode::validate(), and validateAllowedLabel_().

◆ validateAllowedLabel_()

virtual void edm::AllowedLabelsDescriptionBase::validateAllowedLabel_ ( std::string const &  allowedLabel,
ParameterSet pset,
std::set< std::string > &  validatedLabels 
) const
privatepure virtual

◆ writeCfi_()

void edm::AllowedLabelsDescriptionBase::writeCfi_ ( std::ostream &  os,
bool  optional,
bool &  startWithComma,
int  indentation,
bool &  wroteSomething 
) const
overrideprivatevirtual

Member Data Documentation

◆ isTracked_

bool edm::AllowedLabelsDescriptionBase::isTracked_
private

Definition at line 58 of file AllowedLabelsDescriptionBase.h.

Referenced by isTracked().

◆ parameterHoldingLabels_

ParameterDescription<std::vector<std::string> > edm::AllowedLabelsDescriptionBase::parameterHoldingLabels_
private

◆ type_

ParameterTypes edm::AllowedLabelsDescriptionBase::type_
private
edm::DocFormatHelper::TOP
Definition: DocFormatHelper.h:17
edm::ParameterDescriptionNode::print
void print(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) const
Definition: ParameterDescriptionNode.cc:110
edm::ParameterDescriptionNode::exists
bool exists(ParameterSet const &pset) const
Definition: ParameterDescriptionNode.h:134
edm::ParameterDescriptionBase::label
std::string const & label() const
Definition: ParameterDescriptionBase.h:37
edm::AllowedLabelsDescriptionBase::isTracked_
bool isTracked_
Definition: AllowedLabelsDescriptionBase.h:58
Types.optional
optional
Definition: Types.py:199
edm::ParameterDescriptionNode::validate
void validate(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const
Definition: ParameterDescriptionNode.h:102
edm::parameterTypeEnumToString
std::string parameterTypeEnumToString(ParameterTypes iType)
Definition: ParameterDescriptionNode.cc:64
edm::for_all
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:14
edm::AllowedLabelsDescriptionBase::printNestedContentBase_
void printNestedContentBase_(std::ostream &os, bool optional, DocFormatHelper &dfh) const
Definition: AllowedLabelsDescriptionBase.cc:103
edm::AllowedLabelsDescriptionBase::isTracked
bool isTracked() const
Definition: AllowedLabelsDescriptionBase.h:21
edm::AllowedLabelsDescriptionBase::validateAllowedLabel_
virtual void validateAllowedLabel_(std::string const &allowedLabel, ParameterSet &pset, std::set< std::string > &validatedLabels) const =0
edm::DocFormatHelper::wrapAndPrintText
static void wrapAndPrintText(std::ostream &os, std::string const &text, size_t indent, size_t suggestedWidth)
Definition: DocFormatHelper.cc:97
edm::AllowedLabelsDescriptionBase::type
ParameterTypes type() const
Definition: AllowedLabelsDescriptionBase.h:20
edm::ParameterDescriptionNode::checkAndGetLabelsAndTypes
void checkAndGetLabelsAndTypes(std::set< std::string > &usedLabels, std::set< ParameterTypes > &parameterTypes, std::set< ParameterTypes > &wildcardTypes) const
Definition: ParameterDescriptionNode.h:207
edm::AllowedLabelsDescriptionBase::type_
ParameterTypes type_
Definition: AllowedLabelsDescriptionBase.h:57
edm::AllowedLabelsDescriptionBase::parameterHoldingLabels_
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
Definition: AllowedLabelsDescriptionBase.h:56
edm::ParameterDescriptionNode::printSpaces
static void printSpaces(std::ostream &os, int n)
Definition: ParameterDescriptionNode.cc:124
edm::DocFormatHelper::offsetSectionContent
static int offsetSectionContent()
Definition: DocFormatHelper.h:83
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
printContent_cfi.indentation
indentation
Definition: printContent_cfi.py:10
edm::ParameterDescriptionNode::comment
std::string const & comment() const
Definition: ParameterDescriptionNode.h:92
label
const char * label
Definition: PFTauDecayModeTools.cc:11
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::ParameterDescriptionNode::writeCfi
void writeCfi(std::ostream &os, bool optional, bool &startWithComma, int indentation, bool &wroteSomething) const
Definition: ParameterDescriptionNode.h:116