CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DataFormats/Provenance/interface/BranchChildren.h

Go to the documentation of this file.
00001 #ifndef DataFormats_Provenance_BranchChildren_h
00002 #define DataFormats_Provenance_BranchChildren_h
00003 
00004 /*----------------------------------------------------------------------
00005   
00006 BranchChildren: Dependency information between branches.
00007 
00008 ----------------------------------------------------------------------*/
00009 
00010 #include <map>
00011 #include <set>
00012 #include "DataFormats/Provenance/interface/BranchID.h"
00013 
00014 namespace edm {
00015 
00016   class BranchChildren {
00017   private:
00018     typedef std::set<BranchID> BranchIDSet;
00019     typedef std::map<BranchID, BranchIDSet> map_t;
00020   public:
00021 
00022     // Clear all information.
00023     void clear();
00024 
00025     // Insert a parent with no children.
00026     void insertEmpty(BranchID parent);
00027 
00028     // Insert a new child for the given parent.
00029     void insertChild(BranchID parent, BranchID child);
00030 
00031     // Look up all the descendants of the given parent, and insert them
00032     // into descendants. N.B.: this does not clear out descendants first;
00033     // it only appends *new* elements to the collection.
00034     void appendToDescendants(BranchID parent, BranchIDSet& descendants) const;
00035 
00036     // const accessor for the data
00037     map_t const&
00038     childLookup() const {
00039       return childLookup_;
00040     }
00041 
00042   private:
00043     map_t childLookup_;
00044 
00045     void append_(map_t const& lookup, BranchID item, BranchIDSet& itemSet) const;
00046   };
00047 
00048 }
00049 #endif