CMS 3D CMS Logo

ProductRegistry.cc
Go to the documentation of this file.
1 
11 
13 
20 
21 #include "TDictAttributeMap.h"
22 
23 #include <cassert>
24 #include <iterator>
25 #include <limits>
26 #include <set>
27 #include <sstream>
28 #include <ostream>
29 
30 namespace edm {
31 
32  ProductRegistry::ProductRegistry() : productList_(), transient_() {}
33 
35  : frozen_(false),
36  productProduced_(),
37  anyProductProduced_(false),
38  productLookups_{{std::make_unique<ProductResolverIndexHelper>(),
39  std::make_unique<ProductResolverIndexHelper>(),
40  std::make_unique<ProductResolverIndexHelper>(),
41  std::make_unique<ProductResolverIndexHelper>()}},
42  nextIndexValues_(),
43  branchIDToIndex_() {
44  for (bool& isProduced : productProduced_)
45  isProduced = false;
46  }
47 
49  frozen_ = false;
50  for (bool& isProduced : productProduced_)
51  isProduced = false;
52  anyProductProduced_ = false;
53 
54  // propagate_const<T> has no reset() function
55  for (auto& iterProductLookup : productLookups_) {
56  iterProductLookup = std::make_unique<ProductResolverIndexHelper>();
57  }
58  nextIndexValues_.fill(0);
59 
60  branchIDToIndex_.clear();
61  }
62 
65  freezeIt(toBeFrozen);
66  }
67 
68  void ProductRegistry::addProduct(BranchDescription const& productDesc, bool fromListener) {
69  assert(productDesc.produced());
70  throwIfFrozen();
71  std::pair<ProductList::iterator, bool> ret =
72  productList_.insert(std::make_pair(BranchKey(productDesc), productDesc));
73  if (!ret.second) {
74  auto const& previous = *productList_.find(BranchKey(productDesc));
75  if (previous.second.produced()) {
76  // Duplicate registration in current process
77  throw Exception(errors::LogicError, "Duplicate Product Identifier")
78  << "\nThe Framework requires a unique branch name for each product\n"
79  << "which consists of four parts: a friendly class name, module label,\n"
80  << "product instance name, and process name. A product has been\n"
81  << "registered with a duplicate branch name. The most common way\n"
82  << "to fix this error is to modify the product instance name in\n"
83  << "one of the offending 'produces' function calls. Another fix\n"
84  << "would be to delete one of them if they are for the same product.\n\n"
85  << " friendly class name = " << previous.second.friendlyClassName() << "\n"
86  << " module label = " << previous.second.moduleLabel() << "\n"
87  << " product instance name = " << previous.second.productInstanceName() << "\n"
88  << " process name = " << previous.second.processName() << "\n\n"
89  << "The following additional information is not used as part of\n"
90  << "the unique branch identifier.\n\n"
91  << " branch types = " << previous.second.branchType() << " " << productDesc.branchType() << "\n"
92  << " class name = " << previous.second.fullClassName() << "\n\n"
93  << "Note that if the four parts of the branch name are the same,\n"
94  << "then this error will occur even if the branch types differ!\n\n";
95  } else {
96  // Duplicate registration in previous process
97  throw Exception(errors::Configuration, "Duplicate Process Name.\n")
98  << "The process name " << productDesc.processName() << " was previously used for products in the input.\n"
99  << "This has caused branch name conflicts between input products and new products.\n"
100  << "Please modify the configuration file to use a distinct process name.\n"
101  << "Alternately, drop all input products using that process name and the\n"
102  << "descendants of those products.\n";
103  }
104  }
105  addCalled(productDesc, fromListener);
106  }
107 
109  std::string const& labelAlias,
110  std::string const& instanceAlias) {
111  assert(productDesc.produced());
112  assert(productDesc.branchID().isValid());
113  throwIfFrozen();
114  BranchDescription bd(productDesc, labelAlias, instanceAlias);
115  std::pair<ProductList::iterator, bool> ret = productList_.insert(std::make_pair(BranchKey(bd), bd));
116  assert(ret.second);
117  transient_.aliasToOriginal_.emplace_back(
118  PRODUCT_TYPE, productDesc.unwrappedTypeID(), labelAlias, instanceAlias, productDesc.moduleLabel());
119  addCalled(bd, false);
120  }
121 
123  assert(!productDesc.produced());
124  throwIfFrozen();
125  BranchKey k = BranchKey(productDesc);
126  ProductList::iterator iter = productList_.find(k);
127  if (iter == productList_.end()) {
128  productList_.insert(std::make_pair(k, productDesc));
129  } else {
130  assert(combinable(iter->second, productDesc));
131  iter->second.merge(productDesc);
132  }
133  }
134 
137  for (ProductList::const_iterator it = productList_.begin(), itEnd = productList_.end(); it != itEnd; ++it) {
138  if (it->second.branchType() == brType) {
139  return true;
140  }
141  }
142  return false;
143  }
144 
145  std::shared_ptr<ProductResolverIndexHelper const> ProductRegistry::productLookup(BranchType branchType) const {
146  return get_underlying_safe(transient_.productLookups_[branchType]);
147  }
148 
149  std::shared_ptr<ProductResolverIndexHelper> ProductRegistry::productLookup(BranchType branchType) {
150  return get_underlying_safe(transient_.productLookups_[branchType]);
151  }
152 
153  void ProductRegistry::setFrozen(bool initializeLookupInfo) {
154  if (frozen())
155  return;
156  freezeIt();
157  if (initializeLookupInfo) {
158  initializeLookupTables(nullptr, nullptr, nullptr);
159  }
161  }
162 
163  void ProductRegistry::setFrozen(std::set<TypeID> const& productTypesConsumed,
164  std::set<TypeID> const& elementTypesConsumed,
165  std::string const& processName) {
166  if (frozen())
167  return;
168  freezeIt();
169  initializeLookupTables(&productTypesConsumed, &elementTypesConsumed, &processName);
171  }
172 
174  if (frozen()) {
175  throw cms::Exception("ProductRegistry", "throwIfFrozen")
176  << "cannot modify the ProductRegistry because it is frozen\n";
177  }
178  }
179 
181  if (!frozen()) {
182  throw cms::Exception("ProductRegistry", "throwIfNotFrozen")
183  << "cannot read the ProductRegistry because it is not yet frozen\n";
184  }
185  }
186 
188 
189  std::vector<std::string> ProductRegistry::allBranchNames() const {
190  std::vector<std::string> result;
191  result.reserve(productList().size());
192 
193  for (auto const& product : productList()) {
194  result.push_back(product.second.branchName());
195  }
196  return result;
197  }
198 
199  std::vector<BranchDescription const*> ProductRegistry::allBranchDescriptions() const {
200  std::vector<BranchDescription const*> result;
201  result.reserve(productList().size());
202 
203  for (auto const& product : productList()) {
204  result.push_back(&product.second);
205  }
206  return result;
207  }
208 
210  for (auto const& product : other) {
211  copyProduct(product.second);
212  }
213  }
214 
215  void ProductRegistry::updateFromInput(std::vector<BranchDescription> const& other) {
216  for (BranchDescription const& branchDescription : other) {
217  copyProduct(branchDescription);
218  }
219  }
220 
222  throwIfFrozen();
223  for (auto const& prod : other.productList_) {
224  ProductList::iterator iter = productList_.find(prod.first);
225  if (iter == productList_.end()) {
226  productList_.insert(std::make_pair(prod.first, prod.second));
227  addCalled(prod.second, false);
228  } else {
229  assert(combinable(iter->second, prod.second));
230  iter->second.merge(prod.second);
231  }
232  }
233  }
234 
235  void ProductRegistry::setUnscheduledProducts(std::set<std::string> const& unscheduledLabels) {
236  throwIfFrozen();
237 
238  bool hasAliases = false;
239  std::vector<BranchID> onDemandIDs;
240  for (auto& prod : productList_) {
241  if (prod.second.produced() && prod.second.branchType() == InEvent &&
242  unscheduledLabels.end() != unscheduledLabels.find(prod.second.moduleLabel())) {
243  prod.second.setOnDemand(true);
244  onDemandIDs.push_back(prod.second.branchID());
245  }
246  if (prod.second.produced() && prod.second.isAlias()) {
247  hasAliases = true;
248  }
249  }
250 
251  // Need to loop over EDAliases to set their on-demand flag based on the pointed-to branch
252  if (hasAliases) {
253  std::sort(onDemandIDs.begin(), onDemandIDs.end());
254  for (auto& prod : productList_) {
255  if (prod.second.isAlias()) {
256  if (std::binary_search(onDemandIDs.begin(), onDemandIDs.end(), prod.second.aliasForBranchID())) {
257  prod.second.setOnDemand(true);
258  }
259  }
260  }
261  }
262  }
263 
265  std::string const& fileName,
266  BranchDescription::MatchMode branchesMustMatch) {
267  std::ostringstream differences;
268 
269  ProductRegistry::ProductList::iterator j = productList_.begin();
270  ProductRegistry::ProductList::iterator s = productList_.end();
271  ProductRegistry::ProductList::const_iterator i = other.productList().begin();
272  ProductRegistry::ProductList::const_iterator e = other.productList().end();
273 
274  // Loop over entries in the main product registry.
275  while (j != s || i != e) {
276  if (j != s && j->second.produced()) {
277  // Ignore branches just produced (i.e. not in input file).
278  ++j;
279  } else if (j == s || (i != e && i->first < j->first)) {
280  if (i->second.present()) {
281  differences << "Branch '" << i->second.branchName() << "' is in file '" << fileName << "'\n";
282  differences << " but not in previous files.\n";
283  } else {
284  productList_.insert(*i);
285  transient_.branchIDToIndex_[i->second.branchID()] = getNextIndexValue(i->second.branchType());
286  ++nextIndexValue(i->second.branchType());
287  }
288  ++i;
289  } else if (i == e || (j != s && j->first < i->first)) {
290  if (j->second.present() &&
291  (branchesMustMatch == BranchDescription::Strict || j->second.branchType() == InProcess)) {
292  differences << "Branch '" << j->second.branchName() << "' is in previous files\n";
293  differences << " but not in file '" << fileName << "'.\n";
294  }
295  ++j;
296  } else {
297  std::string difs = match(j->second, i->second, fileName);
298  if (difs.empty()) {
299  j->second.merge(i->second);
300  } else {
301  differences << difs;
302  }
303  ++i;
304  ++j;
305  }
306  }
307  return differences.str();
308  }
309 
310  void ProductRegistry::initializeLookupTables(std::set<TypeID> const* productTypesConsumed,
311  std::set<TypeID> const* elementTypesConsumed,
312  std::string const* processName) {
313  std::map<TypeID, TypeID> containedTypeMap;
314  std::map<TypeID, std::vector<TypeID>> containedTypeToBaseTypesMap;
315 
316  std::vector<std::string> missingDictionaries;
317  std::vector<std::string> branchNamesForMissing;
318  std::vector<std::string> producedTypes;
319 
321 
322  for (auto const& product : productList_) {
323  auto const& desc = product.second;
324 
326 
327  if (desc.produced() && !desc.transient()) {
328  setProductProduced(desc.branchType());
329  }
330 
331  //only do the following if the data is supposed to be available in the event
332  if (desc.present()) {
333  // Check dictionaries (we already checked for the produced ones earlier somewhere else).
334  // We have to have the dictionaries to properly setup the lookup tables for support of
335  // Views. Also we need them to determine which present products are declared to be
336  // consumed in the case where the consumed type is a View<T>.
337  if (!desc.produced()) {
338  if (!checkDictionary(missingDictionaries, desc.className(), desc.unwrappedType())) {
339  checkDictionaryOfWrappedType(missingDictionaries, desc.className());
340  branchNamesForMissing.emplace_back(desc.branchName());
341  producedTypes.emplace_back(desc.className() + std::string(" (read from input)"));
342  continue;
343  }
344  }
345  TypeID typeID(desc.unwrappedType().typeInfo());
346 
347  auto iterContainedType = containedTypeMap.find(typeID);
348  bool alreadySawThisType = (iterContainedType != containedTypeMap.end());
349 
350  if (!desc.produced() && !alreadySawThisType) {
351  if (!checkDictionary(missingDictionaries, desc.wrappedName(), desc.wrappedType())) {
352  branchNamesForMissing.emplace_back(desc.branchName());
353  producedTypes.emplace_back(desc.className() + std::string(" (read from input)"));
354  continue;
355  }
356  }
357 
358  TypeID wrappedTypeID(desc.wrappedType().typeInfo());
359 
360  TypeID containedTypeID;
361  if (alreadySawThisType) {
362  containedTypeID = iterContainedType->second;
363  } else {
364  containedTypeID = productholderindexhelper::getContainedTypeFromWrapper(wrappedTypeID, typeID.className());
365  }
366  bool hasContainedType = (containedTypeID != TypeID(typeid(void)) && containedTypeID != TypeID());
367 
368  std::vector<TypeID>* baseTypesOfContainedType = nullptr;
369 
370  if (!alreadySawThisType) {
371  bool alreadyCheckedConstituents = desc.produced() && !desc.transient();
372  if (!alreadyCheckedConstituents && !desc.transient()) {
373  // This checks dictionaries of the wrapped class and all its constituent classes
374  if (!checkClassDictionaries(missingDictionaries, desc.wrappedName(), desc.wrappedType())) {
375  branchNamesForMissing.emplace_back(desc.branchName());
376  producedTypes.emplace_back(desc.className() + std::string(" (read from input)"));
377  continue;
378  }
379  }
380 
381  if (hasContainedType) {
382  auto iterBaseTypes = containedTypeToBaseTypesMap.find(containedTypeID);
383  if (iterBaseTypes == containedTypeToBaseTypesMap.end()) {
384  std::vector<TypeID> baseTypes;
385  if (!public_base_classes(missingDictionaries, containedTypeID, baseTypes)) {
386  branchNamesForMissing.emplace_back(desc.branchName());
387  if (desc.produced()) {
388  producedTypes.emplace_back(desc.className() + std::string(" (produced in current process)"));
389  } else {
390  producedTypes.emplace_back(desc.className() + std::string(" (read from input)"));
391  }
392  continue;
393  }
394  iterBaseTypes = containedTypeToBaseTypesMap.insert(std::make_pair(containedTypeID, baseTypes)).first;
395  }
396  baseTypesOfContainedType = &iterBaseTypes->second;
397  }
398 
399  // Do this after the dictionary checks of constituents so the list of branch names for missing types
400  // is complete
401  containedTypeMap.emplace(typeID, containedTypeID);
402  } else {
403  if (hasContainedType) {
404  auto iterBaseTypes = containedTypeToBaseTypesMap.find(containedTypeID);
405  if (iterBaseTypes != containedTypeToBaseTypesMap.end()) {
406  baseTypesOfContainedType = &iterBaseTypes->second;
407  }
408  }
409  }
410 
411  if (productTypesConsumed != nullptr && !desc.produced()) {
412  bool mainTypeConsumed = (productTypesConsumed->find(typeID) != productTypesConsumed->end());
413  bool containedTypeConsumed =
414  hasContainedType && (elementTypesConsumed->find(containedTypeID) != elementTypesConsumed->end());
415  if (hasContainedType && !containedTypeConsumed && baseTypesOfContainedType != nullptr) {
416  for (TypeID const& baseType : *baseTypesOfContainedType) {
417  if (elementTypesConsumed->find(TypeID(baseType.typeInfo())) != elementTypesConsumed->end()) {
418  containedTypeConsumed = true;
419  break;
420  }
421  }
422  }
423  if (!containedTypeConsumed) {
424  if (mainTypeConsumed) {
425  // The main type is consumed, but either
426  // there is no contained type, or if there is,
427  // neither it nor any of its base classes are consumed.
428  // Set the contained type, if there is one, to void,
429  if (hasContainedType) {
430  containedTypeID = TypeID(typeid(void));
431  }
432  } else {
433  // The main type is not consumed, and either
434  // there is no contained type, or if there is,
435  // neither it nor any of its base classes are consumed.
436  // Don't insert anything in the lookup tables.
437  continue;
438  }
439  }
440  }
442  ->insert(typeID,
443  desc.moduleLabel().c_str(),
444  desc.productInstanceName().c_str(),
445  desc.processName().c_str(),
446  containedTypeID,
447  baseTypesOfContainedType);
448 
449  transient_.branchIDToIndex_[desc.branchID()] = index;
450  }
451  }
452  if (!missingDictionaries.empty()) {
453  std::string context("Calling ProductRegistry::initializeLookupTables");
454  throwMissingDictionariesException(missingDictionaries, context, producedTypes, branchNamesForMissing);
455  }
456 
457  for (auto& iterProductLookup : transient_.productLookups_) {
458  iterProductLookup->setFrozen();
459  }
460 
461  unsigned int indexIntoNextIndexValue = 0;
462  for (auto const& iterProductLookup : transient_.productLookups_) {
463  transient_.nextIndexValues_[indexIntoNextIndexValue] = iterProductLookup->nextIndexValue();
464  ++indexIntoNextIndexValue;
465  }
466 
467  for (auto const& product : productList_) {
468  auto const& desc = product.second;
469  if (transient_.branchIDToIndex_.find(desc.branchID()) == transient_.branchIDToIndex_.end()) {
470  transient_.branchIDToIndex_[desc.branchID()] = getNextIndexValue(desc.branchType());
471  ++nextIndexValue(desc.branchType());
472  }
473  }
475  productTypesConsumed, elementTypesConsumed, containedTypeMap, containedTypeToBaseTypesMap);
476 
477  addElementTypesForAliases(elementTypesConsumed, containedTypeMap, containedTypeToBaseTypesMap);
478  }
479 
481  std::set<TypeID> const* elementTypesConsumed,
482  std::map<TypeID, TypeID> const& containedTypeMap,
483  std::map<TypeID, std::vector<TypeID>> const& containedTypeToBaseTypesMap) {
484  Transients::AliasToOriginalVector elementAliases;
485  for (auto& item : transient_.aliasToOriginal_) {
486  auto iterContainedType = containedTypeMap.find(std::get<Transients::kType>(item));
487  if (iterContainedType == containedTypeMap.end()) {
489  ex << "containedTypeMap did not contain " << std::get<Transients::kType>(item).className()
490  << " that is used in EDAlias " << std::get<Transients::kModuleLabel>(item)
491  << ".\nThis should not happen, contact framework developers";
492  ex.addContext("Calling ProductRegistry::initializeLookupTables()");
493  throw ex;
494  }
495  auto const& containedTypeID = iterContainedType->second;
496  bool const hasContainedType = (containedTypeID != TypeID(typeid(void)) && containedTypeID != TypeID());
497  if (not hasContainedType) {
498  continue;
499  }
500 
501  if (elementTypesConsumed->find(containedTypeID) != elementTypesConsumed->end()) {
502  elementAliases.emplace_back(ELEMENT_TYPE,
503  containedTypeID,
504  std::get<Transients::kModuleLabel>(item),
505  std::get<Transients::kProductInstanceName>(item),
506  std::get<Transients::kAliasForModuleLabel>(item));
507  }
508 
509  auto iterBaseTypes = containedTypeToBaseTypesMap.find(containedTypeID);
510  if (iterBaseTypes == containedTypeToBaseTypesMap.end()) {
511  continue;
512  }
513  for (TypeID const& baseTypeID : iterBaseTypes->second) {
514  if (elementTypesConsumed->find(baseTypeID) != elementTypesConsumed->end()) {
515  elementAliases.emplace_back(ELEMENT_TYPE,
516  baseTypeID,
517  std::get<Transients::kModuleLabel>(item),
518  std::get<Transients::kProductInstanceName>(item),
519  std::get<Transients::kAliasForModuleLabel>(item));
520  }
521  }
522  }
524  std::make_move_iterator(elementAliases.begin()),
525  std::make_move_iterator(elementAliases.end()));
526  }
527 
529  std::set<TypeID> const* productTypesConsumed,
530  std::set<TypeID> const* elementTypesConsumed,
531  std::map<TypeID, TypeID> const& containedTypeMap,
532  std::map<TypeID, std::vector<TypeID>>& containedTypeToBaseTypesMap) {
533  std::vector<std::string> missingDictionaries;
534  std::set<std::string> consumedTypesWithMissingDictionaries;
535 
536  if (productTypesConsumed) {
537  // Check dictionaries for all classes declared to be consumed
538  for (auto const& consumedTypeID : *productTypesConsumed) {
539  // We use the containedTypeMap to see which types have already
540  // had their dictionaries checked. We do not waste time rechecking
541  // those dictionaries.
542  if (containedTypeMap.find(consumedTypeID) == containedTypeMap.end()) {
543  std::string wrappedName = wrappedClassName(consumedTypeID.className());
544  TypeWithDict wrappedType = TypeWithDict::byName(wrappedName);
545  if (!checkDictionary(missingDictionaries, wrappedName, wrappedType)) {
546  checkDictionary(missingDictionaries, consumedTypeID);
547  consumedTypesWithMissingDictionaries.emplace(consumedTypeID.className());
548  continue;
549  }
550  bool transient = false;
551  TDictAttributeMap* wp = wrappedType.getClass()->GetAttributeMap();
552  if (wp && wp->HasKey("persistent") && !strcmp(wp->GetPropertyAsString("persistent"), "false")) {
553  transient = true;
554  }
555  if (transient) {
556  if (!checkDictionary(missingDictionaries, consumedTypeID)) {
557  consumedTypesWithMissingDictionaries.emplace(consumedTypeID.className());
558  }
559 
561  TypeID(wrappedType.typeInfo()), consumedTypeID.className());
562  bool hasContainedType = (containedTypeID != TypeID(typeid(void)) && containedTypeID != TypeID());
563  if (hasContainedType) {
564  if (containedTypeToBaseTypesMap.find(containedTypeID) == containedTypeToBaseTypesMap.end()) {
565  std::vector<TypeID> bases;
566  // Run this to check for missing dictionaries, bases is not really used
567  if (!public_base_classes(missingDictionaries, containedTypeID, bases)) {
568  consumedTypesWithMissingDictionaries.emplace(consumedTypeID.className());
569  }
570  containedTypeToBaseTypesMap.insert(std::make_pair(containedTypeID, bases));
571  }
572  }
573  } else {
574  if (!checkClassDictionaries(missingDictionaries, wrappedName, wrappedType)) {
575  consumedTypesWithMissingDictionaries.emplace(consumedTypeID.className());
576  }
577  }
578  }
579  }
580  if (!missingDictionaries.empty()) {
582  "Calling ProductRegistry::initializeLookupTables, checking dictionaries for consumed products");
583  throwMissingDictionariesException(missingDictionaries, context, consumedTypesWithMissingDictionaries, false);
584  }
585  }
586 
587  if (elementTypesConsumed) {
588  missingDictionaries.clear();
589  consumedTypesWithMissingDictionaries.clear();
590  for (auto const& consumedTypeID : *elementTypesConsumed) {
591  if (containedTypeToBaseTypesMap.find(consumedTypeID) == containedTypeToBaseTypesMap.end()) {
592  std::vector<TypeID> bases;
593  // Run this to check for missing dictionaries, bases is not really used
594  if (!public_base_classes(missingDictionaries, consumedTypeID, bases)) {
595  consumedTypesWithMissingDictionaries.emplace(consumedTypeID.className());
596  }
597  }
598  }
599  if (!missingDictionaries.empty()) {
601  "Calling ProductRegistry::initializeLookupTables, checking dictionaries for elements of products consumed "
602  "using View");
603  throwMissingDictionariesException(missingDictionaries, context, consumedTypesWithMissingDictionaries, true);
604  }
605  }
606  }
607 
609  std::string const* processName) const {
610  if (processName && !desc.produced() && (*processName == desc.processName())) {
611  throw Exception(errors::Configuration, "Duplicate Process Name.\n")
612  << "The process name " << *processName << " was previously used for products in the input.\n"
613  << "Please modify the configuration file to use a distinct process name.\n"
614  << "Alternately, drop all input products using that process name and the\n"
615  << "descendants of those products.\n";
616  }
617  }
618 
620  std::map<BranchID, ProductResolverIndex>::const_iterator itFind = transient_.branchIDToIndex_.find(iID);
621  if (itFind == transient_.branchIDToIndex_.end()) {
623  }
624  return itFind->second;
625  }
626 
627  std::vector<std::string> ProductRegistry::aliasToModules(KindOfType kindOfType,
628  TypeID const& type,
629  std::string_view moduleLabel,
630  std::string_view productInstanceName) const {
631  auto aliasFields = [](auto const& item) {
632  return std::tie(std::get<Transients::kKind>(item),
633  std::get<Transients::kType>(item),
634  std::get<Transients::kModuleLabel>(item),
635  std::get<Transients::kProductInstanceName>(item));
636  };
637  auto const target = std::tuple(kindOfType, type, moduleLabel, productInstanceName);
638  auto found =
641  target,
642  [aliasFields](auto const& item, auto const& target) { return aliasFields(item) < target; });
643  std::vector<std::string> ret;
644  for (; found != transient_.aliasToOriginal_.end() and aliasFields(*found) == target; ++found) {
645  ret.emplace_back(std::get<Transients::kAliasForModuleLabel>(*found));
646  }
647  return ret;
648  }
649 
650  void ProductRegistry::print(std::ostream& os) const {
651  for (auto const& product : productList_) {
652  os << product.second << "\n-----\n";
653  }
654  }
655 
657  return transient_.nextIndexValues_[branchType];
658  }
659 
661  return transient_.nextIndexValues_[branchType];
662  }
663 } // namespace edm
std::vector< BranchDescription const * > allBranchDescriptions() const
void setProductProduced(BranchType branchType)
void throwMissingDictionariesException(std::vector< std::string > &missingDictionaries, std::string const &context)
unsigned int ProductResolverIndex
bool public_base_classes(std::vector< std::string > &missingDictionaries, TypeID const &typeID, std::vector< TypeID > &baseTypes)
TypeID getContainedTypeFromWrapper(TypeID const &wrappedtypeID, std::string const &className)
ProductList const & productList() const
BranchID const & branchID() const
ret
prodAgent to be discontinued
BranchType const & branchType() const
std::map< BranchKey, BranchDescription > ProductList
std::vector< std::string > aliasToModules(KindOfType kindOfType, TypeID const &type, std::string_view moduleLabel, std::string_view productInstanceName) const
void addElementTypesForAliases(std::set< TypeID > const *elementTypesConsumed, std::map< TypeID, TypeID > const &containedTypeMap, std::map< TypeID, std::vector< TypeID >> const &containedTypeToBaseTypesMap)
TypeID unwrappedTypeID() const
std::string const & processName() const
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
assert(be >=bs)
void addLabelAlias(BranchDescription const &productdesc, std::string const &labelAlias, std::string const &instanceAlias)
AliasToOriginalVector aliasToOriginal_
BranchType
Definition: BranchType.h:11
virtual void addCalled(BranchDescription const &, bool iFromListener)
static TypeWithDict byName(std::string const &name)
Definition: TypeWithDict.cc:74
bool isValid() const
Definition: BranchID.h:22
void initializeLookupTables(std::set< TypeID > const *productTypesConsumed, std::set< TypeID > const *elementTypesConsumed, std::string const *processName)
bool combinable(BranchDescription const &a, BranchDescription const &b)
bool checkDictionary(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
void setUnscheduledProducts(std::set< std::string > const &unscheduledLabels)
std::vector< std::string > allBranchNames() const
ProductResolverIndex & nextIndexValue(BranchType branchType)
bool checkClassDictionaries(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
void addFromInput(edm::ProductRegistry const &)
void setFrozen(bool initializeLookupInfo=true)
void freezeIt(bool frozen=true)
std::vector< std::tuple< KindOfType, TypeID, std::string, std::string, std::string > > AliasToOriginalVector
ProductResolverIndex const & getNextIndexValue(BranchType branchType) const
std::string const & className() const
Definition: TypeID.cc:40
std::array< ProductResolverIndex, NumBranchTypes > nextIndexValues_
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
Definition: Algorithms.h:92
std::shared_ptr< ProductResolverIndexHelper const > productLookup(BranchType branchType) const
ProductList::size_type size() const
std::array< edm::propagate_const< std::shared_ptr< ProductResolverIndexHelper > >, NumBranchTypes > productLookups_
ProductResolverIndex indexFrom(BranchID const &iID) const
std::string wrappedClassName(std::string const &iFullName)
void print(std::ostream &os) const
void addContext(std::string const &context)
Definition: Exception.cc:169
HLT enums.
bool anyProducts(BranchType const brType) const
void checkForDuplicateProcessName(BranchDescription const &desc, std::string const *processName) const
void updateFromInput(ProductList const &other)
void throwIfNotFrozen() const
bool checkDictionaryOfWrappedType(std::vector< std::string > &missingDictionaries, TypeID const &unwrappedTypeID)
void checkDictionariesOfConsumedTypes(std::set< TypeID > const *productTypesConsumed, std::set< TypeID > const *elementTypesConsumed, std::map< TypeID, TypeID > const &containedTypeMap, std::map< TypeID, std::vector< TypeID >> &containedTypeToBaseTypesMap)
void throwIfFrozen() const
void addProduct(BranchDescription const &productdesc, bool iFromListener=false)
std::string const & moduleLabel() const
std::map< BranchID, ProductResolverIndex > branchIDToIndex_
std::string className(const T &t)
Definition: ClassName.h:31
void copyProduct(BranchDescription const &productdesc)
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)