test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
edm::ProductRegistryHelper Class Reference

#include <ProductRegistryHelper.h>

Inheritance diagram for edm::ProductRegistryHelper:
edm::InputSource edm::ProducerBase DQMRootSource dqmservices::DQMProtobufReader edm::PoolSource edm::ProducerSourceBase edm::RawInputSource edm::EDFilter edm::EDProducer edm::global::EDFilterBase edm::global::EDProducerBase edm::one::EDFilterBase edm::one::EDProducerBase edm::stream::EDFilterBase edm::stream::EDProducerBase

Classes

struct  TypeLabelItem
 

Public Types

typedef std::list< TypeLabelItemTypeLabelList
 

Public Member Functions

template<class ProductType >
TypeLabelItem const & produces ()
 declare what type of product will make and with which optional label More...
 
template<class ProductType >
TypeLabelItem const & produces (std::string const &instanceName)
 
template<typename ProductType , BranchType B>
TypeLabelItem const & produces ()
 
template<typename ProductType , BranchType B>
TypeLabelItem const & produces (std::string const &instanceName)
 
TypeLabelItem const & produces (const TypeID &id, std::string const &instanceName=std::string())
 
template<BranchType B>
TypeLabelItem const & produces (const TypeID &id, std::string const &instanceName=std::string())
 
 ProductRegistryHelper ()
 
TypeLabelListtypeLabelList ()
 used by the fwk to register the list of products of this module More...
 
 ~ProductRegistryHelper ()
 

Static Public Member Functions

static void addToRegistry (TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, bool iIsListener=false)
 

Private Attributes

TypeLabelList typeLabelList_
 

Detailed Description

Definition at line 18 of file ProductRegistryHelper.h.

Member Typedef Documentation

Definition at line 37 of file ProductRegistryHelper.h.

Constructor & Destructor Documentation

edm::ProductRegistryHelper::ProductRegistryHelper ( )
inline

Definition at line 21 of file ProductRegistryHelper.h.

edm::ProductRegistryHelper::~ProductRegistryHelper ( )

Definition at line 16 of file ProductRegistryHelper.cc.

16 { }

Member Function Documentation

void edm::ProductRegistryHelper::addToRegistry ( TypeLabelList::const_iterator const &  iBegin,
TypeLabelList::const_iterator const &  iEnd,
ModuleDescription const &  iDesc,
ProductRegistry iReg,
bool  iIsListener = false 
)
static

Definition at line 23 of file ProductRegistryHelper.cc.

References edm::ProductRegistry::addProduct(), edm::TypeWithDict::byName(), edm::checkClassDictionaries(), edm::errors::DictionaryNotFound, Exception, edm::hasDictionary(), edm::loadMissingDictionaries(), edm::ModuleDescription::moduleLabel(), edm::ModuleDescription::moduleName(), AlCaHLTBitMon_ParallelJobs::p, edm::ModuleDescription::parameterSetID(), and edm::ModuleDescription::processName().

Referenced by edm::ProducerBase::registerProducts(), and edm::InputSource::registerProducts().

27  {
28  TypeSet missingTypes;
29  for(TypeLabelList::const_iterator p = iBegin; p != iEnd; ++p) {
30  // This should load the dictionary if not already loaded.
31  TClass::GetClass(p->typeID_.typeInfo());
32  if(!hasDictionary(p->typeID_.typeInfo())) {
33  // a second attempt to load
34  TypeWithDict::byName(p->typeID_.userClassName());
35  }
36  if(!hasDictionary(p->typeID_.typeInfo())) {
38  << "No data dictionary found for class:\n\n"
39  << p->typeID_.className()
40  << "\nMost likely the dictionary was never generated,\n"
41  << "but it may be that it was generated in the wrong package.\n"
42  << "Please add (or move) the specification\n"
43  << "<class name=\"whatever\"/>\n"
44  << "to the appropriate classes_def.xml file.\n"
45  << "If the class is a template instance, you may need\n"
46  << "to define a dummy variable of this type in classes.h.\n"
47  << "Also, if this class has any transient members,\n"
48  << "you need to specify them in classes_def.xml.";
49  }
50 
51  TypeWithDict type(p->typeID_.typeInfo());
52  BranchDescription pdesc(p->branchType_,
53  iDesc.moduleLabel(),
54  iDesc.processName(),
55  p->typeID_.userClassName(),
56  p->typeID_.friendlyClassName(),
57  p->productInstanceName_,
58  iDesc.moduleName(),
59  iDesc.parameterSetID(),
60  type);
61  if(pdesc.transient()) {
62  checkClassDictionaries(TypeID(pdesc.wrappedType().typeInfo()), missingTypes, false);
63  } else {
64  checkClassDictionaries(TypeID(pdesc.wrappedType().typeInfo()), missingTypes,true);
65  }
66 
67  if (!p->branchAlias_.empty()) pdesc.insertBranchAlias(p->branchAlias_);
68  iReg.addProduct(pdesc, iIsListener);
69  }//for
70  loadMissingDictionaries(missingTypes);
71  }
type
Definition: HCALResponse.h:21
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:60
std::set< TypeID > TypeSet
void checkClassDictionaries(TypeID const &type, TypeSet &missingTypes, bool recursive=true)
bool hasDictionary(std::type_info const &)
void loadMissingDictionaries(TypeSet missingTypes)
template<class ProductType >
TypeLabelItem const& edm::ProductRegistryHelper::produces ( )
inline

declare what type of product will make and with which optional label

the statement

produces<ProductType>("optlabel");

should be added to the producer ctor for every product

Definition at line 58 of file ProductRegistryHelper.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GoodSeedProducer::GoodSeedProducer(), MuonProducer::MuonProducer(), PFCandidateMixer::PFCandidateMixer(), VariableNTupler::registerleaves(), and StringBasedNTupler::registerleaves().

58  {
59  return produces<ProductType, InEvent>(std::string());
60  }
template<class ProductType >
TypeLabelItem const& edm::ProductRegistryHelper::produces ( std::string const &  instanceName)
inline

Definition at line 63 of file ProductRegistryHelper.h.

63  {
64  return produces<ProductType, InEvent>(instanceName);
65  }
template<typename ProductType , BranchType B>
TypeLabelItem const& edm::ProductRegistryHelper::produces ( )
inline

Definition at line 68 of file ProductRegistryHelper.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

68  {
69  return produces<ProductType, B>(std::string());
70  }
template<typename ProductType , BranchType B>
TypeLabelItem const& edm::ProductRegistryHelper::produces ( std::string const &  instanceName)
inline

Definition at line 73 of file ProductRegistryHelper.h.

73  {
74  TypeID tid(typeid(ProductType));
75  return produces<B>(tid,instanceName);
76  }
TypeLabelItem const& edm::ProductRegistryHelper::produces ( const TypeID id,
std::string const &  instanceName = std::string() 
)
inline

Definition at line 79 of file ProductRegistryHelper.h.

79  {
80  return produces<InEvent>(id,instanceName);
81  }
template<BranchType B>
TypeLabelItem const& edm::ProductRegistryHelper::produces ( const TypeID id,
std::string const &  instanceName = std::string() 
)
inline

Definition at line 84 of file ProductRegistryHelper.h.

References typeLabelList_.

84  {
85  typeLabelList_.emplace_back(B, id, instanceName);
86  return *typeLabelList_.rbegin();
87  }
ProductRegistryHelper::TypeLabelList & edm::ProductRegistryHelper::typeLabelList ( )

used by the fwk to register the list of products of this module

Definition at line 18 of file ProductRegistryHelper.cc.

References typeLabelList_.

Referenced by edm::ProducerBase::registerProducts(), and edm::InputSource::registerProducts().

18  {
19  return typeLabelList_;
20  }

Member Data Documentation

TypeLabelList edm::ProductRegistryHelper::typeLabelList_
private

Definition at line 89 of file ProductRegistryHelper.h.

Referenced by produces(), and typeLabelList().