CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_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 "DataFormats/Provenance/interface/BranchID.h"
00010 #include "DataFormats/Provenance/interface/ProductProvenance.h"
00011 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
00012 
00013 #include "boost/scoped_ptr.hpp"
00014 #include "boost/shared_ptr.hpp"
00015 #include "boost/utility.hpp"
00016 
00017 #include <iosfwd>
00018 #include <memory>
00019 #include <set>
00020 
00021 /*
00022   BranchMapper
00023 */
00024 
00025 namespace edm {
00026   class ProvenanceReaderBase;
00027 
00028   class BranchMapper : private boost::noncopyable {
00029   public:
00030     BranchMapper();
00031 #ifndef __GCCXML__
00032     explicit BranchMapper(std::unique_ptr<ProvenanceReaderBase> reader);
00033 #endif
00034 
00035     ~BranchMapper();
00036 
00037     ProductProvenance const* branchIDToProvenance(BranchID const& bid) const;
00038 
00039     void insertIntoSet(ProductProvenance const& provenanceProduct) const;
00040 
00041     void mergeMappers(boost::shared_ptr<BranchMapper> other);
00042 
00043     void reset();
00044   private:
00045     void readProvenance() const;
00046 
00047     typedef std::set<ProductProvenance> eiSet;
00048 
00049     mutable eiSet entryInfoSet_;
00050     boost::shared_ptr<BranchMapper> nextMapper_;
00051     mutable bool delayedRead_;
00052     mutable boost::scoped_ptr<ProvenanceReaderBase> provenanceReader_;
00053   };
00054 
00055   class ProvenanceReaderBase {
00056   public:
00057     ProvenanceReaderBase() {}
00058     virtual ~ProvenanceReaderBase();
00059     virtual void readProvenance(BranchMapper const& mapper) const = 0;
00060   };
00061   
00062 }
00063 #endif