CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BranchChildren.cc
Go to the documentation of this file.
2 
3 namespace edm {
4  void
5  BranchChildren::append_(map_t const& lookup, BranchID item, BranchIDSet& itemSet) const {
6  BranchIDSet const& items = const_cast<map_t &>(lookup)[item];
7  // For each parent(child)
8  for (BranchIDSet::const_iterator ci = items.begin(), ce = items.end();
9  ci != ce; ++ci) {
10  // Insert the BranchID of the parents(children) into the set of ancestors(descendants).
11  // If the insert succeeds, append recursively.
12  if (itemSet.insert(*ci).second) {
13  append_(lookup, *ci, itemSet);
14  }
15  }
16  }
17 
18  void
20  childLookup_.clear();
21  }
22 
23  void
25  childLookup_.insert(std::make_pair(parent, BranchIDSet()));
26  }
27 
28  void
30  childLookup_[parent].insert(child);
31  }
32 
33  void
35  descendants.insert(parent);
36  append_(childLookup_, parent, descendants);
37  }
38 }
list parent
Definition: dbtoconf.py:74
void insertEmpty(BranchID parent)
void insertChild(BranchID parent, BranchID child)
std::set< BranchID > BranchIDSet
void append_(map_t const &lookup, BranchID item, BranchIDSet &itemSet) const
std::map< BranchID, BranchIDSet > map_t
void appendToDescendants(BranchID parent, BranchIDSet &descendants) const