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 339 of file ProductResolvers.h.

Member Typedef Documentation

◆ ProductStatus

Definition at line 341 of file ProductResolvers.h.

Constructor & Destructor Documentation

◆ SwitchBaseProductResolver()

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

Definition at line 707 of file ProductResolvers.cc.

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

710  // Parentage of this branch is always the same by construction, so we can compute the ID just "once" here.
711  Parentage p;
712  p.setParents(std::vector<BranchID>{realProduct.branchDescription().originalBranchID()});
713  parentageID_ = p.id();
715  }
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 363 of file ProductResolvers.h.

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

363  {
365  ;
366  }
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 717 of file ProductResolvers.cc.

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

717  {
719  << "SwitchBaseProductResolver::connectTo() not implemented and should never be called.\n"
720  << "Contact a Framework developer\n";
721  }

◆ 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 374 of file ProductResolvers.h.

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

374 { 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 733 of file ProductResolvers.cc.

733  {
734  // SwitchProducer will never put anything in the event, and
735  // "false" will make Event::commit_() to call putProduct() with
736  // null unique_ptr<WrapperBase> to signal that the produce() was
737  // run.
738  return false;
739  }

◆ productWasDeleted_()

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

Implements edm::ProductResolverBase.

Definition at line 359 of file ProductResolvers.h.

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

◆ productWasFetchedAndIsValid_()

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

Implements edm::ProductResolverBase.

Definition at line 360 of file ProductResolvers.h.

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

◆ provenance_()

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

Implements edm::ProductResolverBase.

Definition at line 370 of file ProductResolvers.h.

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

370 { 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 367 of file ProductResolvers.h.

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

367  {
369  }
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 750 of file ProductResolvers.cc.

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

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

750  {
752  realProduct_.resetProductData_(deleteEarly);
753  if (not deleteEarly) {
754  prefetchRequested_ = false;
756  }
757  }
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 371 of file ProductResolvers.h.

References edm::ProductResolverBase::moduleLabel().

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

◆ resolveProductImpl()

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

Definition at line 727 of file ProductResolvers.cc.

References productData_, and Resolution.

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

727  {
728  if (res.data() == nullptr)
729  return res;
730  return Resolution(&productData_);
731  }
Definition: Electron.h:6

◆ setProductID_()

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

Implements edm::ProductResolverBase.

Definition at line 745 of file ProductResolvers.cc.

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

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

◆ setProductProvenanceRetriever_()

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

Implements edm::ProductResolverBase.

Definition at line 741 of file ProductResolvers.cc.

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

741  {
742  productData_.setProvenance(provRetriever);
743  }
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 723 of file ProductResolvers.cc.

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

723  {
724  worker_ = iConfigure.findWorker(branchDescription().moduleLabel());
725  }
std::string const & moduleLabel() const
BranchDescription const & branchDescription() const

◆ singleProduct_()

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

Implements edm::ProductResolverBase.

Definition at line 376 of file ProductResolvers.h.

376 { return true; }

◆ unsafe_setWrapperAndProvenance()

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

Definition at line 759 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().

759  {
760  // update provenance
761  productData_.provenance().store()->insertIntoSet(ProductProvenance(branchDescription().branchID(), parentageID_));
762  // Use the Wrapper of the pointed-to resolver, but the provenance of this resolver
763  productData_.unsafe_setWrapper(realProduct().getProductData().sharedConstWrapper());
764  }
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 384 of file ProductResolvers.h.

Referenced by resetProductData_().

◆ productData_

ProductData edm::SwitchBaseProductResolver::productData_
private

◆ realProduct_

DataManagingOrAliasProductResolver& edm::SwitchBaseProductResolver::realProduct_
private

Definition at line 379 of file ProductResolvers.h.

Referenced by resetProductData_().

◆ waitingTasks_

WaitingTaskList edm::SwitchBaseProductResolver::waitingTasks_
mutableprivate

Definition at line 383 of file ProductResolvers.h.

Referenced by resetProductData_().

◆ worker_

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

Definition at line 382 of file ProductResolvers.h.

Referenced by setupUnscheduled().