CMS 3D CMS Logo

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

#include <EarlyDeleteHelper.h>

Public Member Functions

void addedToPath ()
 
void appendIndex (unsigned int index)
 
unsigned int * begin ()
 
 EarlyDeleteHelper (unsigned int *iBeginIndexItr, unsigned int *iEndIndexItr, std::vector< BranchToCount > *iBranchCounts)
 
 EarlyDeleteHelper (const EarlyDeleteHelper &)
 
unsigned int * end ()
 
void moduleRan (EventPrincipal const &)
 
EarlyDeleteHelperoperator= (const EarlyDeleteHelper &)=default
 
void pathFinished (EventPrincipal const &)
 
void reset ()
 
void shiftIndexPointers (unsigned int iShift)
 

Private Attributes

unsigned int nPathsOn_
 
std::atomic< unsigned int > pathsLeftToComplete_
 
unsigned int * pBeginIndex_
 
std::vector< BranchToCount > * pBranchCounts_
 
unsigned int * pEndIndex_
 

Detailed Description

Definition at line 40 of file EarlyDeleteHelper.h.

Constructor & Destructor Documentation

EarlyDeleteHelper::EarlyDeleteHelper ( unsigned int *  iBeginIndexItr,
unsigned int *  iEndIndexItr,
std::vector< BranchToCount > *  iBranchCounts 
)

Definition at line 33 of file EarlyDeleteHelper.cc.

36  : pBeginIndex_(iBeginIndexItr),
37  pEndIndex_(iEndIndexItr),
38  pBranchCounts_(iBranchCounts),
40  nPathsOn_(0) {}
std::atomic< unsigned int > pathsLeftToComplete_
unsigned int * pBeginIndex_
std::vector< BranchToCount > * pBranchCounts_
EarlyDeleteHelper::EarlyDeleteHelper ( const EarlyDeleteHelper rhs)

Definition at line 42 of file EarlyDeleteHelper.cc.

47  nPathsOn_(rhs.nPathsOn_) {}
std::atomic< unsigned int > pathsLeftToComplete_
unsigned int * pBeginIndex_
std::vector< BranchToCount > * pBranchCounts_

Member Function Documentation

void edm::EarlyDeleteHelper::addedToPath ( )
inline

Definition at line 57 of file EarlyDeleteHelper.h.

57 { ++nPathsOn_; }
void EarlyDeleteHelper::appendIndex ( unsigned int  index)

Definition at line 94 of file EarlyDeleteHelper.cc.

References pEndIndex_.

94  {
95  *pEndIndex_ = iIndex;
96  ++pEndIndex_;
97 }
unsigned int* edm::EarlyDeleteHelper::begin ( void  )
inline

Definition at line 61 of file EarlyDeleteHelper.h.

61 { return pBeginIndex_; }
unsigned int * pBeginIndex_
unsigned int* edm::EarlyDeleteHelper::end ( void  )
inline

Definition at line 62 of file EarlyDeleteHelper.h.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

62 { return pEndIndex_; }
void EarlyDeleteHelper::moduleRan ( EventPrincipal const &  iEvent)

Definition at line 68 of file EarlyDeleteHelper.cc.

References KineDebug3::count(), edm::Principal::deleteProduct(), pathsLeftToComplete_, pBeginIndex_, and pEndIndex_.

Referenced by pathFinished().

68  {
70  for (auto it = pBeginIndex_; it != pEndIndex_; ++it) {
71  auto& count = (*pBranchCounts_)[*it];
72  assert(count.count > 0);
73  auto value = --(count.count);
74  if (value == 0) {
75  iEvent.deleteProduct(count.branch);
76  }
77  }
78 }
std::atomic< unsigned int > pathsLeftToComplete_
int iEvent
Definition: GenABIO.cc:224
unsigned int * pBeginIndex_
Definition: value.py:1
EarlyDeleteHelper& edm::EarlyDeleteHelper::operator= ( const EarlyDeleteHelper )
default
void EarlyDeleteHelper::pathFinished ( EventPrincipal const &  iEvent)

Definition at line 80 of file EarlyDeleteHelper.cc.

References moduleRan(), and pathsLeftToComplete_.

80  {
81  unsigned int value = pathsLeftToComplete_;
82  while (value > 0) {
83  if (pathsLeftToComplete_.compare_exchange_strong(value, value - 1)) {
84  //we were the thread that changed the value
85  if (value == 1) {
86  //we can never reach this module now so declare it as run
88  }
89  break;
90  }
91  }
92 }
std::atomic< unsigned int > pathsLeftToComplete_
int iEvent
Definition: GenABIO.cc:224
Definition: value.py:1
void moduleRan(EventPrincipal const &)
void edm::EarlyDeleteHelper::reset ( void  )
inline

Definition at line 54 of file EarlyDeleteHelper.h.

std::atomic< unsigned int > pathsLeftToComplete_
void EarlyDeleteHelper::shiftIndexPointers ( unsigned int  iShift)

Definition at line 99 of file EarlyDeleteHelper.cc.

References pBeginIndex_, and pEndIndex_.

99  {
100  pEndIndex_ -= iShift;
101  pBeginIndex_ -= iShift;
102 }
unsigned int * pBeginIndex_

Member Data Documentation

unsigned int edm::EarlyDeleteHelper::nPathsOn_
private

Definition at line 70 of file EarlyDeleteHelper.h.

std::atomic<unsigned int> edm::EarlyDeleteHelper::pathsLeftToComplete_
private

Definition at line 69 of file EarlyDeleteHelper.h.

Referenced by moduleRan(), and pathFinished().

unsigned int* edm::EarlyDeleteHelper::pBeginIndex_
private

Definition at line 66 of file EarlyDeleteHelper.h.

Referenced by moduleRan(), and shiftIndexPointers().

std::vector<BranchToCount>* edm::EarlyDeleteHelper::pBranchCounts_
private

Definition at line 68 of file EarlyDeleteHelper.h.

unsigned int* edm::EarlyDeleteHelper::pEndIndex_
private

Definition at line 67 of file EarlyDeleteHelper.h.

Referenced by appendIndex(), moduleRan(), and shiftIndexPointers().