CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/FWCore/Framework/src/EarlyDeleteHelper.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Framework
00004 // Class  :     EarlyDeleteHelper
00005 // 
00006 // Implementation:
00007 //     [Notes on implementation]
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Mon Feb  6 16:17:10 CST 2012
00011 // $Id: EarlyDeleteHelper.cc,v 1.1 2012/02/09 22:12:56 chrjones Exp $
00012 //
00013 
00014 // system include files
00015 
00016 // user include files
00017 #include "DataFormats/Provenance/interface/BranchID.h"
00018 #include "FWCore/Framework/interface/EventPrincipal.h"
00019 
00020 #include "FWCore/Framework/src/EarlyDeleteHelper.h"
00021 
00022 using namespace edm;
00023 //
00024 // constants, enums and typedefs
00025 //
00026 
00027 //
00028 // static data member definitions
00029 //
00030 
00031 //
00032 // constructors and destructor
00033 //
00034 EarlyDeleteHelper::EarlyDeleteHelper(unsigned int* iBeginIndexItr,
00035                                      unsigned int* iEndIndexItr,
00036                                      std::vector<std::pair<edm::BranchID,unsigned int>>* iBranchCounts):
00037 pBeginIndex_(iBeginIndexItr),
00038 pEndIndex_(iEndIndexItr),
00039 pBranchCounts_(iBranchCounts),
00040 pathsLeftToComplete_(0),
00041 nPathsOn_(0)
00042 {
00043 }
00044 
00045 // EarlyDeleteHelper::EarlyDeleteHelper(const EarlyDeleteHelper& rhs)
00046 // {
00047 //    // do actual copying here;
00048 // }
00049 
00050 //EarlyDeleteHelper::~EarlyDeleteHelper()
00051 //{
00052 //}
00053 
00054 //
00055 // assignment operators
00056 //
00057 // const EarlyDeleteHelper& EarlyDeleteHelper::operator=(const EarlyDeleteHelper& rhs)
00058 // {
00059 //   //An exception safe implementation is
00060 //   EarlyDeleteHelper temp(rhs);
00061 //   swap(rhs);
00062 //
00063 //   return *this;
00064 // }
00065 
00066 //
00067 // member functions
00068 //
00069 void 
00070 EarlyDeleteHelper::moduleRan(EventPrincipal& iEvent) {
00071   pathsLeftToComplete_=0;
00072   for(auto it = pBeginIndex_; it != pEndIndex_;++it) {
00073     auto& count = (*pBranchCounts_)[*it];
00074     assert(count.second>0);
00075     --(count.second);
00076     if(count.second==0) {
00077       iEvent.deleteProduct(count.first);
00078     }
00079   }
00080 }
00081 
00082 void 
00083 EarlyDeleteHelper::pathFinished(EventPrincipal& iEvent) {
00084   if(pathsLeftToComplete_>0 && --pathsLeftToComplete_ == 0) {
00085     //we can never reach this module now so declare it as run
00086     moduleRan(iEvent);
00087   }
00088 }
00089 
00090 void
00091 EarlyDeleteHelper::appendIndex(unsigned int iIndex) {
00092   *pEndIndex_=iIndex;
00093   ++pEndIndex_;
00094 }
00095 
00096 void
00097 EarlyDeleteHelper::shiftIndexPointers(unsigned int iShift) {
00098   pEndIndex_ -=iShift;
00099   pBeginIndex_ -=iShift;
00100 }
00101 
00102 //
00103 // const member functions
00104 //
00105 
00106 //
00107 // static member functions
00108 //