CMS 3D CMS Logo

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

#include <ProductResolvers.h>

Inheritance diagram for edm::SwitchBaseProductResolver:
edm::DataManagingOrAliasProductResolver edm::ProductResolverBase edm::SwitchAliasProductResolver edm::SwitchProducerProductResolver

Public Types

using ProductStatus = DataManagingProductResolver::ProductStatus
 

Public Member Functions

void connectTo (ProductResolverBase const &iOther, Principal const *iParentPrincipal) final
 
void setupUnscheduled (UnscheduledConfigurator const &iConfigure) final
 
 SwitchBaseProductResolver (std::shared_ptr< BranchDescription const > bd, DataManagingOrAliasProductResolver &realProduct)
 
- Public Member Functions inherited from edm::DataManagingOrAliasProductResolver
 DataManagingOrAliasProductResolver ()
 
- Public Member Functions inherited from edm::ProductResolverBase
BranchDescription const & branchDescription () const
 
std::string const & moduleLabel () const
 
ProductResolverBaseoperator= (ProductResolverBase const &)=delete
 
void prefetchAsync (WaitingTaskHolder waitTask, Principal const &principal, bool skipCurrentProcess, ServiceToken const &token, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
std::string const & processName () const
 
ProductID const & productID () const
 
std::string const & productInstanceName () const
 
ProductProvenance const * productProvenancePtr () const
 
bool productResolved () const
 
 ProductResolverBase ()
 
 ProductResolverBase (ProductResolverBase const &)=delete
 
TypeID productType () const
 
bool productUnavailable () const
 
bool productWasDeleted () const
 
bool productWasFetchedAndIsValid (bool iSkipCurrentProcess) const
 
Provenance const * provenance () const
 
bool provenanceAvailable () const
 
void resetBranchDescription (std::shared_ptr< BranchDescription const > bd)
 
void resetProductData ()
 
std::string const & resolvedModuleLabel () const
 
Resolution resolveProduct (Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
void retrieveAndMerge (Principal const &principal, MergeableRunProductMetadata const *mergeableRunProductMetadata) const
 
void setMergeableRunProductMetadata (MergeableRunProductMetadata const *mrpm)
 
void setProductID (ProductID const &pid)
 
void setProductProvenanceRetriever (ProductProvenanceRetriever const *provRetriever)
 
bool singleProduct () const
 
StableProvenance const * stableProvenance () const
 
void unsafe_deleteProduct () const
 
bool unscheduledWasNotRun () const
 
void write (std::ostream &os) const
 
virtual ~ProductResolverBase ()
 

Protected Member Functions

std::atomic< bool > & prefetchRequested () const
 
DataManagingOrAliasProductResolver const & realProduct () const
 
void resetProductData_ (bool deleteEarly) override
 
Resolution resolveProductImpl (Resolution) const
 
void unsafe_setWrapperAndProvenance () const
 
WaitingTaskListwaitingTasks () const
 
Workerworker () const
 

Private Member Functions

BranchDescription const & branchDescription_ () const final
 
ProductData const & getProductData () const final
 
ProductProvenance const * productProvenancePtr_ () const final
 
bool productResolved_ () const final
 
bool productWasDeleted_ () const final
 
bool productWasFetchedAndIsValid_ (bool iSkipCurrentProcess) const final
 
Provenance const * provenance_ () const final
 
void resetBranchDescription_ (std::shared_ptr< BranchDescription const > bd) final
 
std::string const & resolvedModuleLabel_ () const final
 
void setProductID_ (ProductID const &pid) final
 
void setProductProvenanceRetriever_ (ProductProvenanceRetriever const *provRetriever) final
 
bool singleProduct_ () const final
 

Private Attributes

ParentageID parentageID_
 
std::atomic< bool > prefetchRequested_
 
ProductData productData_
 
DataManagingOrAliasProductResolverrealProduct_
 
WaitingTaskList waitingTasks_
 
Workerworker_ = nullptr
 

Detailed Description

Definition at line 338 of file ProductResolvers.h.

Member Typedef Documentation

◆ ProductStatus

Definition at line 340 of file ProductResolvers.h.

Constructor & Destructor Documentation

◆ SwitchBaseProductResolver()

edm::SwitchBaseProductResolver::SwitchBaseProductResolver ( std::shared_ptr< BranchDescription const >  bd,
DataManagingOrAliasProductResolver realProduct 
)

Definition at line 696 of file ProductResolvers.cc.

References edm::ProductResolverBase::branchDescription(), edm::ParentageRegistry::insertMapped(), edm::ParentageRegistry::instance(), edm::BranchDescription::originalBranchID(), AlCaHLTBitMon_ParallelJobs::p, parentageID_, and realProduct().

699  // Parentage of this branch is always the same by construction, so we can compute the ID just "once" here.
700  Parentage p;
701  p.setParents(std::vector<BranchID>{realProduct.branchDescription().originalBranchID()});
702  parentageID_ = p.id();
704  }
std::atomic< bool > prefetchRequested_
DataManagingOrAliasProductResolver & realProduct_
DataManagingOrAliasProductResolver const & realProduct() const
BranchDescription const & branchDescription() const
static ParentageRegistry * instance()
bool insertMapped(value_type const &v)
def move(src, dest)
Definition: eostools.py:511
BranchID const & originalBranchID() const

Member Function Documentation

◆ branchDescription_()

BranchDescription const& edm::SwitchBaseProductResolver::branchDescription_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 362 of file ProductResolvers.h.

References edm::ProductData::branchDescription(), and edm::DataManagingProductResolver::productData_.

362  {
364  ;
365  }
std::shared_ptr< BranchDescription const > const & branchDescription() const
Definition: ProductData.h:29

◆ connectTo()

void edm::SwitchBaseProductResolver::connectTo ( ProductResolverBase const &  iOther,
Principal const *  iParentPrincipal 
)
finalvirtual

Implements edm::ProductResolverBase.

Definition at line 706 of file ProductResolvers.cc.

References Exception, and edm::errors::LogicError.

706  {
708  << "SwitchBaseProductResolver::connectTo() not implemented and should never be called.\n"
709  << "Contact a Framework developer\n";
710  }

◆ getProductData()

ProductData const& edm::SwitchBaseProductResolver::getProductData ( ) const
inlinefinalprivatevirtual

◆ prefetchRequested()

std::atomic<bool>& edm::SwitchBaseProductResolver::prefetchRequested ( ) const
inlineprotected

◆ productProvenancePtr_()

ProductProvenance const* edm::SwitchBaseProductResolver::productProvenancePtr_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 373 of file ProductResolvers.h.

References edm::Provenance::productProvenance(), and edm::ProductResolverBase::provenance().

373 { return provenance()->productProvenance(); }
ProductProvenance const * productProvenance() const
Definition: Provenance.cc:24
Provenance const * provenance() const

◆ productResolved_()

bool edm::SwitchBaseProductResolver::productResolved_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 722 of file ProductResolvers.cc.

722  {
723  // SwitchProducer will never put anything in the event, and
724  // "false" will make Event::commit_() to call putProduct() with
725  // null unique_ptr<WrapperBase> to signal that the produce() was
726  // run.
727  return false;
728  }

◆ productWasDeleted_()

bool edm::SwitchBaseProductResolver::productWasDeleted_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 358 of file ProductResolvers.h.

358 { return realProduct_.productWasDeleted(); }
DataManagingOrAliasProductResolver & realProduct_

◆ productWasFetchedAndIsValid_()

bool edm::SwitchBaseProductResolver::productWasFetchedAndIsValid_ ( bool  iSkipCurrentProcess) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 359 of file ProductResolvers.h.

359  {
360  return realProduct_.productWasFetchedAndIsValid(iSkipCurrentProcess);
361  }
DataManagingOrAliasProductResolver & realProduct_
bool productWasFetchedAndIsValid(bool iSkipCurrentProcess) const

◆ provenance_()

Provenance const* edm::SwitchBaseProductResolver::provenance_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 369 of file ProductResolvers.h.

References edm::DataManagingProductResolver::productData_, and edm::ProductData::provenance().

369 { return &productData_.provenance(); }
Provenance const & provenance() const
Definition: ProductData.h:33

◆ realProduct()

DataManagingOrAliasProductResolver const& edm::SwitchBaseProductResolver::realProduct ( ) const
inlineprotected

◆ resetBranchDescription_()

void edm::SwitchBaseProductResolver::resetBranchDescription_ ( std::shared_ptr< BranchDescription const >  bd)
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 366 of file ProductResolvers.h.

References edm::DataManagingProductResolver::productData_, and edm::ProductData::resetBranchDescription().

366  {
368  }
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
Definition: ProductData.cc:20

◆ resetProductData_()

void edm::SwitchBaseProductResolver::resetProductData_ ( bool  deleteEarly)
overrideprotectedvirtual

Implements edm::DataManagingOrAliasProductResolver.

Reimplemented in edm::SwitchProducerProductResolver.

Definition at line 739 of file ProductResolvers.cc.

References prefetchRequested_, productData_, realProduct_, edm::WaitingTaskList::reset(), edm::ProductData::resetProductData(), edm::DataManagingOrAliasProductResolver::resetProductData_(), and waitingTasks_.

Referenced by edm::SwitchProducerProductResolver::resetProductData_().

739  {
741  realProduct_.resetProductData_(deleteEarly);
742  if (not deleteEarly) {
743  prefetchRequested_ = false;
745  }
746  }
std::atomic< bool > prefetchRequested_
void reset()
Resets access to the resource so that added tasks will wait.
DataManagingOrAliasProductResolver & realProduct_
void resetProductData()
Definition: ProductData.h:52
void resetProductData_(bool deleteEarly) override=0

◆ resolvedModuleLabel_()

std::string const& edm::SwitchBaseProductResolver::resolvedModuleLabel_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 370 of file ProductResolvers.h.

References edm::ProductResolverBase::moduleLabel().

370 { return moduleLabel(); }
std::string const & moduleLabel() const

◆ resolveProductImpl()

ProductResolverBase::Resolution edm::SwitchBaseProductResolver::resolveProductImpl ( Resolution  res) const
protected

Definition at line 716 of file ProductResolvers.cc.

References productData_, and Resolution.

Referenced by edm::SwitchProducerProductResolver::resolveProduct_(), and edm::SwitchAliasProductResolver::resolveProduct_().

716  {
717  if (res.data() == nullptr)
718  return res;
719  return Resolution(&productData_);
720  }
Definition: Electron.h:6

◆ setProductID_()

void edm::SwitchBaseProductResolver::setProductID_ ( ProductID const &  pid)
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 734 of file ProductResolvers.cc.

References productData_, and edm::ProductData::setProductID().

734  {
735  // insertIntoSet is const, so let's exploit that to fake the getting of the "input" product
737  }
void setProductID(ProductID const &pid)
Definition: ProductData.h:58

◆ setProductProvenanceRetriever_()

void edm::SwitchBaseProductResolver::setProductProvenanceRetriever_ ( ProductProvenanceRetriever const *  provRetriever)
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 730 of file ProductResolvers.cc.

References productData_, and edm::ProductData::setProvenance().

730  {
731  productData_.setProvenance(provRetriever);
732  }
void setProvenance(ProductProvenanceLookup const *provRetriever)
Definition: ProductData.h:56

◆ setupUnscheduled()

void edm::SwitchBaseProductResolver::setupUnscheduled ( UnscheduledConfigurator const &  iConfigure)
finalvirtual

Reimplemented from edm::ProductResolverBase.

Definition at line 712 of file ProductResolvers.cc.

References edm::ProductResolverBase::branchDescription(), edm::UnscheduledConfigurator::findWorker(), edm::ProductResolverBase::moduleLabel(), and worker_.

712  {
713  worker_ = iConfigure.findWorker(branchDescription().moduleLabel());
714  }
std::string const & moduleLabel() const
BranchDescription const & branchDescription() const

◆ singleProduct_()

bool edm::SwitchBaseProductResolver::singleProduct_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 375 of file ProductResolvers.h.

375 { return true; }

◆ unsafe_setWrapperAndProvenance()

void edm::SwitchBaseProductResolver::unsafe_setWrapperAndProvenance ( ) const
protected

Definition at line 748 of file ProductResolvers.cc.

References edm::ProductResolverBase::branchDescription(), getProductData(), edm::ProductProvenanceLookup::insertIntoSet(), parentageID_, productData_, edm::ProductData::provenance(), realProduct(), edm::Provenance::store(), and edm::ProductData::unsafe_setWrapper().

Referenced by edm::SwitchProducerProductResolver::prefetchAsync_(), edm::SwitchAliasProductResolver::prefetchAsync_(), and edm::SwitchProducerProductResolver::putProduct().

748  {
749  // update provenance
750  productData_.provenance().store()->insertIntoSet(ProductProvenance(branchDescription().branchID(), parentageID_));
751  // Use the Wrapper of the pointed-to resolver, but the provenance of this resolver
752  productData_.unsafe_setWrapper(realProduct().getProductData().sharedConstWrapper());
753  }
ProductData const & getProductData() const final
Provenance const & provenance() const
Definition: ProductData.h:33
ProductProvenanceLookup const * store() const
Definition: Provenance.h:60
DataManagingOrAliasProductResolver const & realProduct() const
BranchDescription const & branchDescription() const
void unsafe_setWrapper(std::unique_ptr< WrapperBase > iValue) const
Definition: ProductData.cc:27
void insertIntoSet(ProductProvenance provenanceProduct) const

◆ waitingTasks()

WaitingTaskList& edm::SwitchBaseProductResolver::waitingTasks ( ) const
inlineprotected

◆ worker()

Worker* edm::SwitchBaseProductResolver::worker ( ) const
inlineprotected

Member Data Documentation

◆ parentageID_

ParentageID edm::SwitchBaseProductResolver::parentageID_
private

◆ prefetchRequested_

std::atomic<bool> edm::SwitchBaseProductResolver::prefetchRequested_
mutableprivate

Definition at line 383 of file ProductResolvers.h.

Referenced by resetProductData_().

◆ productData_

ProductData edm::SwitchBaseProductResolver::productData_
private

◆ realProduct_

DataManagingOrAliasProductResolver& edm::SwitchBaseProductResolver::realProduct_
private

Definition at line 378 of file ProductResolvers.h.

Referenced by resetProductData_().

◆ waitingTasks_

WaitingTaskList edm::SwitchBaseProductResolver::waitingTasks_
mutableprivate

Definition at line 382 of file ProductResolvers.h.

Referenced by resetProductData_().

◆ worker_

Worker* edm::SwitchBaseProductResolver::worker_ = nullptr
private

Definition at line 381 of file ProductResolvers.h.

Referenced by setupUnscheduled().