CMS 3D CMS Logo

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(convertToBranchType(p->transition_),
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  true,
50  isEndTransition(p->transition_));
51 
52  if (pdesc.transient()) {
53  if (!checkDictionary(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
54  // It is should be impossible to get here, because the only way to
55  // make it transient is in the line that causes the wrapped dictionary
56  // to be created. Just to be safe I leave this check here ...
57  producedTypes.emplace_back(pdesc.className());
58  continue;
59  }
60  } else {
61  // also check constituents of wrapped types if it is not transient
62  if (!checkClassDictionaries(missingDictionaries, pdesc.wrappedName(), pdesc.wrappedType())) {
63  producedTypes.emplace_back(pdesc.className());
64  continue;
65  }
66  }
67  if (!p->branchAlias_.empty()) pdesc.insertBranchAlias(p->branchAlias_);
68  iReg.addProduct(pdesc, iIsListener);
69  }
70 
71  if (!missingDictionaries.empty()) {
72  std::string context("Calling ProductRegistryHelper::addToRegistry, checking dictionaries for produced types");
73  throwMissingDictionariesException(missingDictionaries, context, producedTypes);
74  }
75  }
76 }
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
constexpr bool isEndTransition(Transition iValue)
Definition: Transition.h:31
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)
HLT enums.
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)
constexpr BranchType convertToBranchType(Transition iValue)
Definition: Transition.h:21
void insertBranchAlias(std::string const &alias)