Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
art::BranchChildren Class Reference

#include <BranchChildren.h>

Public Types

using map_t = std::map< ProductID, ProductIDSet >
 

Public Member Functions

void clear ()
 
void insertEmpty (ProductID parent)
 
void insertChild (ProductID parent, ProductID child)
 
void appendToDescendants (ProductID parent, ProductIDSet &descendants) const
 

Private Types

using ProductIDSet = std::set< ProductID >
 

Private Member Functions

void append_ (map_t const &lookup, ProductID item, ProductIDSet &itemSet) const
 

Private Attributes

map_t childLookup_
 

Detailed Description

Definition at line 17 of file BranchChildren.h.

Member Typedef Documentation

Definition at line 38 of file BranchChildren.h.

using art::BranchChildren::ProductIDSet = std::set<ProductID>
private

Definition at line 19 of file BranchChildren.h.

Member Function Documentation

void art::BranchChildren::append_ ( map_t const &  lookup,
ProductID  item,
ProductIDSet itemSet 
) const
private

Definition at line 8 of file BranchChildren.cc.

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  }
void append_(map_t const &lookup, ProductID item, ProductIDSet &itemSet) const
std::map< ProductID, ProductIDSet > map_t
void art::BranchChildren::appendToDescendants ( ProductID  parent,
ProductIDSet descendants 
) const

Definition at line 43 of file BranchChildren.cc.

45  {
46  descendants.insert(parent);
47  append_(childLookup_, parent, descendants);
48  }
void append_(map_t const &lookup, ProductID item, ProductIDSet &itemSet) const
def parent(G, child, parent_type)
Definition: graph.py:67
void art::BranchChildren::clear ( )

Definition at line 25 of file BranchChildren.cc.

26  {
27  childLookup_.clear();
28  }
void art::BranchChildren::insertChild ( ProductID  parent,
ProductID  child 
)

Definition at line 37 of file BranchChildren.cc.

38  {
39  childLookup_[parent].insert(child);
40  }
def parent(G, child, parent_type)
Definition: graph.py:67
void art::BranchChildren::insertEmpty ( ProductID  parent)

Definition at line 31 of file BranchChildren.cc.

32  {
33  childLookup_.emplace(parent, ProductIDSet{});
34  }
def parent(G, child, parent_type)
Definition: graph.py:67
std::set< ProductID > ProductIDSet

Member Data Documentation

map_t art::BranchChildren::childLookup_
private

Definition at line 41 of file BranchChildren.h.


The documentation for this class was generated from the following files: