CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

edm::AllowedLabelsDescriptionBase Class Reference

#include <AllowedLabelsDescriptionBase.h>

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

List of all members.

Public Member Functions

bool isTracked () const
ParameterTypes type () const
virtual ~AllowedLabelsDescriptionBase ()

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_

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.

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

Definition at line 18 of file AllowedLabelsDescriptionBase.cc.

                                                                                            :
    parameterHoldingLabels_(label, std::vector<std::string>(), isTracked),
    type_(iType),
    isTracked_(isTracked) {
  }
edm::AllowedLabelsDescriptionBase::AllowedLabelsDescriptionBase ( char const *  label,
ParameterTypes  iType,
bool  isTracked 
) [protected]

Definition at line 25 of file AllowedLabelsDescriptionBase.cc.

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

Member Function Documentation

void edm::AllowedLabelsDescriptionBase::checkAndGetLabelsAndTypes_ ( std::set< std::string > &  usedLabels,
std::set< ParameterTypes > &  parameterTypes,
std::set< ParameterTypes > &  wildcardTypes 
) const [private, virtual]

Implements edm::ParameterDescriptionNode.

Definition at line 34 of file AllowedLabelsDescriptionBase.cc.

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

                                                                           {

    parameterHoldingLabels_.checkAndGetLabelsAndTypes(usedLabels, parameterTypes, wildcardTypes);
  }
bool edm::AllowedLabelsDescriptionBase::exists_ ( ParameterSet const &  pset) const [private, virtual]
bool edm::AllowedLabelsDescriptionBase::hasNestedContent_ ( ) [private, virtual]

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 121 of file AllowedLabelsDescriptionBase.cc.

                      {
    return true;
  }
int edm::AllowedLabelsDescriptionBase::howManyXORSubNodesExist_ ( ParameterSet const &  pset) const [private, virtual]

Implements edm::ParameterDescriptionNode.

Definition at line 185 of file AllowedLabelsDescriptionBase.cc.

References edm::ParameterDescriptionNode::exists().

                                                           {
    return exists(pset) ? 1 : 0;
  }
bool edm::AllowedLabelsDescriptionBase::isTracked ( ) const [inline]
bool edm::AllowedLabelsDescriptionBase::partiallyExists_ ( ParameterSet const &  pset) const [private, virtual]

Implements edm::ParameterDescriptionNode.

Definition at line 179 of file AllowedLabelsDescriptionBase.cc.

References edm::ParameterDescriptionNode::exists().

                                                   {
    return exists(pset);
  }
void edm::AllowedLabelsDescriptionBase::print_ ( std::ostream &  os,
bool  optional,
bool  writeToCfi,
DocFormatHelper dfh 
) [private, virtual]

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

  {
    if (dfh.pass() == 1) {

      dfh.indent(os);
      os << parameterHoldingLabels_.label() << " (list of allowed labels)";

      if (dfh.brief()) {

        if (optional)  os << " optional";

        if (!writeToCfi) os << " (do not write to cfi)";

        os << " see Section " << dfh.section() << "." << dfh.counter() << "\n";
      }
      // not brief
      else {

        os << "\n";
        dfh.indent2(os);

        if (optional)  os << "optional";
        if (!writeToCfi) os << " (do not write to cfi)";
        if (optional || !writeToCfi) {
          os << "\n";
          dfh.indent2(os);
        }

        os << "see Section " << dfh.section() << "." << dfh.counter() << "\n";

        if (!comment().empty()) {
          DocFormatHelper::wrapAndPrintText(os,
                                            comment(),
                                            dfh.startColumn2(),
                                            dfh.commentWidth());
        }
        os << "\n";
      }
    }
  }
void edm::AllowedLabelsDescriptionBase::printNestedContent_ ( std::ostream &  os,
bool  optional,
DocFormatHelper dfh 
) [private, virtual]
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(), pat::TOP, and type().

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

                                                 {

    int indentation = dfh.indentation();
    if (dfh.parent() != DocFormatHelper::TOP) {
      indentation -= DocFormatHelper::offsetSectionContent();
    }

    printSpaces(os, indentation);
    os << "Section " << dfh.section() << "." << dfh.counter()
       << " " << parameterHoldingLabels_.label()
       << " - allowed labels description\n";
    printSpaces(os, indentation);
    os << "The following parameter contains a list of parameter labels\n";
    printSpaces(os, indentation);
    os << "which are allowed to be in the PSet\n";
    if (!dfh.brief()) os << "\n";

    DocFormatHelper new_dfh(dfh);
    new_dfh.init();
    new_dfh.setPass(1);
    parameterHoldingLabels_.print(os, optional, true, new_dfh);
    dfh.indent(os);
    os << "type of allowed parameters:";
    if (dfh.brief()) os << " ";
    else {
      os << "\n";
      dfh.indent2(os);
    } 
    if (!isTracked()) os << "untracked ";
    os << parameterTypeEnumToString(type()) << "\n";
  }
ParameterTypes edm::AllowedLabelsDescriptionBase::type ( ) const [inline]

Definition at line 21 of file AllowedLabelsDescriptionBase.h.

References type_.

Referenced by printNestedContentBase_().

{ return type_; }
void edm::AllowedLabelsDescriptionBase::validate_ ( ParameterSet pset,
std::set< std::string > &  validatedLabels,
bool  optional 
) const [private, virtual]

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_, MultipleCompare::ref, edm::ParameterDescriptionNode::validate(), and validateAllowedLabel_().

                                 {

    parameterHoldingLabels_.validate(pset, validatedLabels, optional);
    if (parameterHoldingLabels_.exists(pset)) {
      std::vector<std::string> allowedLabels;
      if (isTracked()) {
        allowedLabels = pset.getParameter<std::vector<std::string> >(parameterHoldingLabels_.label());
      }
      else {
        allowedLabels = pset.getUntrackedParameter<std::vector<std::string> >(parameterHoldingLabels_.label());
      }
      for_all(allowedLabels, boost::bind(&AllowedLabelsDescriptionBase::validateAllowedLabel_,
                                         boost::cref(this),
                                         _1,
                                         boost::ref(pset),
                                         boost::ref(validatedLabels)));
    }
  }
virtual void edm::AllowedLabelsDescriptionBase::validateAllowedLabel_ ( std::string const &  allowedLabel,
ParameterSet pset,
std::set< std::string > &  validatedLabels 
) const [private, pure virtual]
void edm::AllowedLabelsDescriptionBase::writeCfi_ ( std::ostream &  os,
bool &  startWithComma,
int  indentation,
bool &  wroteSomething 
) const [private, virtual]

Implements edm::ParameterDescriptionNode.

Definition at line 66 of file AllowedLabelsDescriptionBase.cc.

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

                                         {
    parameterHoldingLabels_.writeCfi(os, startWithComma, indentation, wroteSomething);
  }

Member Data Documentation

Definition at line 73 of file AllowedLabelsDescriptionBase.h.

Referenced by isTracked().

Definition at line 72 of file AllowedLabelsDescriptionBase.h.

Referenced by type().