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

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

104  :
105  typeLabel_{std::move(typeLabel)},
106  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 113 of file PluginDescription.h.

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

113  :
114  typeLabel_{std::move(typeLabel)},
115  defaultType_{std::move(defaultType)},
116  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 125 of file PluginDescription.h.

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

Implements edm::ParameterDescriptionNode.

Definition at line 119 of file PluginDescription.h.

119  {
120  return new PluginDescription<T>(*this);
121  }
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 159 of file PluginDescription.h.

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

Implements edm::ParameterDescriptionNode.

Definition at line 220 of file PluginDescription.h.

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

220  {
221  return exists(pset) ? 1 : 0;
222  }
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 247 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_().

247  {
249  std::unique_ptr<CreatedType> a(edmplugin::PluginFactory<CreatedType*()>::get()->create(iName));
250 
251  std::shared_ptr<ParameterSetDescription> desc = std::make_shared<ParameterSetDescription>(a->description());
252 
253  //There is no way to check to see if a node already wants a label
254  if(typeLabelIsTracked_) {
255  if(defaultType_.empty()) {
256  desc->add<std::string>(typeLabel_);
257  } else {
258  desc->add<std::string>(typeLabel_,defaultType_);
259  }
260  } else {
261  if(defaultType_.empty()) {
262  desc->addUntracked<std::string>(typeLabel_);
263  } else {
264  desc->addUntracked<std::string>(typeLabel_,defaultType_);
265  }
266  }
267  return desc;
268  }
def create(alignables, pedeDump, additionalData, outputFile, config)
double a
Definition: hdecay.h:121
template<typename T>
void edm::PluginDescription< T >::loadPlugin ( std::string const &  iName) const
inlineprivate

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

240  {
241  if(not cache_) {
242  cache_ = loadDescription(iName);
243  }
244  }
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 216 of file PluginDescription.h.

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

216  {
217  return exists_(pset);
218  }
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 163 of file PluginDescription.h.

References taus_updatedMVAIds_cff::category, spr::find(), edm::Factory::get(), edmplugin::PluginManager::get(), info(), edm::DocFormatHelper::init(), edm::PluginDescription< T >::loadDescription(), edm::ParameterDescriptionNode::printSpaces(), edm::second(), edm::DocFormatHelper::setSection(), and AlCaHLTBitMon_QueryRunRegistry::string.

165  {
166  int indentation = dfh.indentation();
167 
170 
171  std::stringstream ss;
172  ss << dfh.section() << "." << dfh.counter();
173  std::string newSection = ss.str();
174 
175  printSpaces(os, indentation);
176  os << "Section " << newSection
177  << " " << Factory::get()->category() << " Plugins description:\n";
178  if(!dfh.brief()) os << "\n";
179 
180  DocFormatHelper new_dfh(dfh);
181  new_dfh.init();
182  new_dfh.setSection(newSection);
183 
184  //loop over all possible plugins
185  unsigned int pluginCount = 0;
186  std::string previousName;
187  for(auto const& info: edmplugin::PluginManager::get()->categoryToInfos().find(Factory::get()->category())->second) {
188 
189  // We only want to print the first instance of each plugin name
190  if (previousName == info.name_) {
191  continue;
192  }
193 
194  std::stringstream ss;
195  ss << dfh.section() << "." << dfh.counter();
196  std::string newSection = ss.str();
197  printSpaces(os, indentation);
198  os << "Section " << newSection <<"."<< ++pluginCount
199  << " " << info.name_ << " Plugin description:\n";
200  if(!dfh.brief()) os << "\n";
201 
202  DocFormatHelper new_dfh(dfh);
203  new_dfh.init();
204  new_dfh.setSection(newSection);
205 
206  loadDescription(info.name_)->print(os,new_dfh);
207 
208  previousName = info.name_;
209  }
210  }
static const TGPicture * info(bool iBackgroundIsBlack)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
U second(std::pair< T, U > const &p)
std::shared_ptr< ParameterSetDescription > loadDescription(std::string const &iName) const
static Factory const * get()
Definition: Factory.cc:29
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 133 of file PluginDescription.h.

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

135  {
136  loadPlugin(findType(pset));
137  cache_->validate(pset);
138  //all names are good
139  auto n =pset.getParameterNames();
140  validatedLabels.insert(n.begin(),n.end());
141  }
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 &  startWithComma,
int  indentation,
bool &  wroteSomething 
) const
inlinefinalprotectedvirtual

Implements edm::ParameterDescriptionNode.

Definition at line 143 of file PluginDescription.h.

References edm::PluginDescription< T >::cache_, edmplugin::standard::config(), edmplugin::PluginManager::configure(), edm::PluginDescription< T >::defaultType_, and edm::PluginDescription< T >::loadPlugin().

146  {
147  if(not defaultType_.empty()) {
148  auto conf = edmplugin::standard::config();
149  conf.allowNoCache();
151 
153 
154  cache_->writeCfi(os,startWithComma,indentation);
155  wroteSomething = true;
156  }
157  }
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