CMS 3D CMS Logo

ProductProvenanceRetriever.cc
Go to the documentation of this file.
4 
5 #include <cassert>
6 #include <limits>
7 
8 /*
9  ProductProvenanceRetriever
10 */
11 
12 namespace edm {
14  : ProductProvenanceLookup(), nextRetriever_(), provenanceReader_(), transitionIndex_(iTransitionIndex) {}
15 
17  edm::ProductRegistry const& iReg)
18  : ProductProvenanceLookup(iReg), nextRetriever_(), provenanceReader_(), transitionIndex_(iTransitionIndex) {}
19 
20  ProductProvenanceRetriever::ProductProvenanceRetriever(std::unique_ptr<ProvenanceReaderBase> reader)
22  nextRetriever_(),
23  provenanceReader_(reader.release()),
24  transitionIndex_(std::numeric_limits<unsigned int>::max()) {
26  }
27 
28  std::unique_ptr<const std::set<ProductProvenance>> ProductProvenanceRetriever::readProvenance() const {
29  std::unique_ptr<const std::set<ProductProvenance>> temp;
30  if (provenanceReader_) {
31  temp = std::make_unique<std::set<ProductProvenance> const>(provenanceReader_->readProvenance(transitionIndex_));
32  }
33  return temp;
34  }
35 
37  ModuleCallingContext const* moduleCallingContext) const {
38  if (provenanceReader_ and nullptr == readEntryInfoSet_.load()) {
39  provenanceReader_->readProvenanceAsync(task, moduleCallingContext, transitionIndex_, readEntryInfoSet_);
40  }
41  if (nextRetriever_) {
42  nextRetriever_->readProvenanceAsync(task, moduleCallingContext);
43  }
44  }
45 
47  if (iFrom.readEntryInfoSet_) {
48  if (readEntryInfoSet_) {
49  delete readEntryInfoSet_.exchange(nullptr);
50  }
51  readEntryInfoSet_ = new std::set<ProductProvenance>(*iFrom.readEntryInfoSet_);
52  } else {
53  if (readEntryInfoSet_) {
54  delete readEntryInfoSet_.load();
55  readEntryInfoSet_ = nullptr;
56  }
57  }
58  assert(iFrom.entryInfoSet_.empty());
60 
61  if (iFrom.nextRetriever_) {
62  if (not nextRetriever_) {
63  nextRetriever_ = std::make_shared<ProductProvenanceRetriever>(transitionIndex_);
64  }
65  nextRetriever_->deepCopy(*(iFrom.nextRetriever_));
66  }
67  }
68 
70  delete readEntryInfoSet_.load();
71  readEntryInfoSet_ = nullptr;
72  for (auto& e : entryInfoSet_) {
73  e.resetParentage();
74  }
75  if (nextRetriever_) {
76  nextRetriever_->reset();
77  }
78  parentProcessRetriever_ = nullptr;
79  }
80 
81  void ProductProvenanceRetriever::mergeProvenanceRetrievers(std::shared_ptr<ProductProvenanceRetriever> other) {
83  }
84 
86  parentProcessRetriever_ = &provRetriever;
87  }
88 
90 } // namespace edm
void deepCopy(ProductProvenanceRetriever const &)
void readProvenanceAsync(WaitingTaskHolder task, ModuleCallingContext const *moduleCallingContext) const
reader
Definition: DQM.py:105
assert(be >=bs)
std::unique_ptr< const std::set< ProductProvenance > > readProvenance() const final
void mergeParentProcessRetriever(ProductProvenanceRetriever const &provRetriever)
void mergeProvenanceRetrievers(std::shared_ptr< ProductProvenanceRetriever > other)
std::shared_ptr< const ProvenanceReaderBase > provenanceReader_
std::atomic< const std::set< ProductProvenance > * > readEntryInfoSet_
edm::propagate_const< ProductProvenanceLookup const * > parentProcessRetriever_
ProductProvenanceRetriever(unsigned int iTransitionIndex)
HLT enums.
edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > nextRetriever_
std::vector< ProducedProvenanceInfo > entryInfoSet_
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:118