CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ProductRegistryHelper.cc
Go to the documentation of this file.
1 /*----------------------------------------------------------------------
2 
3 ----------------------------------------------------------------------*/
4 
13 #include "TClass.h"
14 
15 namespace edm {
17 
19  return typeLabelList_;
20  }
21 
22  void
23  ProductRegistryHelper::addToRegistry(TypeLabelList::const_iterator const& iBegin,
24  TypeLabelList::const_iterator const& iEnd,
25  ModuleDescription const& iDesc,
26  ProductRegistry& iReg,
27  bool iIsListener) {
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  }
72 }
type
Definition: HCALResponse.h:21
std::list< TypeLabelItem > TypeLabelList
std::string const & processName() const
std::string const & moduleName() const
std::string const & moduleLabel() const
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:60
TypeLabelList & typeLabelList()
used by the fwk to register the list of products of this module
std::set< TypeID > TypeSet
void checkClassDictionaries(TypeID const &type, TypeSet &missingTypes, bool recursive=true)
ParameterSetID const & parameterSetID() const
bool hasDictionary(std::type_info const &)
static void addToRegistry(TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, bool iIsListener=false)
void loadMissingDictionaries(TypeSet missingTypes)
void addProduct(BranchDescription const &productdesc, bool iFromListener=false)