CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/Provenance/interface/BranchMapper.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Provenance_BranchMapper_h
00002 #define DataFormats_Provenance_BranchMapper_h
00003 
00004 /*----------------------------------------------------------------------
00005   
00006 BranchMapper: Manages the per event/lumi/run per product provenance.
00007 
00008 ----------------------------------------------------------------------*/
00009 #include <iosfwd>
00010 #include <set>
00011 #include <map>
00012 
00013 #include "boost/shared_ptr.hpp"
00014 
00015 #include "DataFormats/Provenance/interface/BranchID.h"
00016 #include "DataFormats/Provenance/interface/ProductProvenance.h"
00017 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
00018 
00019 /*
00020   BranchMapper
00021 
00022 */
00023 
00024 namespace edm {
00025   class ProductID;
00026   class BranchMapper {
00027   public:
00028     BranchMapper();
00029 
00030     explicit BranchMapper(bool delayedRead);
00031 
00032     virtual ~BranchMapper();
00033 
00034     void write(std::ostream& os) const;
00035 
00036     ProductProvenance const* branchIDToProvenance(BranchID const& bid) const;
00037 
00038     void insert(ProductProvenance const& provenanceProduct);
00039 
00040     void mergeMappers(boost::shared_ptr<BranchMapper> other) {nextMapper_ = other;}
00041 
00042     void setDelayedRead(bool value) {delayedRead_ = value;}
00043 
00044     BranchID oldProductIDToBranchID(ProductID const& oldProductID) const {
00045       return oldProductIDToBranchID_(oldProductID);
00046     }
00047 
00048     ProcessHistoryID const& processHistoryID() const {return processHistoryID_;}
00049 
00050     ProcessHistoryID& processHistoryID() {return processHistoryID_;}
00051 
00052     void reset();
00053   private:
00054     typedef std::set<ProductProvenance> eiSet;
00055 
00056     void readProvenance() const;
00057     virtual void readProvenance_() const {}
00058     virtual void reset_() {}
00059     
00060     virtual BranchID oldProductIDToBranchID_(ProductID const& oldProductID) const;
00061 
00062     eiSet entryInfoSet_;
00063 
00064     boost::shared_ptr<BranchMapper> nextMapper_;
00065 
00066     mutable bool delayedRead_;
00067 
00068     ProcessHistoryID processHistoryID_;
00069   };
00070   
00071   inline
00072   std::ostream&
00073   operator<<(std::ostream& os, BranchMapper const& p) {
00074     p.write(os);
00075     return os;
00076   }
00077 }
00078 #endif