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

Member Typedef Documentation

◆ ProductStatus

Definition at line 310 of file ProductResolvers.h.

Constructor & Destructor Documentation

◆ SwitchBaseProductResolver()

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

Definition at line 642 of file ProductResolvers.cc.

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

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

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

332  {
334  ;
335  }
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 652 of file ProductResolvers.cc.

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

652  {
654  << "SwitchBaseProductResolver::connectTo() not implemented and should never be called.\n"
655  << "Contact a Framework developer\n";
656  }

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

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

343 { 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 668 of file ProductResolvers.cc.

668  {
669  // SwitchProducer will never put anything in the event, and
670  // "false" will make Event::commit_() to call putProduct() with
671  // null unique_ptr<WrapperBase> to signal that the produce() was
672  // run.
673  return false;
674  }

◆ productWasDeleted_()

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

Implements edm::ProductResolverBase.

Definition at line 328 of file ProductResolvers.h.

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

◆ productWasFetchedAndIsValid_()

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

Implements edm::ProductResolverBase.

Definition at line 329 of file ProductResolvers.h.

329  {
330  return realProduct_.productWasFetchedAndIsValid(iSkipCurrentProcess);
331  }
DataManagingOrAliasProductResolver & realProduct_
bool productWasFetchedAndIsValid(bool iSkipCurrentProcess) const

◆ provenance_()

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

Implements edm::ProductResolverBase.

Definition at line 339 of file ProductResolvers.h.

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

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

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

336  {
338  }
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 685 of file ProductResolvers.cc.

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

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

685  {
687  realProduct_.resetProductData_(deleteEarly);
688  if (not deleteEarly) {
689  prefetchRequested_ = false;
691  }
692  }
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 340 of file ProductResolvers.h.

References edm::ProductResolverBase::moduleLabel().

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

◆ resolveProductImpl()

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

Definition at line 662 of file ProductResolvers.cc.

References productData_, and Resolution.

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

662  {
663  if (res.data() == nullptr)
664  return res;
665  return Resolution(&productData_);
666  }
Definition: Electron.h:6

◆ setProductID_()

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

Implements edm::ProductResolverBase.

Definition at line 680 of file ProductResolvers.cc.

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

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

◆ setProductProvenanceRetriever_()

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

Implements edm::ProductResolverBase.

Definition at line 676 of file ProductResolvers.cc.

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

676  {
677  productData_.setProvenance(provRetriever);
678  }
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 658 of file ProductResolvers.cc.

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

658  {
659  worker_ = iConfigure.findWorker(branchDescription().moduleLabel());
660  }
std::string const & moduleLabel() const
BranchDescription const & branchDescription() const

◆ singleProduct_()

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

Implements edm::ProductResolverBase.

Definition at line 345 of file ProductResolvers.h.

345 { return true; }

◆ unsafe_setWrapperAndProvenance()

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

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

694  {
695  // update provenance
696  productData_.provenance().store()->insertIntoSet(ProductProvenance(branchDescription().branchID(), parentageID_));
697  // Use the Wrapper of the pointed-to resolver, but the provenance of this resolver
698  productData_.unsafe_setWrapper(realProduct().getProductData().sharedConstWrapper());
699  }
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 353 of file ProductResolvers.h.

Referenced by resetProductData_().

◆ productData_

ProductData edm::SwitchBaseProductResolver::productData_
private

◆ realProduct_

DataManagingOrAliasProductResolver& edm::SwitchBaseProductResolver::realProduct_
private

Definition at line 348 of file ProductResolvers.h.

Referenced by resetProductData_().

◆ waitingTasks_

WaitingTaskList edm::SwitchBaseProductResolver::waitingTasks_
mutableprivate

Definition at line 352 of file ProductResolvers.h.

Referenced by resetProductData_().

◆ worker_

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

Definition at line 351 of file ProductResolvers.h.

Referenced by setupUnscheduled().