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::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
 
virtual ~AllowedLabelsDescriptionBase ()
 
- 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

 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)
 

Private Member Functions

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

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

Definition at line 15 of file AllowedLabelsDescriptionBase.cc.

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

Definition at line 18 of file AllowedLabelsDescriptionBase.cc.

18  :
19  parameterHoldingLabels_(label, std::vector<std::string>(), isTracked),
20  type_(iType),
22  }
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
edm::AllowedLabelsDescriptionBase::AllowedLabelsDescriptionBase ( char const *  label,
ParameterTypes  iType,
bool  isTracked 
)
protected

Definition at line 25 of file AllowedLabelsDescriptionBase.cc.

25  :
26  parameterHoldingLabels_(label, std::vector<std::string>(), isTracked),
27  type_(iType),
29  }
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_

Member Function Documentation

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

Implements edm::ParameterDescriptionNode.

Definition at line 34 of file AllowedLabelsDescriptionBase.cc.

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

36  {
37 
38  parameterHoldingLabels_.checkAndGetLabelsAndTypes(usedLabels, parameterTypes, wildcardTypes);
39  }
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
privatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 173 of file AllowedLabelsDescriptionBase.cc.

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

173  {
174  return parameterHoldingLabels_.exists(pset);
175  }
bool exists(ParameterSet const &pset) const
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
bool edm::AllowedLabelsDescriptionBase::hasNestedContent_ ( )
privatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 121 of file AllowedLabelsDescriptionBase.cc.

121  {
122  return true;
123  }
int edm::AllowedLabelsDescriptionBase::howManyXORSubNodesExist_ ( ParameterSet const &  pset) const
privatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 185 of file AllowedLabelsDescriptionBase.cc.

References edm::ParameterDescriptionNode::exists().

185  {
186  return exists(pset) ? 1 : 0;
187  }
bool exists(ParameterSet const &pset) const
bool edm::AllowedLabelsDescriptionBase::isTracked ( ) const
inline
bool edm::AllowedLabelsDescriptionBase::partiallyExists_ ( ParameterSet const &  pset) const
privatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 179 of file AllowedLabelsDescriptionBase.cc.

References edm::ParameterDescriptionNode::exists().

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

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 75 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().

79  {
80  if (dfh.pass() == 1) {
81 
82  dfh.indent(os);
83  os << parameterHoldingLabels_.label() << " (list of allowed labels)";
84 
85  if (dfh.brief()) {
86 
87  if (optional) os << " optional";
88 
89  if (!writeToCfi) os << " (do not write to cfi)";
90 
91  os << " see Section " << dfh.section() << "." << dfh.counter() << "\n";
92  }
93  // not brief
94  else {
95 
96  os << "\n";
97  dfh.indent2(os);
98 
99  if (optional) os << "optional";
100  if (!writeToCfi) os << " (do not write to cfi)";
101  if (optional || !writeToCfi) {
102  os << "\n";
103  dfh.indent2(os);
104  }
105 
106  os << "see Section " << dfh.section() << "." << dfh.counter() << "\n";
107 
108  if (!comment().empty()) {
110  comment(),
111  dfh.startColumn2(),
112  dfh.commentWidth());
113  }
114  os << "\n";
115  }
116  }
117  }
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 
)
privatevirtual

Reimplemented from edm::ParameterDescriptionNode.

Reimplemented in edm::AllowedLabelsDescription< std::vector< ParameterSet > >, and edm::AllowedLabelsDescription< ParameterSetDescription >.

Definition at line 128 of file AllowedLabelsDescriptionBase.cc.

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

130  {
131  printNestedContentBase_(os, optional, dfh);
132  if (!dfh.brief()) os << "\n";
133  }
void printNestedContentBase_(std::ostream &os, bool optional, DocFormatHelper &dfh)
void edm::AllowedLabelsDescriptionBase::printNestedContentBase_ ( std::ostream &  os,
bool  optional,
DocFormatHelper dfh 
)
protected

Definition at line 137 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 printNestedContent_(), and edm::AllowedLabelsDescription< ParameterSetDescription >::printNestedContent_().

139  {
140 
141  int indentation = dfh.indentation();
142  if (dfh.parent() != DocFormatHelper::TOP) {
143  indentation -= DocFormatHelper::offsetSectionContent();
144  }
145 
146  printSpaces(os, indentation);
147  os << "Section " << dfh.section() << "." << dfh.counter()
148  << " " << parameterHoldingLabels_.label()
149  << " - allowed labels description\n";
150  printSpaces(os, indentation);
151  os << "The following parameter contains a list of parameter labels\n";
152  printSpaces(os, indentation);
153  os << "which are allowed to be in the PSet\n";
154  if (!dfh.brief()) os << "\n";
155 
156  DocFormatHelper new_dfh(dfh);
157  new_dfh.init();
158  new_dfh.setPass(1);
159  parameterHoldingLabels_.print(os, optional, true, new_dfh);
160  dfh.indent(os);
161  os << "type of allowed parameters:";
162  if (dfh.brief()) os << " ";
163  else {
164  os << "\n";
165  dfh.indent2(os);
166  }
167  if (!isTracked()) os << "untracked ";
168  os << parameterTypeEnumToString(type()) << "\n";
169  }
std::string parameterTypeEnumToString(ParameterTypes iType)
static int offsetSectionContent()
static void printSpaces(std::ostream &os, int n)
void print(std::ostream &os, bool optional, bool writeToCfi, DocFormatHelper &dfh)
ParameterDescription< std::vector< std::string > > parameterHoldingLabels_
std::string const & label() const
ParameterTypes edm::AllowedLabelsDescriptionBase::type ( ) const
inline

Definition at line 21 of file AllowedLabelsDescriptionBase.h.

References type_.

Referenced by printNestedContentBase_().

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

Implements edm::ParameterDescriptionNode.

Definition at line 43 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_().

45  {
46 
47  parameterHoldingLabels_.validate(pset, validatedLabels, optional);
48  if (parameterHoldingLabels_.exists(pset)) {
49  std::vector<std::string> allowedLabels;
50  if (isTracked()) {
51  allowedLabels = pset.getParameter<std::vector<std::string> >(parameterHoldingLabels_.label());
52  }
53  else {
54  allowedLabels = pset.getUntrackedParameter<std::vector<std::string> >(parameterHoldingLabels_.label());
55  }
57  boost::cref(this),
58  _1,
59  boost::ref(pset),
60  boost::ref(validatedLabels)));
61  }
62  }
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:16
virtual void validateAllowedLabel_(std::string const &allowedLabel, ParameterSet &pset, std::set< std::string > &validatedLabels) const =0
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
privatevirtual

Implements edm::ParameterDescriptionNode.

Definition at line 66 of file AllowedLabelsDescriptionBase.cc.

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

69  {
70  parameterHoldingLabels_.writeCfi(os, startWithComma, indentation, wroteSomething);
71  }
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 73 of file AllowedLabelsDescriptionBase.h.

Referenced by isTracked().

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