Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:01

0001 #ifndef DataFormats_Provenance_BranchChildren_h
0002 #define DataFormats_Provenance_BranchChildren_h
0003 
0004 /*----------------------------------------------------------------------
0005   
0006 BranchChildren: Dependency information between branches.
0007 
0008 ----------------------------------------------------------------------*/
0009 
0010 #include <map>
0011 #include <set>
0012 #include "DataFormats/Provenance/interface/BranchID.h"
0013 
0014 namespace edm {
0015 
0016   class BranchDescription;
0017 
0018   class BranchChildren {
0019   private:
0020     typedef std::set<BranchID> BranchIDSet;
0021     typedef std::map<BranchID, BranchIDSet> map_t;
0022 
0023   public:
0024     // Clear all information.
0025     void clear();
0026 
0027     // Insert a parent with no children.
0028     void insertEmpty(BranchID parent);
0029 
0030     // Insert a new child for the given parent.
0031     void insertChild(BranchID parent, BranchID child);
0032 
0033     // Look up all the descendants of the given parent, and insert them
0034     // into descendants. N.B.: this does not clear out descendants first;
0035     // it only appends *new* elements to the collection.
0036     void appendToDescendants(BranchDescription const& parent,
0037                              BranchIDSet& descendants,
0038                              std::map<BranchID, BranchID> const& droppedToKeptAlias) const;
0039 
0040     // const accessor for the data
0041     map_t const& childLookup() const { return childLookup_; }
0042 
0043   private:
0044     map_t childLookup_;
0045 
0046     void append_(map_t const& lookup,
0047                  BranchID item,
0048                  BranchIDSet& itemSet,
0049                  std::map<BranchID, BranchID> const& droppedToKeptAlias) const;
0050   };
0051 
0052 }  // namespace edm
0053 #endif