CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BranchChildren.cc
Go to the documentation of this file.
2 
4 
5 namespace edm {
6  void BranchChildren::append_(map_t const& lookup,
8  BranchIDSet& itemSet,
9  std::map<BranchID, BranchID> const& droppedToKeptAlias) const {
10  auto const iter = lookup.find(item);
11  if (iter != lookup.end()) {
12  BranchIDSet const& branchIDs = iter->second;
13  for (BranchID const& branchID : branchIDs) {
14  auto it = droppedToKeptAlias.find(branchID);
15  // Insert the BranchID of the children into the set of descendants.
16  // If the insert succeeds, append recursively.
17  if (it == droppedToKeptAlias.end()) {
18  // Normal case. Not an EDAlias.
19  if (itemSet.insert(branchID).second) {
20  append_(lookup, branchID, itemSet, droppedToKeptAlias);
21  }
22  } else {
23  // In this case, we want to put the EDAlias in the
24  // set of things to drop because that is what really
25  // needs to be dropped, but the recursive search in
26  // the lookup map must continue with the original BranchID
27  // because that is what the lookup map contains.
28  if (itemSet.insert(it->second).second) {
29  append_(lookup, branchID, itemSet, droppedToKeptAlias);
30  }
31  }
32  }
33  }
34  }
35 
36  void BranchChildren::clear() { childLookup_.clear(); }
37 
38  void BranchChildren::insertEmpty(BranchID parent) { childLookup_.insert(std::make_pair(parent, BranchIDSet())); }
39 
41 
43  BranchIDSet& descendants,
44  std::map<BranchID, BranchID> const& droppedToKeptAlias) const {
45  descendants.insert(parent.branchID());
46  // A little tricky here. The child lookup map is filled with the
47  // BranchID of the original product even if there was an EDAlias
48  // and the EDAlias was saved and the original branch dropped.
49  append_(childLookup_, parent.originalBranchID(), descendants, droppedToKeptAlias);
50  }
51 } // namespace edm
void insertEmpty(BranchID parent)
void insertChild(BranchID parent, BranchID child)
void append_(map_t const &lookup, BranchID item, BranchIDSet &itemSet, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
BranchID const & branchID() const
std::set< BranchID > BranchIDSet
void appendToDescendants(BranchDescription const &parent, BranchIDSet &descendants, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
std::map< BranchID, BranchIDSet > map_t
BranchID const & originalBranchID() const