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 45 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.

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

Definition at line 44 of file EarlyDeleteHelper.cc.

44  :
50 {
51 
52 }
std::atomic< unsigned int > pathsLeftToComplete_
unsigned int * pBeginIndex_
std::vector< BranchToCount > * pBranchCounts_

Member Function Documentation

void edm::EarlyDeleteHelper::addedToPath ( )
inline

Definition at line 64 of file EarlyDeleteHelper.h.

References diffTreeTool::index.

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

Definition at line 102 of file EarlyDeleteHelper.cc.

References pEndIndex_.

102  {
103  *pEndIndex_=iIndex;
104  ++pEndIndex_;
105 }
unsigned int* edm::EarlyDeleteHelper::begin ( void  )
inline

Definition at line 68 of file EarlyDeleteHelper.h.

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

Definition at line 69 of file EarlyDeleteHelper.h.

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

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

Definition at line 74 of file EarlyDeleteHelper.cc.

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

Referenced by pathFinished().

74  {
76  for(auto it = pBeginIndex_; it != pEndIndex_;++it) {
77  auto& count = (*pBranchCounts_)[*it];
78  assert(count.count>0);
79  auto value = --(count.count);
80  if(value==0) {
81  iEvent.deleteProduct(count.branch);
82  }
83  }
84 }
std::atomic< unsigned int > pathsLeftToComplete_
int iEvent
Definition: GenABIO.cc:230
unsigned int * pBeginIndex_
Definition: value.py:1
EarlyDeleteHelper& edm::EarlyDeleteHelper::operator= ( const EarlyDeleteHelper )
default
void EarlyDeleteHelper::pathFinished ( EventPrincipal const &  iEvent)

Definition at line 87 of file EarlyDeleteHelper.cc.

References moduleRan(), and pathsLeftToComplete_.

87  {
88  unsigned int value = pathsLeftToComplete_;
89  while(value > 0) {
90  if( pathsLeftToComplete_.compare_exchange_strong(value, value-1)) {
91  //we were the thread that changed the value
92  if( value == 1) {
93  //we can never reach this module now so declare it as run
95  }
96  break;
97  }
98  }
99 }
std::atomic< unsigned int > pathsLeftToComplete_
int iEvent
Definition: GenABIO.cc:230
Definition: value.py:1
void moduleRan(EventPrincipal const &)
void edm::EarlyDeleteHelper::reset ( void  )
inline

Definition at line 61 of file EarlyDeleteHelper.h.

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

Definition at line 108 of file EarlyDeleteHelper.cc.

References pBeginIndex_, and pEndIndex_.

108  {
109  pEndIndex_ -=iShift;
110  pBeginIndex_ -=iShift;
111 }
unsigned int * pBeginIndex_

Member Data Documentation

unsigned int edm::EarlyDeleteHelper::nPathsOn_
private

Definition at line 78 of file EarlyDeleteHelper.h.

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

Definition at line 77 of file EarlyDeleteHelper.h.

Referenced by moduleRan(), and pathFinished().

unsigned int* edm::EarlyDeleteHelper::pBeginIndex_
private

Definition at line 74 of file EarlyDeleteHelper.h.

Referenced by moduleRan(), and shiftIndexPointers().

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

Definition at line 76 of file EarlyDeleteHelper.h.

unsigned int* edm::EarlyDeleteHelper::pEndIndex_
private

Definition at line 75 of file EarlyDeleteHelper.h.

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