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 noexcept
 
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 705 of file ProductResolvers.cc.

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

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

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

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

◆ getProductData()

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

◆ prefetchRequested()

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

Definition at line 353 of file ProductResolvers.h.

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

353 { return prefetchRequested_; }
std::atomic< bool > prefetchRequested_

◆ 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 731 of file ProductResolvers.cc.

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

◆ 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 748 of file ProductResolvers.cc.

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

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

748  {
750  realProduct_.resetProductData_(deleteEarly);
751  if (not deleteEarly) {
752  prefetchRequested_ = false;
754  }
755  }
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 725 of file ProductResolvers.cc.

References productData_, and Resolution.

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

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

◆ setProductID_()

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

Implements edm::ProductResolverBase.

Definition at line 743 of file ProductResolvers.cc.

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

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

◆ setProductProvenanceRetriever_()

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

Implements edm::ProductResolverBase.

Definition at line 739 of file ProductResolvers.cc.

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

739  {
740  productData_.setProvenance(provRetriever);
741  }
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 721 of file ProductResolvers.cc.

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

721  {
722  worker_ = iConfigure.findWorker(branchDescription().moduleLabel());
723  }
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 757 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::putProduct().

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

Definition at line 350 of file ProductResolvers.h.

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

350 { return waitingTasks_; }

◆ worker()

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

Definition at line 351 of file ProductResolvers.h.

351 { return worker_; }

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().