CMS 3D CMS Logo

BranchChildren.cc
Go to the documentation of this file.
2 
4 
5 namespace edm {
6  void
8  BranchID item,
9  BranchIDSet& itemSet,
10  std::map<BranchID, BranchID> const& droppedToKeptAlias) const {
11  auto const iter = lookup.find(item);
12  if(iter != lookup.end()) {
13  BranchIDSet const& branchIDs = iter->second;
14  for(BranchID const& branchID : branchIDs) {
15  auto it = droppedToKeptAlias.find(branchID);
16  // Insert the BranchID of the children into the set of descendants.
17  // If the insert succeeds, append recursively.
18  if (it == droppedToKeptAlias.end()) {
19  // Normal case. Not an EDAlias.
20  if (itemSet.insert(branchID).second) {
21  append_(lookup, branchID, itemSet, droppedToKeptAlias);
22  }
23  } else {
24  // In this case, we want to put the EDAlias in the
25  // set of things to drop because that is what really
26  // needs to be dropped, but the recursive search in
27  // the lookup map must continue with the original BranchID
28  // because that is what the lookup map contains.
29  if (itemSet.insert(it->second).second) {
30  append_(lookup, branchID, itemSet, droppedToKeptAlias);
31  }
32  }
33  }
34  }
35  }
36 
37  void
39  childLookup_.clear();
40  }
41 
42  void
44  childLookup_.insert(std::make_pair(parent, BranchIDSet()));
45  }
46 
47  void
49  childLookup_[parent].insert(child);
50  }
51 
52  void
54  BranchIDSet& descendants,
55  std::map<BranchID, BranchID> const& droppedToKeptAlias) const {
56  descendants.insert(parent.branchID());
57  // A little tricky here. The child lookup map is filled with the
58  // BranchID of the original product even if there was an EDAlias
59  // and the EDAlias was saved and the original branch dropped.
60  append_(childLookup_, parent.originalBranchID(), descendants, droppedToKeptAlias);
61  }
62 }
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
HLT enums.
std::map< BranchID, BranchIDSet > map_t
BranchID const & originalBranchID() const