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 &)=delete
 
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() [1/2]

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() [2/2]

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

◆ addedToPath()

void edm::EarlyDeleteHelper::addedToPath ( )
inline

Definition at line 57 of file EarlyDeleteHelper.h.

References nPathsOn_.

57 { ++nPathsOn_; }

◆ appendIndex()

void EarlyDeleteHelper::appendIndex ( unsigned int  index)

Definition at line 94 of file EarlyDeleteHelper.cc.

References pEndIndex_.

94  {
95  *pEndIndex_ = iIndex;
96  ++pEndIndex_;
97 }

◆ begin()

unsigned int* edm::EarlyDeleteHelper::begin ( void  )
inline

Definition at line 61 of file EarlyDeleteHelper.h.

References pBeginIndex_.

61 { return pBeginIndex_; }
unsigned int * pBeginIndex_

◆ end()

unsigned int* edm::EarlyDeleteHelper::end ( void  )
inline

Definition at line 62 of file EarlyDeleteHelper.h.

References pEndIndex_.

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

62 { return pEndIndex_; }

◆ moduleRan()

void EarlyDeleteHelper::moduleRan ( EventPrincipal const &  iEvent)

Definition at line 68 of file EarlyDeleteHelper.cc.

References cms::cuda::assert(), submitPVResolutionJobs::count, iEvent, 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_
assert(be >=bs)
int iEvent
Definition: GenABIO.cc:224
unsigned int * pBeginIndex_
Definition: value.py:1

◆ operator=()

EarlyDeleteHelper& edm::EarlyDeleteHelper::operator= ( const EarlyDeleteHelper )
delete

◆ pathFinished()

void EarlyDeleteHelper::pathFinished ( EventPrincipal const &  iEvent)

Definition at line 80 of file EarlyDeleteHelper.cc.

References iEvent, 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 &)

◆ reset()

void edm::EarlyDeleteHelper::reset ( void  )
inline

Definition at line 54 of file EarlyDeleteHelper.h.

References nPathsOn_, and pathsLeftToComplete_.

std::atomic< unsigned int > pathsLeftToComplete_

◆ shiftIndexPointers()

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

◆ nPathsOn_

unsigned int edm::EarlyDeleteHelper::nPathsOn_
private

Definition at line 70 of file EarlyDeleteHelper.h.

Referenced by addedToPath(), and reset().

◆ pathsLeftToComplete_

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

Definition at line 69 of file EarlyDeleteHelper.h.

Referenced by moduleRan(), pathFinished(), and reset().

◆ pBeginIndex_

unsigned int* edm::EarlyDeleteHelper::pBeginIndex_
private

Definition at line 66 of file EarlyDeleteHelper.h.

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

◆ pBranchCounts_

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

Definition at line 68 of file EarlyDeleteHelper.h.

◆ pEndIndex_

unsigned int* edm::EarlyDeleteHelper::pEndIndex_
private

Definition at line 67 of file EarlyDeleteHelper.h.

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