Skip to content

Commit 4c63b96

Browse files
committed
Move to SignallingProductRegistryFiller
Moved from SignallingProductRegistry. The new class now contains a ProductRegistry rather than inheriting from one. This allowed to addCalled method to be removed and fully implemented in the new class.
1 parent 692153c commit 4c63b96

File tree

67 files changed

+227
-222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+227
-222
lines changed

DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "FWCore/Sources/interface/VectorInputSource.h"
77
#include "FWCore/Sources/interface/VectorInputSourceDescription.h"
88
#include "FWCore/Sources/interface/VectorInputSourceFactory.h"
9-
#include "FWCore/Framework/interface/SignallingProductRegistry.h"
9+
#include "DataFormats/Provenance/interface/ProductRegistry.h"
1010
#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
1111
#include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
1212
#include "DataFormats/Common/interface/DetSetVector.h"
@@ -54,7 +54,7 @@ namespace sistrip {
5454
reorderedDigisTag_(config.getParameter<edm::InputTag>("SpyReorderedDigisTag")),
5555
virginRawDigisTag_(config.getParameter<edm::InputTag>("SpyVirginRawDigisTag")),
5656
counterDiffMax_(config.getParameter<uint32_t>("CounterDiffMaxAllowed")),
57-
productRegistry_(new edm::SignallingProductRegistry),
57+
productRegistry_(new edm::ProductRegistry),
5858
source_(constructSource(config.getParameter<edm::ParameterSet>("SpySource"))),
5959
// hardware information is not needed for the "overlay"
6060
processConfiguration_(std::make_unique<edm::ProcessConfiguration>(

DataFormats/Provenance/interface/ProductRegistry.h

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929
#include <vector>
3030

3131
namespace edm {
32-
32+
class SignallingProductRegistryFiller;
3333
class ProductResolverIndexHelper;
3434
class TypeID;
3535

3636
class ProductRegistry {
3737
public:
38+
friend class SignallingProductRegistryFiller;
39+
3840
typedef std::map<BranchKey, ProductDescription> ProductList;
3941

4042
ProductRegistry() = default;
@@ -46,7 +48,7 @@ namespace edm {
4648
// The constructed registry will be frozen by default.
4749
explicit ProductRegistry(ProductList const& productList, bool toBeFrozen = true);
4850

49-
virtual ~ProductRegistry() {}
51+
~ProductRegistry() = default;
5052

5153
typedef std::map<BranchKey, ProductDescription const> ConstProductList;
5254

@@ -141,14 +143,29 @@ namespace edm {
141143
AliasToOriginalVector aliasToOriginal_;
142144
};
143145

144-
protected:
145-
void addProduct_(ProductDescription const& productdesc, bool iFromListener = false);
146+
private:
147+
//The following three routines are only called by SignallingProductRegistryFiller
148+
void addProduct_(ProductDescription const& productdesc);
149+
150+
ProductDescription const& addLabelAlias_(ProductDescription const& productdesc,
151+
std::string const& labelAlias,
152+
std::string const& instanceAlias);
146153

147-
void addLabelAlias_(ProductDescription const& productdesc,
148-
std::string const& labelAlias,
149-
std::string const& instanceAlias);
150154
// triggers callbacks for modules watching registration
151-
void addFromInput_(edm::ProductRegistry const&);
155+
template <typename F>
156+
void addFromInput_(edm::ProductRegistry const& iReg, F&& iCallback) {
157+
throwIfFrozen();
158+
for (auto const& prod : iReg.productList_) {
159+
ProductList::iterator iter = productList_.find(prod.first);
160+
if (iter == productList_.end()) {
161+
productList_.insert(std::make_pair(prod.first, prod.second));
162+
iCallback(prod.second);
163+
} else {
164+
assert(combinable(iter->second, prod.second));
165+
iter->second.merge(prod.second);
166+
}
167+
}
168+
}
152169

153170
private:
154171
void setProductProduced(BranchType branchType) {
@@ -172,7 +189,6 @@ namespace edm {
172189

173190
void checkForDuplicateProcessName(ProductDescription const& desc, std::string const* processName) const;
174191

175-
virtual void addCalled(ProductDescription const&, bool iFromListener);
176192
void throwIfNotFrozen() const;
177193
void throwIfFrozen() const;
178194

DataFormats/Provenance/src/ProductRegistry.cc

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace edm {
6363
freezeIt(toBeFrozen);
6464
}
6565

66-
void ProductRegistry::addProduct_(ProductDescription const& productDesc, bool fromListener) {
66+
void ProductRegistry::addProduct_(ProductDescription const& productDesc) {
6767
assert(productDesc.produced());
6868
throwIfFrozen();
6969
std::pair<ProductList::iterator, bool> ret =
@@ -100,12 +100,11 @@ namespace edm {
100100
<< "descendants of those products.\n";
101101
}
102102
}
103-
addCalled(productDesc, fromListener);
104103
}
105104

106-
void ProductRegistry::addLabelAlias_(ProductDescription const& productDesc,
107-
std::string const& labelAlias,
108-
std::string const& instanceAlias) {
105+
ProductDescription const& ProductRegistry::addLabelAlias_(ProductDescription const& productDesc,
106+
std::string const& labelAlias,
107+
std::string const& instanceAlias) {
109108
assert(productDesc.produced());
110109
assert(productDesc.branchID().isValid());
111110
throwIfFrozen();
@@ -114,7 +113,7 @@ namespace edm {
114113
assert(ret.second);
115114
transient_.aliasToOriginal_.emplace_back(
116115
PRODUCT_TYPE, productDesc.unwrappedTypeID(), labelAlias, instanceAlias, productDesc.moduleLabel());
117-
addCalled(bd, false);
116+
return ret.first->second;
118117
}
119118

120119
void ProductRegistry::copyProduct(ProductDescription const& productDesc) {
@@ -178,8 +177,6 @@ namespace edm {
178177
}
179178
}
180179

181-
void ProductRegistry::addCalled(ProductDescription const&, bool) {}
182-
183180
std::vector<std::string> ProductRegistry::allBranchNames() const {
184181
std::vector<std::string> result;
185182
result.reserve(productList().size());
@@ -212,20 +209,6 @@ namespace edm {
212209
}
213210
}
214211

215-
void ProductRegistry::addFromInput_(edm::ProductRegistry const& other) {
216-
throwIfFrozen();
217-
for (auto const& prod : other.productList_) {
218-
ProductList::iterator iter = productList_.find(prod.first);
219-
if (iter == productList_.end()) {
220-
productList_.insert(std::make_pair(prod.first, prod.second));
221-
addCalled(prod.second, false);
222-
} else {
223-
assert(combinable(iter->second, prod.second));
224-
iter->second.merge(prod.second);
225-
}
226-
}
227-
}
228-
229212
void ProductRegistry::setUnscheduledProducts(std::set<std::string> const& unscheduledLabels) {
230213
throwIfFrozen();
231214

FWCore/Framework/interface/EventProcessor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ configured in the user's main() function, and is set running.
1818
#include "FWCore/Framework/interface/MergeableRunProductProcesses.h"
1919
#include "FWCore/Framework/interface/SharedResourcesAcquirer.h"
2020
#include "FWCore/Framework/interface/PrincipalCache.h"
21-
#include "FWCore/Framework/interface/SignallingProductRegistry.h"
21+
#include "FWCore/Framework/interface/SignallingProductRegistryFiller.h"
2222
#include "FWCore/Framework/interface/PreallocationConfiguration.h"
2323

2424
#include "FWCore/ParameterSet/interface/ParameterSet.h"

FWCore/Framework/interface/GlobalSchedule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "FWCore/Framework/interface/WorkerManager.h"
1515
#include "FWCore/Framework/interface/maker/Worker.h"
1616
#include "FWCore/Framework/interface/WorkerRegistry.h"
17-
#include "FWCore/Framework/interface/SignallingProductRegistry.h"
17+
#include "FWCore/Framework/interface/SignallingProductRegistryFiller.h"
1818
#include "FWCore/MessageLogger/interface/ExceptionMessages.h"
1919
#include "FWCore/ServiceRegistry/interface/GlobalContext.h"
2020
#include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
@@ -60,7 +60,7 @@ namespace edm {
6060
std::shared_ptr<ModuleRegistry> modReg,
6161
std::vector<std::string> const& modulesToUse,
6262
ParameterSet& proc_pset,
63-
SignallingProductRegistry& pregistry,
63+
SignallingProductRegistryFiller& pregistry,
6464
PreallocationConfiguration const& prealloc,
6565
ExceptionToActionTable const& actions,
6666
std::shared_ptr<ActivityRegistry> areg,

FWCore/Framework/interface/ModuleChanger.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@
3131
namespace edm {
3232
class ParameterSet;
3333
class Schedule;
34-
class SignallingProductRegistry;
34+
class SignallingProductRegistryFiller;
3535

3636
class ModuleChanger {
3737
public:
38-
ModuleChanger(Schedule*, SignallingProductRegistry const* iReg, eventsetup::ESRecordsToProductResolverIndices);
38+
ModuleChanger(Schedule*,
39+
SignallingProductRegistryFiller const* iReg,
40+
eventsetup::ESRecordsToProductResolverIndices);
3941
ModuleChanger(const ModuleChanger&) = delete; // stop default
4042
const ModuleChanger& operator=(const ModuleChanger&) = delete; // stop default
4143
virtual ~ModuleChanger();
@@ -50,7 +52,7 @@ namespace edm {
5052
private:
5153
// ---------- member data --------------------------------
5254
edm::propagate_const<Schedule*> schedule_;
53-
SignallingProductRegistry const* registry_;
55+
SignallingProductRegistryFiller const* registry_;
5456
eventsetup::ESRecordsToProductResolverIndices indices_;
5557
};
5658
} // namespace edm

FWCore/Framework/interface/OutputModuleCore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace edm {
5555
class PreallocationConfiguration;
5656
class ActivityRegistry;
5757
class ThinnedAssociationsHelper;
58-
class SignallingProductRegistry;
58+
class SignallingProductRegistryFiller;
5959

6060
template <typename T>
6161
class OutputModuleCommunicatorT;
@@ -216,7 +216,7 @@ namespace edm {
216216
/// Tell the OutputModule that is must end the current file.
217217
void doCloseFile();
218218

219-
void registerProductsAndCallbacks(OutputModuleCore const*, SignallingProductRegistry*);
219+
void registerProductsAndCallbacks(OutputModuleCore const*, SignallingProductRegistryFiller*);
220220

221221
bool needToRunSelection() const noexcept;
222222
std::vector<ProductResolverIndexAndSkipBit> productsUsedBySelection() const noexcept;

FWCore/Framework/interface/ProducerBase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ EDProducts into an Event.
2222
namespace edm {
2323
class ModuleDescription;
2424
class ProducesCollector;
25-
class SignallingProductRegistry;
25+
class SignallingProductRegistryFiller;
2626
class Event;
2727
class LuminosityBlock;
2828
class ProcessBlock;
@@ -76,7 +76,7 @@ namespace edm {
7676
/// used by the fwk to register list of products
7777
std::function<void(ProductDescription const&)> registrationCallback() const;
7878

79-
void registerProducts(ProducerBase*, SignallingProductRegistry*, ModuleDescription const&);
79+
void registerProducts(ProducerBase*, SignallingProductRegistryFiller*, ModuleDescription const&);
8080

8181
using ProductRegistryHelper::recordProvenanceList;
8282
using ProductRegistryHelper::typeLabelList;

FWCore/Framework/interface/ProductRegistryHelper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace edm {
1919
class ModuleDescription;
20-
class SignallingProductRegistry;
20+
class SignallingProductRegistryFiller;
2121
struct DoNotRecordParents;
2222

2323
template <Transition B>
@@ -104,7 +104,7 @@ namespace edm {
104104
static void addToRegistry(TypeLabelList::const_iterator const& iBegin,
105105
TypeLabelList::const_iterator const& iEnd,
106106
ModuleDescription const& iDesc,
107-
SignallingProductRegistry& iReg,
107+
SignallingProductRegistryFiller& iReg,
108108
ProductRegistryHelper* iProd,
109109
bool iIsListener = false);
110110

FWCore/Framework/interface/Schedule.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ namespace edm {
108108
class ExceptionCollector;
109109
class MergeableRunProductMetadata;
110110
class OutputModuleCommunicator;
111-
class SignallingProductRegistry;
111+
class SignallingProductRegistryFiller;
112112
class PreallocationConfiguration;
113113
class StreamSchedule;
114114
class GlobalSchedule;
@@ -132,7 +132,7 @@ namespace edm {
132132

133133
Schedule(ParameterSet& proc_pset,
134134
service::TriggerNamesService const& tns,
135-
SignallingProductRegistry& pregistry,
135+
SignallingProductRegistryFiller& pregistry,
136136
ExceptionToActionTable const& actions,
137137
std::shared_ptr<ActivityRegistry> areg,
138138
std::shared_ptr<ProcessConfiguration const> processConfiguration,
@@ -141,7 +141,7 @@ namespace edm {
141141
ModuleTypeResolverMaker const* resolverMaker);
142142
void finishSetup(ParameterSet& proc_pset,
143143
service::TriggerNamesService const& tns,
144-
SignallingProductRegistry& preg,
144+
SignallingProductRegistryFiller& preg,
145145
BranchIDListHelper& branchIDListHelper,
146146
ProcessBlockHelperBase& processBlockHelper,
147147
ThinnedAssociationsHelper& thinnedAssociationsHelper,
@@ -291,7 +291,7 @@ namespace edm {
291291
/// Returns true if successful.
292292
bool changeModule(std::string const& iLabel,
293293
ParameterSet const& iPSet,
294-
const SignallingProductRegistry& iRegistry,
294+
const SignallingProductRegistryFiller& iRegistry,
295295
eventsetup::ESRecordsToProductResolverIndices const&);
296296

297297
/// Deletes module with label iLabel

0 commit comments

Comments
 (0)