CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
edm::ProductProvenanceRetriever Class Reference

#include <ProductProvenanceRetriever.h>

Inheritance diagram for edm::ProductProvenanceRetriever:

Public Member Functions

ProductProvenance const * branchIDToProvenance (BranchID const &bid) const
 
void deepSwap (ProductProvenanceRetriever &)
 
void insertIntoSet (ProductProvenance const &provenanceProduct) const
 
void mergeProvenanceRetrievers (boost::shared_ptr< ProductProvenanceRetriever > other)
 
 ProductProvenanceRetriever (unsigned int iTransitionIndex)
 
 ProductProvenanceRetriever (std::unique_ptr< ProvenanceReaderBase > reader)
 
void reset ()
 
 ~ProductProvenanceRetriever ()
 

Private Types

typedef std::set
< ProductProvenance
eiSet
 

Private Member Functions

void readProvenance () const
 
void setTransitionIndex (unsigned int transitionIndex)
 

Private Attributes

bool delayedRead_
 
eiSet entryInfoSet_
 
boost::shared_ptr
< ProductProvenanceRetriever
nextRetriever_
 
boost::shared_ptr
< ProvenanceReaderBase
provenanceReader_
 
unsigned int transitionIndex_
 

Detailed Description

Definition at line 28 of file ProductProvenanceRetriever.h.

Member Typedef Documentation

Definition at line 52 of file ProductProvenanceRetriever.h.

Constructor & Destructor Documentation

edm::ProductProvenanceRetriever::ProductProvenanceRetriever ( unsigned int  iTransitionIndex)
explicit

Definition at line 13 of file ProductProvenanceRetriever.cc.

Referenced by deepSwap().

13  :
14  entryInfoSet_(),
17  transitionIndex_(iTransitionIndex),
18  delayedRead_(false){
19  }
boost::shared_ptr< ProvenanceReaderBase > provenanceReader_
boost::shared_ptr< ProductProvenanceRetriever > nextRetriever_
edm::ProductProvenanceRetriever::ProductProvenanceRetriever ( std::unique_ptr< ProvenanceReaderBase reader)
explicit

Definition at line 21 of file ProductProvenanceRetriever.cc.

References provenanceReader_.

21  :
22  entryInfoSet_(),
24  provenanceReader_(reader.release()),
26  delayedRead_(true)
27  {
28  assert(provenanceReader_);
29  }
const T & max(const T &a, const T &b)
boost::shared_ptr< ProvenanceReaderBase > provenanceReader_
boost::shared_ptr< ProductProvenanceRetriever > nextRetriever_
edm::ProductProvenanceRetriever::~ProductProvenanceRetriever ( )

Definition at line 31 of file ProductProvenanceRetriever.cc.

31 {}

Member Function Documentation

ProductProvenance const * edm::ProductProvenanceRetriever::branchIDToProvenance ( BranchID const &  bid) const

Definition at line 80 of file ProductProvenanceRetriever.cc.

References entryInfoSet_, nextRetriever_, and readProvenance().

Referenced by edm::RootOutputFile::insertAncestors().

80  {
82  ProductProvenance ei(bid);
83  eiSet::const_iterator it = entryInfoSet_.find(ei);
84  if(it == entryInfoSet_.end()) {
85  if(nextRetriever_) {
86  return nextRetriever_->branchIDToProvenance(bid);
87  } else {
88  return 0;
89  }
90  }
91  return &*it;
92  }
boost::shared_ptr< ProductProvenanceRetriever > nextRetriever_
void edm::ProductProvenanceRetriever::deepSwap ( ProductProvenanceRetriever iFrom)

Definition at line 41 of file ProductProvenanceRetriever.cc.

References delayedRead_, entryInfoSet_, nextRetriever_, ProductProvenanceRetriever(), provenanceReader_, and transitionIndex_.

42  {
43  entryInfoSet_.swap(iFrom.entryInfoSet_);
44  provenanceReader_ = iFrom.provenanceReader_;
45  if(provenanceReader_) {
46  delayedRead_=true;
47  }
48  if(iFrom.nextRetriever_) {
49  if(not nextRetriever_) {
50  nextRetriever_.reset(new ProductProvenanceRetriever(transitionIndex_));
51  }
52  nextRetriever_->deepSwap(*(iFrom.nextRetriever_));
53  }
54  }
boost::shared_ptr< ProvenanceReaderBase > provenanceReader_
boost::shared_ptr< ProductProvenanceRetriever > nextRetriever_
ProductProvenanceRetriever(unsigned int iTransitionIndex)
void edm::ProductProvenanceRetriever::insertIntoSet ( ProductProvenance const &  provenanceProduct) const

Definition at line 66 of file ProductProvenanceRetriever.cc.

References entryInfoSet_.

Referenced by edm::ReducedProvenanceReader::readProvenance(), edm::FullProvenanceReader::readProvenance(), and edm::OldProvenanceReader::readProvenance().

66  {
67  //NOTE:do not read provenance here because we only need the full
68  // provenance when someone tries to access it not when doing the insert
69  // doing the delay saves 20% of time when doing an analysis job
70  //readProvenance();
71  entryInfoSet_.insert(entryInfo);
72  }
void edm::ProductProvenanceRetriever::mergeProvenanceRetrievers ( boost::shared_ptr< ProductProvenanceRetriever other)

Definition at line 75 of file ProductProvenanceRetriever.cc.

References nextRetriever_.

75  {
76  nextRetriever_ = other;
77  }
boost::shared_ptr< ProductProvenanceRetriever > nextRetriever_
void edm::ProductProvenanceRetriever::readProvenance ( ) const
private

Definition at line 34 of file ProductProvenanceRetriever.cc.

References delayedRead_, provenanceReader_, and transitionIndex_.

Referenced by branchIDToProvenance().

34  {
36  provenanceReader_->readProvenance(*this,transitionIndex_);
37  delayedRead_ = false; // only read once
38  }
39  }
boost::shared_ptr< ProvenanceReaderBase > provenanceReader_
void edm::ProductProvenanceRetriever::reset ( void  )

Definition at line 57 of file ProductProvenanceRetriever.cc.

References delayedRead_, entryInfoSet_, and nextRetriever_.

57  {
58  entryInfoSet_.clear();
59  delayedRead_ = true;
60  if(nextRetriever_) {
61  nextRetriever_->reset();
62  }
63  }
boost::shared_ptr< ProductProvenanceRetriever > nextRetriever_
void edm::ProductProvenanceRetriever::setTransitionIndex ( unsigned int  transitionIndex)
inlineprivate

Definition at line 48 of file ProductProvenanceRetriever.h.

References transitionIndex_.

48  {
49  transitionIndex_=transitionIndex;
50  }

Member Data Documentation

bool edm::ProductProvenanceRetriever::delayedRead_
mutableprivate

Definition at line 58 of file ProductProvenanceRetriever.h.

Referenced by deepSwap(), readProvenance(), and reset().

eiSet edm::ProductProvenanceRetriever::entryInfoSet_
mutableprivate

Definition at line 54 of file ProductProvenanceRetriever.h.

Referenced by branchIDToProvenance(), deepSwap(), insertIntoSet(), and reset().

boost::shared_ptr<ProductProvenanceRetriever> edm::ProductProvenanceRetriever::nextRetriever_
private
boost::shared_ptr<ProvenanceReaderBase> edm::ProductProvenanceRetriever::provenanceReader_
mutableprivate
unsigned int edm::ProductProvenanceRetriever::transitionIndex_
private

Definition at line 57 of file ProductProvenanceRetriever.h.

Referenced by deepSwap(), readProvenance(), and setTransitionIndex().