CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/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     boost::shared_ptr<ProductProvenance> 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   private:
00053     typedef std::set<ProductProvenance> eiSet;
00054 
00055     void readProvenance() const;
00056     virtual void readProvenance_() const {}
00057 
00058     virtual BranchID oldProductIDToBranchID_(ProductID const& oldProductID) const;
00059 
00060     eiSet entryInfoSet_;
00061 
00062     boost::shared_ptr<BranchMapper> nextMapper_;
00063 
00064     mutable bool delayedRead_;
00065 
00066     ProcessHistoryID processHistoryID_;
00067   };
00068   
00069   inline
00070   std::ostream&
00071   operator<<(std::ostream& os, BranchMapper const& p) {
00072     p.write(os);
00073     return os;
00074   }
00075 }
00076 #endif