CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BranchMapper.cc
Go to the documentation of this file.
3 
4 #include <cassert>
5 #include <iostream>
6 
7 /*
8  BranchMapper
9 */
10 
11 namespace edm {
13  entryInfoSet_(),
14  nextMapper_(),
15  delayedRead_(false),
16  provenanceReader_() {
17  }
18 
19  BranchMapper::BranchMapper(std::unique_ptr<ProvenanceReaderBase> reader) :
20  entryInfoSet_(),
21  nextMapper_(),
22  delayedRead_(true),
23  provenanceReader_(reader.release()) {
24  assert(provenanceReader_);
25  }
26 
28 
29  void
32  provenanceReader_->readProvenance(*this);
33  delayedRead_ = false; // only read once
34  }
35  }
36 
37  void
39  entryInfoSet_.clear();
40  delayedRead_ = true;
41  }
42 
43  void
45  //NOTE:do not read provenance here because we only need the full
46  // provenance when someone tries to access it not when doing the insert
47  // doing the delay saves 20% of time when doing an analysis job
48  //readProvenance();
49  entryInfoSet_.insert(entryInfo);
50  }
51 
52  void
53  BranchMapper::mergeMappers(boost::shared_ptr<BranchMapper> other) {
54  nextMapper_ = other;
55  }
56 
57  ProductProvenance const*
60  ProductProvenance ei(bid);
61  eiSet::const_iterator it = entryInfoSet_.find(ei);
62  if(it == entryInfoSet_.end()) {
63  if(nextMapper_) {
64  return nextMapper_->branchIDToProvenance(bid);
65  } else {
66  return 0;
67  }
68  }
69  return &*it;
70  }
71 
73  }
74 }
ProductProvenance const * branchIDToProvenance(BranchID const &bid) const
Definition: BranchMapper.cc:58
boost::scoped_ptr< ProvenanceReaderBase > provenanceReader_
Definition: BranchMapper.h:52
boost::shared_ptr< BranchMapper > nextMapper_
Definition: BranchMapper.h:50
void mergeMappers(boost::shared_ptr< BranchMapper > other)
Definition: BranchMapper.cc:53
void insertIntoSet(ProductProvenance const &provenanceProduct) const
Definition: BranchMapper.cc:44
void readProvenance() const
Definition: BranchMapper.cc:30