2929
3030namespace edm {
3131
32- ProductRegistry::ProductRegistry () : productList_(), transient_() {}
33-
3432 ProductRegistry::Transients::Transients ()
3533 : frozen_(false ),
3634 productProduced_ (),
@@ -65,7 +63,7 @@ namespace edm {
6563 freezeIt (toBeFrozen);
6664 }
6765
68- void ProductRegistry::addProduct (ProductDescription const & productDesc, bool fromListener ) {
66+ void ProductRegistry::addProduct_ (ProductDescription const & productDesc) {
6967 assert (productDesc.produced ());
7068 throwIfFrozen ();
7169 std::pair<ProductList::iterator, bool > ret =
@@ -102,12 +100,11 @@ namespace edm {
102100 << " descendants of those products.\n " ;
103101 }
104102 }
105- addCalled (productDesc, fromListener);
106103 }
107104
108- void ProductRegistry::addLabelAlias (ProductDescription const & productDesc,
109- std::string const & labelAlias,
110- std::string const & instanceAlias) {
105+ ProductDescription const & ProductRegistry::addLabelAlias_ (ProductDescription const & productDesc,
106+ std::string const & labelAlias,
107+ std::string const & instanceAlias) {
111108 assert (productDesc.produced ());
112109 assert (productDesc.branchID ().isValid ());
113110 throwIfFrozen ();
@@ -116,7 +113,7 @@ namespace edm {
116113 assert (ret.second );
117114 transient_.aliasToOriginal_ .emplace_back (
118115 PRODUCT_TYPE, productDesc.unwrappedTypeID (), labelAlias, instanceAlias, productDesc.moduleLabel ());
119- addCalled (bd, false ) ;
116+ return ret. first -> second ;
120117 }
121118
122119 void ProductRegistry::copyProduct (ProductDescription const & productDesc) {
@@ -143,11 +140,7 @@ namespace edm {
143140 }
144141
145142 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]);
143+ return transient_.productLookups_ [branchType];
151144 }
152145
153146 void ProductRegistry::setFrozen (bool initializeLookupInfo) {
@@ -184,8 +177,6 @@ namespace edm {
184177 }
185178 }
186179
187- void ProductRegistry::addCalled (ProductDescription const &, bool ) {}
188-
189180 std::vector<std::string> ProductRegistry::allBranchNames () const {
190181 std::vector<std::string> result;
191182 result.reserve (productList ().size ());
@@ -218,20 +209,6 @@ namespace edm {
218209 }
219210 }
220211
221- void ProductRegistry::addFromInput (edm::ProductRegistry const & other) {
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-
235212 void ProductRegistry::setUnscheduledProducts (std::set<std::string> const & unscheduledLabels) {
236213 throwIfFrozen ();
237214
@@ -319,6 +296,11 @@ namespace edm {
319296
320297 transient_.branchIDToIndex_ .clear ();
321298
299+ std::array<std::shared_ptr<ProductResolverIndexHelper>, NumBranchTypes> new_productLookups{
300+ {std::make_shared<ProductResolverIndexHelper>(),
301+ std::make_shared<ProductResolverIndexHelper>(),
302+ std::make_shared<ProductResolverIndexHelper>(),
303+ std::make_shared<ProductResolverIndexHelper>()}};
322304 for (auto const & product : productList_) {
323305 auto const & desc = product.second ;
324306
@@ -438,13 +420,12 @@ namespace edm {
438420 }
439421 }
440422 }
441- ProductResolverIndex index = productLookup (desc.branchType ())
442- ->insert (typeID,
443- desc.moduleLabel ().c_str (),
444- desc.productInstanceName ().c_str (),
445- desc.processName ().c_str (),
446- containedTypeID,
447- baseTypesOfContainedType);
423+ ProductResolverIndex index = new_productLookups[desc.branchType ()]->insert (typeID,
424+ desc.moduleLabel ().c_str (),
425+ desc.productInstanceName ().c_str (),
426+ desc.processName ().c_str (),
427+ containedTypeID,
428+ baseTypesOfContainedType);
448429
449430 transient_.branchIDToIndex_ [desc.branchID ()] = index;
450431 }
@@ -454,9 +435,12 @@ namespace edm {
454435 throwMissingDictionariesException (missingDictionaries, context, producedTypes, branchNamesForMissing);
455436 }
456437
457- for (auto & iterProductLookup : transient_. productLookups_ ) {
438+ for (auto & iterProductLookup : new_productLookups ) {
458439 iterProductLookup->setFrozen ();
459440 }
441+ for (size_t i = 0 ; i < new_productLookups.size (); ++i) {
442+ transient_.productLookups_ [i] = std::move (new_productLookups[i]);
443+ }
460444
461445 unsigned int indexIntoNextIndexValue = 0 ;
462446 for (auto const & iterProductLookup : transient_.productLookups_ ) {
0 commit comments