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

◆ BranchIDSet

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

Definition at line 20 of file BranchChildren.h.

◆ map_t

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

Definition at line 21 of file BranchChildren.h.

Member Function Documentation

◆ append_()

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

Definition at line 6 of file BranchChildren.cc.

9  {
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  }

References B2GTnPMonitor_cfi::item.

Referenced by appendToDescendants().

◆ appendToDescendants()

void edm::BranchChildren::appendToDescendants ( BranchDescription const &  parent,
BranchIDSet descendants,
std::map< BranchID, BranchID > const &  droppedToKeptAlias 
) const

Definition at line 42 of file BranchChildren.cc.

44  {
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  }

References append_(), childLookup_, and class-composition::parent.

◆ childLookup()

map_t const& edm::BranchChildren::childLookup ( ) const
inline

Definition at line 41 of file BranchChildren.h.

41 { return childLookup_; }

References childLookup_.

Referenced by edm::DaqProvenanceHelper::fixMetaData().

◆ clear()

void edm::BranchChildren::clear ( void  )

Definition at line 36 of file BranchChildren.cc.

36 { childLookup_.clear(); }

References childLookup_.

Referenced by edm::PoolOutputModule::reallyCloseFile(), and BeautifulSoup.Tag::setString().

◆ insertChild()

void edm::BranchChildren::insertChild ( BranchID  parent,
BranchID  child 
)

◆ insertEmpty()

void edm::BranchChildren::insertEmpty ( BranchID  parent)

Definition at line 38 of file BranchChildren.cc.

38 { childLookup_.insert(std::make_pair(parent, BranchIDSet())); }

References childLookup_, and class-composition::parent.

Member Data Documentation

◆ childLookup_

map_t edm::BranchChildren::childLookup_
private

Definition at line 44 of file BranchChildren.h.

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

edm::BranchChildren::append_
void append_(map_t const &lookup, BranchID item, BranchIDSet &itemSet, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
Definition: BranchChildren.cc:6
edm::BranchChildren::BranchIDSet
std::set< BranchID > BranchIDSet
Definition: BranchChildren.h:20
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
child
Definition: simpleInheritance.h:11
class-composition.parent
parent
Definition: class-composition.py:88
edm::BranchChildren::childLookup_
map_t childLookup_
Definition: BranchChildren.h:44