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 
11 
12 #include <vector>
13 
14 namespace edm {
16 
18  return typeLabelList_;
19  }
20 
21  void
22  ProductRegistryHelper::addToRegistry(TypeLabelList::const_iterator const& iBegin,
23  TypeLabelList::const_iterator const& iEnd,
24  ModuleDescription const& iDesc,
25  ProductRegistry& iReg,
26  bool iIsListener) {
27 
28  std::vector<std::string> missingDictionaries;
29  std::vector<std::string> producedTypes;
30 
31  for(TypeLabelList::const_iterator p = iBegin; p != iEnd; ++p) {
32 
33  if (!checkDictionary(missingDictionaries, p->typeID_)) {
34  checkDictionaryOfWrappedType(missingDictionaries, p->typeID_);
35  producedTypes.emplace_back(p->typeID_.className());
36  continue;
37  }
38 
39  TypeWithDict type(p->typeID_.typeInfo());
40  BranchDescription pdesc(p->branchType_,
41  iDesc.moduleLabel(),
42  iDesc.processName(),
43  p->typeID_.userClassName(),
44  p->typeID_.friendlyClassName(),
45  p->productInstanceName_,
46  iDesc.moduleName(),
47  iDesc.parameterSetID(),
48  type);
49 
50  if (pdesc.transient()) {
51  if (!checkDictionary(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
52  // It is should be impossible to get here, because the only way to
53  // make it transient is in the line that causes the wrapped dictionary
54  // to be created. Just to be safe I leave this check here ...
55  producedTypes.emplace_back(pdesc.className());
56  continue;
57  }
58  } else {
59  // also check constituents of wrapped types if it is not transient
60  if (!checkClassDictionaries(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
61  producedTypes.emplace_back(pdesc.className());
62  continue;
63  }
64  }
65  if (!p->branchAlias_.empty()) pdesc.insertBranchAlias(p->branchAlias_);
66  iReg.addProduct(pdesc, iIsListener);
67  }
68 
69  if (!missingDictionaries.empty()) {
70  std::string context("Calling ProductRegistryHelper::addToRegistry, checking dictionaries for produced types");
71  throwMissingDictionariesException(missingDictionaries, context, producedTypes);
72  }
73  }
74 }
type
Definition: HCALResponse.h:21
std::list< TypeLabelItem > TypeLabelList
void throwMissingDictionariesException(std::vector< std::string > &missingDictionaries, std::string const &context)
std::string const & processName() const
std::string const & moduleName() const
std::string const & moduleLabel() const
TypeLabelList & typeLabelList()
used by the fwk to register the list of products of this module
bool checkDictionary(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
bool checkClassDictionaries(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
ParameterSetID const & parameterSetID() const
bool checkDictionaryOfWrappedType(std::vector< std::string > &missingDictionaries, TypeID const &unwrappedTypeID)
static void addToRegistry(TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, bool iIsListener=false)
void addProduct(BranchDescription const &productdesc, bool iFromListener=false)
void insertBranchAlias(std::string const &alias)