LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
BranchChildren.cc
Go to the documentation of this file.
2 
3 #include <utility>
4 
5 namespace art {
6 
7  void
9  ProductID const item,
10  ProductIDSet& itemSet) const
11  {
12  auto const& items = const_cast<map_t&>(lookup)[item];
13  // For each parent(child)
14  for (auto const& i : items) {
15  // Insert the ProductID of the parents (children) into the set
16  // of ancestors (descendants). If the insert succeeds, append
17  // recursively.
18  if (itemSet.insert(i).second) {
19  append_(lookup, i, itemSet);
20  }
21  }
22  }
23 
24  void
26  {
27  childLookup_.clear();
28  }
29 
30  void
32  {
33  childLookup_.emplace(parent, ProductIDSet{});
34  }
35 
36  void
37  BranchChildren::insertChild(ProductID const parent, ProductID const child)
38  {
39  childLookup_[parent].insert(child);
40  }
41 
42  void
44  ProductIDSet& descendants) const
45  {
46  descendants.insert(parent);
47  append_(childLookup_, parent, descendants);
48  }
49 }
void appendToDescendants(ProductID parent, ProductIDSet &descendants) const
void insertEmpty(ProductID parent)
void insertChild(ProductID parent, ProductID child)
Definition: MVAAlg.h:12
void append_(map_t const &lookup, ProductID item, ProductIDSet &itemSet) const
std::map< ProductID, ProductIDSet > map_t
std::set< ProductID > ProductIDSet