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
 
std::shared_ptr< ParameterSetDescriptionloadDescription (std::string const &iName) const
 
void loadPlugin (std::string const &iName) const
 

Private Attributes

std::shared_ptr< ParameterSetDescriptioncache_
 
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 97 of file PluginDescription.h.

Constructor & Destructor Documentation

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 103 of file PluginDescription.h.

References eostools::move(), and edm::PluginDescription< T >::typeLabelIsTracked_.

104  : typeLabel_{std::move(typeLabel)}, typeLabelIsTracked_{typeLabelIsTracked} {}
def move(src, dest)
Definition: eostools.py:511
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 111 of file PluginDescription.h.

References edm::PluginDescription< T >::defaultType_, eostools::move(), and edm::PluginDescription< T >::typeLabelIsTracked_.

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

Member Function Documentation

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 120 of file PluginDescription.h.

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

Implements edm::ParameterDescriptionNode.

Definition at line 117 of file PluginDescription.h.

117 { return new PluginDescription<T>(*this); }
template<typename T>
bool edm::PluginDescription< T >::exists_ ( ParameterSet const &  pset) const
inlinefinalprotectedvirtual
template<typename T>
std::string edm::PluginDescription< T >::findType ( edm::ParameterSet const &  iPSet) const
inlineprivate
template<typename T>
bool edm::PluginDescription< T >::hasNestedContent_ ( ) const
inlinefinalprotectedvirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 148 of file PluginDescription.h.

148 { return true; }
template<typename T>
int edm::PluginDescription< T >::howManyXORSubNodesExist_ ( ParameterSet const &  pset) const
inlinefinalprotectedvirtual

Implements edm::ParameterDescriptionNode.

Definition at line 201 of file PluginDescription.h.

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

201 { return exists(pset) ? 1 : 0; }
bool exists(ParameterSet const &pset) const
template<typename T>
std::shared_ptr<ParameterSetDescription> edm::PluginDescription< T >::loadDescription ( std::string const &  iName) const
inlineprivate

Definition at line 224 of file PluginDescription.h.

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

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

224  {
226  std::unique_ptr<CreatedType> a(edmplugin::PluginFactory<CreatedType*()>::get()->create(iName));
227 
228  std::shared_ptr<ParameterSetDescription> desc = std::make_shared<ParameterSetDescription>(a->description());
229 
230  //There is no way to check to see if a node already wants a label
231  if (typeLabelIsTracked_) {
232  if (defaultType_.empty()) {
233  desc->add<std::string>(typeLabel_);
234  } else {
235  desc->add<std::string>(typeLabel_, defaultType_);
236  }
237  } else {
238  if (defaultType_.empty()) {
239  desc->addUntracked<std::string>(typeLabel_);
240  } else {
241  desc->addUntracked<std::string>(typeLabel_, defaultType_);
242  }
243  }
244  return desc;
245  }
def create(alignables, pedeDump, additionalData, outputFile, config)
double a
Definition: hdecay.h:119
template<typename T>
void edm::PluginDescription< T >::loadPlugin ( std::string const &  iName) const
inlineprivate

Definition at line 218 of file PluginDescription.h.

References edm::PluginDescription< T >::cache_, and edm::PluginDescription< T >::loadDescription().

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

218  {
219  if (not cache_) {
220  cache_ = loadDescription(iName);
221  }
222  }
std::shared_ptr< ParameterSetDescription > loadDescription(std::string const &iName) const
std::shared_ptr< ParameterSetDescription > cache_
template<typename T>
bool edm::PluginDescription< T >::partiallyExists_ ( ParameterSet const &  pset) const
inlinefinalprotectedvirtual

Implements edm::ParameterDescriptionNode.

Definition at line 199 of file PluginDescription.h.

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

199 { return exists_(pset); }
bool exists_(ParameterSet const &pset) const final
template<typename T>
void edm::PluginDescription< T >::printNestedContent_ ( std::ostream &  os,
bool  ,
DocFormatHelper dfh 
) const
inlinefinalprotectedvirtual

Reimplemented from edm::ParameterDescriptionNode.

Definition at line 150 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::ParameterDescriptionNode::printSpaces(), edm::DocFormatHelper::setSection(), contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

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

References edm::PluginDescription< T >::cache_, edm::PluginDescription< T >::findType(), edm::PluginDescription< T >::loadPlugin(), dqmiodumpmetadata::n, and muonDTDigis_cfi::pset.

124  {
125  loadPlugin(findType(pset));
126  cache_->validate(pset);
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
void loadPlugin(std::string const &iName) const
std::shared_ptr< ParameterSetDescription > cache_
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 edm::PluginDescription< T >::cache_, edmplugin::standard::config(), edmplugin::PluginManager::configure(), edm::PluginDescription< T >::defaultType_, printContent_cfi::indentation, edmplugin::PluginManager::isAvailable(), and edm::PluginDescription< T >::loadPlugin().

133  {
134  if (not defaultType_.empty()) {
136  auto conf = edmplugin::standard::config();
137  conf.allowNoCache();
139  }
140 
142 
143  cache_->writeCfi(os, startWithComma, indentation);
144  wroteSomething = true;
145  }
146  }
static PluginManager & configure(const Config &)
void loadPlugin(std::string const &iName) const
PluginManager::Config config()
Definition: standard.cc:21
std::shared_ptr< ParameterSetDescription > cache_

Member Data Documentation

template<typename T>
std::shared_ptr<ParameterSetDescription> edm::PluginDescription< T >::cache_
mutableprivate
template<typename T>
std::string edm::PluginDescription< T >::defaultType_
private
template<typename T>
std::string edm::PluginDescription< T >::typeLabel_
private
template<typename T>
bool edm::PluginDescription< T >::typeLabelIsTracked_
private