CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/DataFormats/Provenance/interface/TransientProductLookupMap.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Provenance_TransientProductLookupMap_h
00002 #define DataFormats_Provenance_TransientProductLookupMap_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Provenance
00006 // Class  :     TransientProductLookupMap
00007 // 
00025 //
00026 // Original Author:  Chris Jones
00027 //         Created:  Fri May  1 11:15:08 CDT 2009
00028 //
00029 
00030 // system include files
00031 #include <map>
00032 #include <vector>
00033 
00034 // user include files
00035 #include "DataFormats/Provenance/interface/TypeInBranchType.h"
00036 #include "DataFormats/Provenance/interface/BranchDescriptionIndex.h"
00037 #include "DataFormats/Provenance/interface/ProductLookupIndex.h"
00038 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
00039 
00040 // forward declarations
00041 namespace edm {
00042    class ProcessHistory;
00043    
00044    struct CompareTypeInBranchTypeConstBranchDescription {
00045       bool operator()(std::pair<TypeInBranchType, ConstBranchDescription const*> const& iLHS,
00046                       std::pair<TypeInBranchType, ConstBranchDescription const*> const& iRHS) const;
00047    };
00048    
00049    class TransientProductLookupMap {
00050       
00051    public:
00052       typedef std::vector<std::pair<TypeInBranchType, BranchDescriptionIndex> > TypeInBranchTypeLookup;
00053       typedef std::vector<ProductLookupIndex> ProductLookupIndexList;
00054       
00055       typedef ProductLookupIndexList::const_iterator const_iterator;
00056 
00057       typedef std::map<std::pair<TypeInBranchType, ConstBranchDescription const*>,
00058                         ProductTransientIndex,
00059                         CompareTypeInBranchTypeConstBranchDescription> FillFromMap;
00060 
00061       TransientProductLookupMap();
00062 
00063       void reset();
00064             
00065       // ---------- const member functions ---------------------
00066       
00068       std::pair<const_iterator, const_iterator> equal_range(TypeInBranchType const&) const;
00069       
00072       std::pair<const_iterator, const_iterator> equal_range(TypeInBranchType const&,
00073                                                             std::string const&,
00074                                                             std::string const&) const;
00075       
00076       // ---------- static member functions --------------------
00077       
00078       // ---------- member functions ---------------------------
00079 
00081       void reorderIfNecessary(BranchType, ProcessHistory const&, std::string const& iNewProcessName);
00082       
00083       void fillFrom(FillFromMap const&);
00084 
00085       const_iterator begin() const {return productLookupIndexList_.begin();}
00086 
00087       const_iterator end() const {return productLookupIndexList_.end();}
00088 
00089       int fillCount() const {return fillCount_;}
00090 
00091    private:
00092       // ---------- member data --------------------------------
00093       TypeInBranchTypeLookup branchLookup_;
00094       ProductLookupIndexList productLookupIndexList_;
00095       std::vector<ProcessHistoryID> historyIDsForBranchType_;
00096       std::vector<std::vector<std::string> > processNameOrderingForBranchType_;
00097       int fillCount_;
00098    };
00099    
00100 }
00101 
00102 #endif