CMS 3D CMS Logo

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

#include <BranchChildren.h>

Public Member Functions

void appendToDescendants (BranchDescription const &parent, BranchIDSet &descendants, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
 
map_t const & childLookup () const
 
void clear ()
 
void insertChild (BranchID parent, BranchID child)
 
void insertEmpty (BranchID parent)
 

Private Types

typedef std::set< BranchIDBranchIDSet
 
typedef std::map< BranchID, BranchIDSetmap_t
 

Private Member Functions

void append_ (map_t const &lookup, BranchID item, BranchIDSet &itemSet, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
 

Private Attributes

map_t childLookup_
 

Detailed Description

Definition at line 18 of file BranchChildren.h.

Member Typedef Documentation

typedef std::set<BranchID> edm::BranchChildren::BranchIDSet
private

Definition at line 20 of file BranchChildren.h.

typedef std::map<BranchID, BranchIDSet> edm::BranchChildren::map_t
private

Definition at line 21 of file BranchChildren.h.

Member Function Documentation

void edm::BranchChildren::append_ ( map_t const &  lookup,
BranchID  item,
BranchIDSet itemSet,
std::map< BranchID, BranchID > const &  droppedToKeptAlias 
) const
private

Definition at line 7 of file BranchChildren.cc.

Referenced by appendToDescendants().

10  {
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  }
void append_(map_t const &lookup, BranchID item, BranchIDSet &itemSet, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
std::set< BranchID > BranchIDSet
void edm::BranchChildren::appendToDescendants ( BranchDescription const &  parent,
BranchIDSet descendants,
std::map< BranchID, BranchID > const &  droppedToKeptAlias 
) const

Definition at line 53 of file BranchChildren.cc.

References append_(), edm::BranchDescription::branchID(), childLookup_, and edm::BranchDescription::originalBranchID().

55  {
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  }
void append_(map_t const &lookup, BranchID item, BranchIDSet &itemSet, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
map_t const& edm::BranchChildren::childLookup ( ) const
inline

Definition at line 42 of file BranchChildren.h.

References childLookup_.

Referenced by edm::PoolOutputModule::beginInputFile(), and edm::DaqProvenanceHelper::fixMetaData().

42  {
43  return childLookup_;
44  }
void edm::BranchChildren::clear ( void  )
void edm::BranchChildren::insertChild ( BranchID  parent,
BranchID  child 
)
void edm::BranchChildren::insertEmpty ( BranchID  parent)

Definition at line 43 of file BranchChildren.cc.

References childLookup_.

43  {
44  childLookup_.insert(std::make_pair(parent, BranchIDSet()));
45  }
std::set< BranchID > BranchIDSet

Member Data Documentation

map_t edm::BranchChildren::childLookup_
private

Definition at line 47 of file BranchChildren.h.

Referenced by appendToDescendants(), childLookup(), clear(), insertChild(), and insertEmpty().