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 (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

 AllowedLabelsDescriptionBase (std::string const &label, ParameterTypes iType, bool isTracked)
 
 AllowedLabelsDescriptionBase (char 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 &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

edm::AllowedLabelsDescriptionBase::~AllowedLabelsDescriptionBase ( )
override

Definition at line 13 of file AllowedLabelsDescriptionBase.cc.

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

Definition at line 15 of file AllowedLabelsDescriptionBase.cc.

Referenced by isTracked().

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

Definition at line 20 of file AllowedLabelsDescriptionBase.cc.

Member Function Documentation

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.

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

Referenced by isTracked().

25  {
26  parameterHoldingLabels_.checkAndGetLabelsAndTypes(usedLabels, parameterTypes, wildcardTypes);
27  }
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
void checkAndGetLabelsAndTypes(std::set< std::string > &usedLabels, std::set< ParameterTypes > &parameterTypes, std::set< ParameterTypes > &wildcardTypes) const
bool edm::AllowedLabelsDescriptionBase::exists_ ( ParameterSet const &  pset) const
overrideprivatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 140 of file AllowedLabelsDescriptionBase.cc.

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

Referenced by isTracked().

140  {
142  }
bool exists(ParameterSet const &pset) const
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
bool edm::AllowedLabelsDescriptionBase::hasNestedContent_ ( ) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 97 of file AllowedLabelsDescriptionBase.cc.

Referenced by isTracked().

97 { return true; }
int edm::AllowedLabelsDescriptionBase::howManyXORSubNodesExist_ ( ParameterSet const &  pset) const
overrideprivatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 146 of file AllowedLabelsDescriptionBase.cc.

References edm::ParameterDescriptionNode::exists().

Referenced by isTracked().

146  {
147  return exists(pset) ? 1 : 0;
148  }
bool exists(ParameterSet const &pset) const
bool edm::AllowedLabelsDescriptionBase::isTracked ( ) const
inline

Definition at line 21 of file AllowedLabelsDescriptionBase.h.

References AllowedLabelsDescriptionBase(), checkAndGetLabelsAndTypes_(), exists_(), hasNestedContent_(), howManyXORSubNodesExist_(), isTracked_, label, partiallyExists_(), print_(), printNestedContent_(), printNestedContentBase_(), muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, validate_(), validateAllowedLabel_(), and writeCfi_().

Referenced by Types.PSet::clone(), Mixins._ParameterTypeBase::configTypeName(), Types.int32::insertInto(), Types.uint32::insertInto(), Types.int64::insertInto(), Types.uint64::insertInto(), Types.double::insertInto(), Mixins.UsingBlock::insertInto(), Types.bool::insertInto(), Types.string::insertInto(), Types.EventID::insertInto(), Types.LuminosityBlockID::insertInto(), Types.LuminosityBlockRange::insertInto(), Types.EventRange::insertInto(), Types.InputTag::insertInto(), Types.ESInputTag::insertInto(), Types.FileInPath::insertInto(), Types.PSet::insertInto(), Types.vint32::insertInto(), Types.vuint32::insertInto(), Types.vint64::insertInto(), Types.vuint64::insertInto(), Types.vdouble::insertInto(), Types.vbool::insertInto(), Types.vstring::insertInto(), Types.VLuminosityBlockID::insertInto(), Types.VInputTag::insertInto(), Types.VESInputTag::insertInto(), Types.VEventID::insertInto(), Types.VLuminosityBlockRange::insertInto(), Types.VEventRange::insertInto(), Types.VPSet::insertInto(), printNestedContentBase_(), Mixins._ParameterTypeBase::pythonTypeName(), validate_(), edm::AllowedLabelsDescription< T >::validateAllowedLabel_(), edm::AllowedLabelsDescription< ParameterSetDescription >::validateAllowedLabel_(), and edm::AllowedLabelsDescription< std::vector< ParameterSet > >::validateAllowedLabel_().

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

Implements edm::ParameterDescriptionNode.

Definition at line 144 of file AllowedLabelsDescriptionBase.cc.

References edm::ParameterDescriptionNode::exists().

Referenced by isTracked().

144 { return exists(pset); }
bool exists(ParameterSet const &pset) const
void edm::AllowedLabelsDescriptionBase::print_ ( std::ostream &  os,
bool  optional,
bool  writeToCfi,
DocFormatHelper dfh 
) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 56 of file AllowedLabelsDescriptionBase.cc.

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

Referenced by isTracked().

59  {
60  if (dfh.pass() == 1) {
61  dfh.indent(os);
62  os << parameterHoldingLabels_.label() << " (list of allowed labels)";
63 
64  if (dfh.brief()) {
65  if (optional)
66  os << " optional";
67 
68  if (!writeToCfi)
69  os << " (do not write to cfi)";
70 
71  os << " see Section " << dfh.section() << "." << dfh.counter() << "\n";
72  }
73  // not brief
74  else {
75  os << "\n";
76  dfh.indent2(os);
77 
78  if (optional)
79  os << "optional";
80  if (!writeToCfi)
81  os << " (do not write to cfi)";
82  if (optional || !writeToCfi) {
83  os << "\n";
84  dfh.indent2(os);
85  }
86 
87  os << "see Section " << dfh.section() << "." << dfh.counter() << "\n";
88 
89  if (!comment().empty()) {
90  DocFormatHelper::wrapAndPrintText(os, comment(), dfh.startColumn2(), dfh.commentWidth());
91  }
92  os << "\n";
93  }
94  }
95  }
static void wrapAndPrintText(std::ostream &os, std::string const &text, size_t indent, size_t suggestedWidth)
std::string const & comment() const
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
std::string const & label() const
void edm::AllowedLabelsDescriptionBase::printNestedContent_ ( std::ostream &  os,
bool  optional,
DocFormatHelper dfh 
) const
overrideprivatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 99 of file AllowedLabelsDescriptionBase.cc.

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

Referenced by isTracked().

99  {
100  printNestedContentBase_(os, optional, dfh);
101  if (!dfh.brief())
102  os << "\n";
103  }
void printNestedContentBase_(std::ostream &os, bool optional, DocFormatHelper &dfh) const
void edm::AllowedLabelsDescriptionBase::printNestedContentBase_ ( std::ostream &  os,
bool  optional,
DocFormatHelper dfh 
) const
protected

Definition at line 105 of file AllowedLabelsDescriptionBase.cc.

References edm::DocFormatHelper::brief(), edm::DocFormatHelper::counter(), edm::DocFormatHelper::indent(), edm::DocFormatHelper::indent2(), edm::DocFormatHelper::indentation(), edm::DocFormatHelper::init(), isTracked(), edm::ParameterDescriptionBase::label(), edm::DocFormatHelper::offsetSectionContent(), 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 isTracked(), printNestedContent_(), edm::AllowedLabelsDescription< ParameterSetDescription >::printNestedContent_(), and edm::AllowedLabelsDescription< std::vector< ParameterSet > >::printNestedContent_().

107  {
108  int indentation = dfh.indentation();
109  if (dfh.parent() != DocFormatHelper::TOP) {
110  indentation -= DocFormatHelper::offsetSectionContent();
111  }
112 
113  printSpaces(os, indentation);
114  os << "Section " << dfh.section() << "." << dfh.counter() << " " << parameterHoldingLabels_.label()
115  << " - allowed labels description\n";
116  printSpaces(os, indentation);
117  os << "The following parameter contains a list of parameter labels\n";
118  printSpaces(os, indentation);
119  os << "which are allowed to be in the PSet\n";
120  if (!dfh.brief())
121  os << "\n";
122 
123  DocFormatHelper new_dfh(dfh);
124  new_dfh.init();
125  new_dfh.setPass(1);
126  parameterHoldingLabels_.print(os, optional, true, new_dfh);
127  dfh.indent(os);
128  os << "type of allowed parameters:";
129  if (dfh.brief())
130  os << " ";
131  else {
132  os << "\n";
133  dfh.indent2(os);
134  }
135  if (!isTracked())
136  os << "untracked ";
137  os << parameterTypeEnumToString(type()) << "\n";
138  }
std::string parameterTypeEnumToString(ParameterTypes iType)
void print(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh) const
static int offsetSectionContent()
static void printSpaces(std::ostream &os, int n)
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
std::string const & label() const
ParameterTypes edm::AllowedLabelsDescriptionBase::type ( ) const
inline

Definition at line 20 of file AllowedLabelsDescriptionBase.h.

References type_.

Referenced by printNestedContentBase_().

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.

References edm::ParameterDescriptionNode::exists(), edm::for_all(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isTracked(), edm::ParameterDescriptionBase::label(), parameterHoldingLabels_, edm::ParameterDescriptionNode::validate(), and validateAllowedLabel_().

Referenced by isTracked().

31  {
32  parameterHoldingLabels_.validate(pset, validatedLabels, optional);
33  if (parameterHoldingLabels_.exists(pset)) {
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  }
virtual void validateAllowedLabel_(std::string const &allowedLabel, ParameterSet &pset, std::set< std::string > &validatedLabels) const =0
void validate(ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
Definition: Algorithms.h:14
bool exists(ParameterSet const &pset) const
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
std::string const & label() const
virtual void edm::AllowedLabelsDescriptionBase::validateAllowedLabel_ ( std::string const &  allowedLabel,
ParameterSet pset,
std::set< std::string > &  validatedLabels 
) const
privatepure virtual
void edm::AllowedLabelsDescriptionBase::writeCfi_ ( std::ostream &  os,
bool &  startWithComma,
int  indentation,
bool &  wroteSomething 
) const
overrideprivatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 49 of file AllowedLabelsDescriptionBase.cc.

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

Referenced by isTracked().

52  {
53  parameterHoldingLabels_.writeCfi(os, startWithComma, indentation, wroteSomething);
54  }
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
void writeCfi(std::ostream &os, bool &startWithComma, int indentation, bool &wroteSomething) const

Member Data Documentation

bool edm::AllowedLabelsDescriptionBase::isTracked_
private

Definition at line 57 of file AllowedLabelsDescriptionBase.h.

Referenced by isTracked().

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