CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::PluginDescription< T > Class Template Reference

#include <PluginDescription.h>

Inheritance diagram for edm::PluginDescription< T >:
edm::ParameterDescriptionNode

Public Member Functions

ParameterDescriptionNodeclone () const final
 
 PluginDescription (std::string typeLabel, bool typeLabelIsTracked)
 
 PluginDescription (std::string typeLabel, std::string defaultType, bool typeLabelIsTracked)
 
- 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 ()
 

Protected Member Functions

void checkAndGetLabelsAndTypes_ (std::set< std::string > &usedLabels, std::set< ParameterTypes > &parameterTypes, std::set< ParameterTypes > &wildcardTypes) const final
 
bool exists_ (ParameterSet const &pset) const final
 
bool hasNestedContent_ () const final
 
int howManyXORSubNodesExist_ (ParameterSet const &pset) const final
 
bool partiallyExists_ (ParameterSet const &pset) const final
 
void printNestedContent_ (std::ostream &os, bool, DocFormatHelper &dfh) const final
 
void validate_ (ParameterSet &pset, std::set< std::string > &validatedLabels, bool optional) const final
 
void writeCfi_ (std::ostream &os, bool optional, bool &startWithComma, int indentation, bool &wroteSomething) const final
 
- Protected Member Functions inherited from edm::ParameterDescriptionNode
virtual void print_ (std::ostream &, bool, bool, DocFormatHelper &) const
 

Private Member Functions

std::string findType (edm::ParameterSet const &iPSet) const
 
ParameterSetDescription loadDescription (std::string const &iName) const
 

Private Attributes

std::string defaultType_
 
std::string typeLabel_
 
bool typeLabelIsTracked_
 

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

template<typename T>
class edm::PluginDescription< T >

Definition at line 98 of file PluginDescription.h.

Constructor & Destructor Documentation

◆ PluginDescription() [1/2]

template<typename T>
edm::PluginDescription< T >::PluginDescription ( std::string  typeLabel,
bool  typeLabelIsTracked 
)
inline

Constructor without a default for typeLabel

Parameters
[in]typeLabelthe label for the std::string parameter which holds the plugin type to be loaded
[in]typeLabelIsTracked'true' if the parameter typeLabel is tracked, else should be false

Definition at line 104 of file PluginDescription.h.

References eostools::move().

105  : typeLabel_{std::move(typeLabel)}, typeLabelIsTracked_{typeLabelIsTracked} {}
def move(src, dest)
Definition: eostools.py:511

◆ PluginDescription() [2/2]

template<typename T>
edm::PluginDescription< T >::PluginDescription ( std::string  typeLabel,
std::string  defaultType,
bool  typeLabelIsTracked 
)
inline

Constructor with a default for typeLabel

Parameters
[in]typeLabelthe label for the std::string parameter which holds the plugin type to be loaded
[in]defaultTypethe default plugin type that should be loaded if no type is given
[in]typeLabelIsTracked'true' if the parameter typeLabel is tracked, else should be false

Definition at line 112 of file PluginDescription.h.

References eostools::move().

113  : typeLabel_{std::move(typeLabel)},
114  defaultType_{std::move(defaultType)},
115  typeLabelIsTracked_{typeLabelIsTracked} {}
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

◆ checkAndGetLabelsAndTypes_()

template<typename T>
void edm::PluginDescription< T >::checkAndGetLabelsAndTypes_ ( std::set< std::string > &  usedLabels,
std::set< ParameterTypes > &  parameterTypes,
std::set< ParameterTypes > &  wildcardTypes 
) const
inlinefinalprotectedvirtual

Implements edm::ParameterDescriptionNode.

Definition at line 121 of file PluginDescription.h.

123  {}

◆ clone()

template<typename T>
ParameterDescriptionNode* edm::PluginDescription< T >::clone ( void  ) const
inlinefinalvirtual

Implements edm::ParameterDescriptionNode.

Definition at line 118 of file PluginDescription.h.

118 { return new PluginDescription<T>(*this); }

◆ exists_()

template<typename T>
bool edm::PluginDescription< T >::exists_ ( ParameterSet const &  pset) const
inlinefinalprotectedvirtual

◆ findType()

template<typename T>
std::string edm::PluginDescription< T >::findType ( edm::ParameterSet const &  iPSet) const
inlineprivate

◆ hasNestedContent_()

template<typename T>
bool edm::PluginDescription< T >::hasNestedContent_ ( ) const
inlinefinalprotectedvirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 145 of file PluginDescription.h.

145 { return true; }

◆ howManyXORSubNodesExist_()

template<typename T>
int edm::PluginDescription< T >::howManyXORSubNodesExist_ ( ParameterSet const &  pset) const
inlinefinalprotectedvirtual

Implements edm::ParameterDescriptionNode.

Definition at line 198 of file PluginDescription.h.

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

198 { return exists(pset) ? 1 : 0; }
bool exists(ParameterSet const &pset) const

◆ loadDescription()

template<typename T>
ParameterSetDescription edm::PluginDescription< T >::loadDescription ( std::string const &  iName) const
inlineprivate

Definition at line 215 of file PluginDescription.h.

References a, beamerCreator::create(), edm::PluginDescription< T >::defaultType_, submitPVResolutionJobs::desc, AlCaHLTBitMon_QueryRunRegistry::string, edm::PluginDescription< T >::typeLabel_, and edm::PluginDescription< T >::typeLabelIsTracked_.

Referenced by edm::PluginDescription< T >::printNestedContent_(), edm::PluginDescription< T >::validate_(), and edm::PluginDescription< T >::writeCfi_().

215  {
217  std::unique_ptr<CreatedType> a(edmplugin::PluginFactory<CreatedType*()>::get()->create(iName));
218 
219  ParameterSetDescription desc = a->description();
220 
221  //There is no way to check to see if a node already wants a label
222  if (typeLabelIsTracked_) {
223  if (defaultType_.empty()) {
225  } else {
227  }
228  } else {
229  if (defaultType_.empty()) {
230  desc.addUntracked<std::string>(typeLabel_);
231  } else {
232  desc.addUntracked<std::string>(typeLabel_, defaultType_);
233  }
234  }
235  return desc;
236  }
def create(alignables, pedeDump, additionalData, outputFile, config)
double a
Definition: hdecay.h:119

◆ partiallyExists_()

template<typename T>
bool edm::PluginDescription< T >::partiallyExists_ ( ParameterSet const &  pset) const
inlinefinalprotectedvirtual

Implements edm::ParameterDescriptionNode.

Definition at line 196 of file PluginDescription.h.

References edm::PluginDescription< T >::exists_(), and muonDTDigis_cfi::pset.

196 { return exists_(pset); }
bool exists_(ParameterSet const &pset) const final

◆ printNestedContent_()

template<typename T>
void edm::PluginDescription< T >::printNestedContent_ ( std::ostream &  os,
bool  ,
DocFormatHelper dfh 
) const
inlinefinalprotectedvirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 147 of file PluginDescription.h.

References taus_updatedMVAIds_cff::category, edmplugin::PluginManager::categoryToInfos(), edm::Factory::get(), edmplugin::PluginManager::get(), printContent_cfi::indentation, info(), edm::DocFormatHelper::init(), edm::PluginDescription< T >::loadDescription(), edm::ParameterSetDescription::print(), edm::ParameterDescriptionNode::printSpaces(), edm::DocFormatHelper::setSection(), contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

147  {
148  int indentation = dfh.indentation();
149 
152 
153  {
154  std::stringstream ss;
155  ss << dfh.section() << "." << dfh.counter();
156  std::string newSection = ss.str();
157 
159  os << "Section " << newSection << " " << Factory::get()->category() << " Plugins description:\n";
160  if (!dfh.brief())
161  os << "\n";
162  }
163 
164  //loop over all possible plugins
165  unsigned int pluginCount = 0;
166  std::string previousName;
167  for (auto const& info :
169  // We only want to print the first instance of each plugin name
170  if (previousName == info.name_) {
171  continue;
172  }
173 
174  std::stringstream ss;
175  ss << dfh.section() << "." << dfh.counter();
176  std::string newSection = ss.str();
178  os << "Section " << newSection << "." << ++pluginCount << " " << info.name_ << " Plugin description:\n";
179  if (!dfh.brief())
180  os << "\n";
181 
182  DocFormatHelper new_dfh(dfh);
183  new_dfh.init();
184  new_dfh.setSection(newSection);
185 
186  loadDescription(info.name_).print(os, new_dfh);
187 
188  previousName = info.name_;
189  }
190  }
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:82
static const TGPicture * info(bool iBackgroundIsBlack)
void print(std::ostream &os, DocFormatHelper &dfh) const
static void printSpaces(std::ostream &os, int n)
ParameterSetDescription loadDescription(std::string const &iName) const
static Factory const * get()
Definition: Factory.cc:25
static PluginManager * get()

◆ validate_()

template<typename T>
void edm::PluginDescription< T >::validate_ ( ParameterSet pset,
std::set< std::string > &  validatedLabels,
bool  optional 
) const
inlinefinalprotectedvirtual

Implements edm::ParameterDescriptionNode.

Definition at line 125 of file PluginDescription.h.

References edm::PluginDescription< T >::findType(), edm::PluginDescription< T >::loadDescription(), dqmiodumpmetadata::n, muonDTDigis_cfi::pset, and edm::ParameterSetDescription::validate().

125  {
127  //all names are good
128  auto n = pset.getParameterNames();
129  validatedLabels.insert(n.begin(), n.end());
130  }
std::string findType(edm::ParameterSet const &iPSet) const
ParameterSetDescription loadDescription(std::string const &iName) const
void validate(ParameterSet &pset) const

◆ writeCfi_()

template<typename T>
void edm::PluginDescription< T >::writeCfi_ ( std::ostream &  os,
bool  optional,
bool &  startWithComma,
int  indentation,
bool &  wroteSomething 
) const
inlinefinalprotectedvirtual

Implements edm::ParameterDescriptionNode.

Definition at line 132 of file PluginDescription.h.

References edmplugin::standard::config(), edmplugin::PluginManager::configure(), edm::PluginDescription< T >::defaultType_, printContent_cfi::indentation, edmplugin::PluginManager::isAvailable(), edm::PluginDescription< T >::loadDescription(), and edm::ParameterSetDescription::writeCfi().

133  {
134  if (not defaultType_.empty()) {
136  auto conf = edmplugin::standard::config();
137  conf.allowNoCache();
139  }
140  loadDescription(defaultType_).writeCfi(os, startWithComma, indentation);
141  wroteSomething = true;
142  }
143  }
static PluginManager & configure(const Config &)
void writeCfi(std::ostream &os, bool startWithComma, int indentation) const
PluginManager::Config config()
Definition: standard.cc:21
ParameterSetDescription loadDescription(std::string const &iName) const

Member Data Documentation

◆ defaultType_

template<typename T>
std::string edm::PluginDescription< T >::defaultType_
private

◆ typeLabel_

template<typename T>
std::string edm::PluginDescription< T >::typeLabel_
private

◆ typeLabelIsTracked_

template<typename T>
bool edm::PluginDescription< T >::typeLabelIsTracked_
private