Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-08 22:25:03

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