CMS 3D CMS Logo

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

#include <PrincipalCache.h>

Public Types

enum  ProcessBlockType { ProcessBlockType::New, ProcessBlockType::Input }
 

Public Member Functions

void adjustEventsToNewProductRegistry (std::shared_ptr< ProductRegistry const >)
 
void adjustIndexesAfterProductRegistryAddition ()
 
EventPrincipaleventPrincipal (unsigned int iStreamIndex) const
 
std::shared_ptr< LuminosityBlockPrincipalgetAvailableLumiPrincipalPtr ()
 
std::shared_ptr< RunPrincipalgetAvailableRunPrincipalPtr ()
 
ProcessBlockPrincipalinputProcessBlockPrincipal () const
 
void insert (std::unique_ptr< ProcessBlockPrincipal >)
 
void insert (std::unique_ptr< RunPrincipal >)
 
void insert (std::unique_ptr< LuminosityBlockPrincipal >)
 
void insert (std::shared_ptr< EventPrincipal >)
 
void insertForInput (std::unique_ptr< ProcessBlockPrincipal >)
 
 PrincipalCache ()
 
 PrincipalCache (PrincipalCache &&)=default
 
ProcessBlockPrincipalprocessBlockPrincipal () const
 
ProcessBlockPrincipalprocessBlockPrincipal (ProcessBlockType processBlockType) const
 
void setNumberOfConcurrentPrincipals (PreallocationConfiguration const &)
 
 ~PrincipalCache ()
 

Private Attributes

std::vector< std::shared_ptr< EventPrincipal > > eventPrincipals_
 
std::unique_ptr< ProcessBlockPrincipalinputProcessBlockPrincipal_
 
edm::ReusableObjectHolder< LuminosityBlockPrincipallumiHolder_
 
std::unique_ptr< ProcessBlockPrincipalprocessBlockPrincipal_
 
edm::ReusableObjectHolder< RunPrincipalrunHolder_
 

Detailed Description

Definition at line 28 of file PrincipalCache.h.

Member Enumeration Documentation

◆ ProcessBlockType

Enumerator
New 
Input 

Definition at line 37 of file PrincipalCache.h.

Constructor & Destructor Documentation

◆ PrincipalCache() [1/2]

edm::PrincipalCache::PrincipalCache ( )

Definition at line 13 of file PrincipalCache.cc.

13 {}

◆ ~PrincipalCache()

edm::PrincipalCache::~PrincipalCache ( )

Definition at line 15 of file PrincipalCache.cc.

15 {}

◆ PrincipalCache() [2/2]

edm::PrincipalCache::PrincipalCache ( PrincipalCache &&  )
default

Member Function Documentation

◆ adjustEventsToNewProductRegistry()

void edm::PrincipalCache::adjustEventsToNewProductRegistry ( std::shared_ptr< ProductRegistry const >  reg)

Definition at line 43 of file PrincipalCache.cc.

References edm::Principal::adjustIndexesAfterProductRegistryAddition(), edm::Principal::adjustToNewProductRegistry(), cms::cuda::assert(), eventPrincipal(), and eventPrincipals_.

Referenced by edm::test::TestSourceProcessor::openFile(), and edm::EventProcessor::readFile().

43  {
44  for (auto& eventPrincipal : eventPrincipals_) {
45  if (eventPrincipal) {
47  bool eventOK = eventPrincipal->adjustToNewProductRegistry(*reg);
48  assert(eventOK);
49  }
50  }
51  }
assert(be >=bs)
std::vector< std::shared_ptr< EventPrincipal > > eventPrincipals_
EventPrincipal & eventPrincipal(unsigned int iStreamIndex) const
bool adjustToNewProductRegistry(ProductRegistry const &reg)
Definition: Principal.cc:315
void adjustIndexesAfterProductRegistryAddition()
Definition: Principal.cc:877

◆ adjustIndexesAfterProductRegistryAddition()

void edm::PrincipalCache::adjustIndexesAfterProductRegistryAddition ( )

Definition at line 53 of file PrincipalCache.cc.

References lumiHolder_, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, and runHolder_.

Referenced by edm::test::TestSourceProcessor::openFile(), and edm::EventProcessor::readFile().

53  {
54  //Need to temporarily hold all the runs to clear out the runHolder_
55  std::vector<std::shared_ptr<RunPrincipal>> tempRunPrincipals;
56  while (auto p = runHolder_.tryToGet()) {
57  p->adjustIndexesAfterProductRegistryAddition();
58  tempRunPrincipals.emplace_back(std::move(p));
59  }
60  //Need to temporarily hold all the lumis to clear out the lumiHolder_
61  std::vector<std::shared_ptr<LuminosityBlockPrincipal>> tempLumiPrincipals;
62  while (auto p = lumiHolder_.tryToGet()) {
63  p->adjustIndexesAfterProductRegistryAddition();
64  tempLumiPrincipals.emplace_back(std::move(p));
65  }
66  }
edm::ReusableObjectHolder< RunPrincipal > runHolder_
edm::ReusableObjectHolder< LuminosityBlockPrincipal > lumiHolder_
def move(src, dest)
Definition: eostools.py:511

◆ eventPrincipal()

EventPrincipal& edm::PrincipalCache::eventPrincipal ( unsigned int  iStreamIndex) const
inline

◆ getAvailableLumiPrincipalPtr()

std::shared_ptr< LuminosityBlockPrincipal > edm::PrincipalCache::getAvailableLumiPrincipalPtr ( )

◆ getAvailableRunPrincipalPtr()

std::shared_ptr< RunPrincipal > edm::PrincipalCache::getAvailableRunPrincipalPtr ( )

Definition at line 17 of file PrincipalCache.cc.

References runHolder_.

Referenced by edm::test::TestProcessor::beginRun(), edm::SubProcess::doBeginRunAsync(), edm::test::TestSourceProcessor::readRun(), and edm::EventProcessor::readRun().

17 { return runHolder_.tryToGet(); }
edm::ReusableObjectHolder< RunPrincipal > runHolder_

◆ inputProcessBlockPrincipal()

ProcessBlockPrincipal& edm::PrincipalCache::inputProcessBlockPrincipal ( ) const
inline

◆ insert() [1/4]

void edm::PrincipalCache::insert ( std::unique_ptr< ProcessBlockPrincipal pb)

◆ insert() [2/4]

void edm::PrincipalCache::insert ( std::unique_ptr< RunPrincipal rp)

Definition at line 33 of file PrincipalCache.cc.

References eostools::move(), and runHolder_.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly().

33 { runHolder_.add(std::move(rp)); }
edm::ReusableObjectHolder< RunPrincipal > runHolder_
def move(src, dest)
Definition: eostools.py:511

◆ insert() [3/4]

void edm::PrincipalCache::insert ( std::unique_ptr< LuminosityBlockPrincipal lbp)

Definition at line 35 of file PrincipalCache.cc.

References lumiHolder_, and eostools::move().

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly().

35 { lumiHolder_.add(std::move(lbp)); }
edm::ReusableObjectHolder< LuminosityBlockPrincipal > lumiHolder_
def move(src, dest)
Definition: eostools.py:511

◆ insert() [4/4]

void edm::PrincipalCache::insert ( std::shared_ptr< EventPrincipal ep)

Definition at line 37 of file PrincipalCache.cc.

References cms::cuda::assert(), ecalHexDisplay_cfg::ep, and eventPrincipals_.

Referenced by SequenceTypes.Schedule::_replaceIfHeldDirectly().

37  {
38  unsigned int iStreamIndex = ep->streamID().value();
39  assert(iStreamIndex < eventPrincipals_.size());
40  eventPrincipals_[iStreamIndex] = ep;
41  }
assert(be >=bs)
std::vector< std::shared_ptr< EventPrincipal > > eventPrincipals_

◆ insertForInput()

void edm::PrincipalCache::insertForInput ( std::unique_ptr< ProcessBlockPrincipal pb)

Definition at line 29 of file PrincipalCache.cc.

References inputProcessBlockPrincipal_, and eostools::move().

Referenced by edm::EventProcessor::init(), and edm::SubProcess::SubProcess().

29  {
31  }
std::unique_ptr< ProcessBlockPrincipal > inputProcessBlockPrincipal_
def move(src, dest)
Definition: eostools.py:511

◆ processBlockPrincipal() [1/2]

ProcessBlockPrincipal& edm::PrincipalCache::processBlockPrincipal ( ) const
inline

◆ processBlockPrincipal() [2/2]

ProcessBlockPrincipal& edm::PrincipalCache::processBlockPrincipal ( ProcessBlockType  processBlockType) const
inline

Definition at line 38 of file PrincipalCache.h.

References Input, inputProcessBlockPrincipal_, and processBlockPrincipal_.

38  {
40  }
std::unique_ptr< ProcessBlockPrincipal > processBlockPrincipal_
std::unique_ptr< ProcessBlockPrincipal > inputProcessBlockPrincipal_

◆ setNumberOfConcurrentPrincipals()

void edm::PrincipalCache::setNumberOfConcurrentPrincipals ( PreallocationConfiguration const &  iConfig)

Definition at line 23 of file PrincipalCache.cc.

References eventPrincipals_, and edm::PreallocationConfiguration::numberOfStreams().

Referenced by edm::EventProcessor::init(), edm::SubProcess::SubProcess(), edm::test::TestProcessor::TestProcessor(), and edm::test::TestSourceProcessor::TestSourceProcessor().

23  {
24  eventPrincipals_.resize(iConfig.numberOfStreams());
25  }
std::vector< std::shared_ptr< EventPrincipal > > eventPrincipals_

Member Data Documentation

◆ eventPrincipals_

std::vector<std::shared_ptr<EventPrincipal> > edm::PrincipalCache::eventPrincipals_
private

◆ inputProcessBlockPrincipal_

std::unique_ptr<ProcessBlockPrincipal> edm::PrincipalCache::inputProcessBlockPrincipal_
private

◆ lumiHolder_

edm::ReusableObjectHolder<LuminosityBlockPrincipal> edm::PrincipalCache::lumiHolder_
private

◆ processBlockPrincipal_

std::unique_ptr<ProcessBlockPrincipal> edm::PrincipalCache::processBlockPrincipal_
private

Definition at line 59 of file PrincipalCache.h.

Referenced by insert(), and processBlockPrincipal().

◆ runHolder_

edm::ReusableObjectHolder<RunPrincipal> edm::PrincipalCache::runHolder_
private