CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static 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 (WaitingTask *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 putOrMergeProduct (std::unique_ptr< WrapperBase > edp, MergeableRunProductMetadata const *mergeableRunProductMetadata=nullptr) const
 
void putProduct (std::unique_ptr< WrapperBase > edp) 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 setProcessHistory (ProcessHistory const &ph)
 
void setProvenance (ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)
 
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
 
Resolution resolveProductImpl (Resolution) const
 
ProductStatus status () const
 
WaitingTaskListwaitingTasks () const
 
Workerworker () const
 

Private Member Functions

BranchDescription const & branchDescription_ () 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 putOrMergeProduct_ (std::unique_ptr< WrapperBase > edp, MergeableRunProductMetadata const *mergeableRunProductMetadata) const final
 
void putProduct_ (std::unique_ptr< WrapperBase > edp) const final
 
void resetBranchDescription_ (std::shared_ptr< BranchDescription const > bd) final
 
void resetProductData_ (bool deleteEarly) final
 
std::string const & resolvedModuleLabel_ () const final
 
void setProcessHistory_ (ProcessHistory const &ph) final
 
void setProvenance_ (ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid) final
 
bool singleProduct_ () const final
 

Private Attributes

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

Static Private Attributes

static constexpr const ProductStatus defaultStatus_ = ProductStatus::NotPut
 

Detailed Description

Definition at line 265 of file ProductResolvers.h.

Member Typedef Documentation

Definition at line 267 of file ProductResolvers.h.

Constructor & Destructor Documentation

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

Definition at line 601 of file ProductResolvers.cc.

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

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

Member Function Documentation

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

Implements edm::ProductResolverBase.

Definition at line 291 of file ProductResolvers.h.

291  {
293  ;
294  }
std::shared_ptr< BranchDescription const > const & branchDescription() const
Definition: ProductData.h:28
void edm::SwitchBaseProductResolver::connectTo ( ProductResolverBase const &  iOther,
Principal const *  iParentPrincipal 
)
finalvirtual

Implements edm::ProductResolverBase.

Definition at line 611 of file ProductResolvers.cc.

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

611  {
613  << "SwitchBaseProductResolver::connectTo() not implemented and should never be called.\n"
614  << "Contact a Framework developer\n";
615  }
std::atomic<bool>& edm::SwitchBaseProductResolver::prefetchRequested ( ) const
inlineprotected
ProductProvenance const* edm::SwitchBaseProductResolver::productProvenancePtr_ ( ) const
inlinefinalprivatevirtual
bool edm::SwitchBaseProductResolver::productResolved_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 629 of file ProductResolvers.cc.

629  {
630  // SwitchProducer will never put anything in the event, and
631  // "false" will make Event::commit_() to call putProduct() with
632  // null unique_ptr<WrapperBase> to signal that the produce() was
633  // run.
634  return false;
635  }
bool edm::SwitchBaseProductResolver::productWasDeleted_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 284 of file ProductResolvers.h.

284 { return realProduct_.productWasDeleted(); }
DataManagingOrAliasProductResolver & realProduct_
bool edm::SwitchBaseProductResolver::productWasFetchedAndIsValid_ ( bool  iSkipCurrentProcess) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 285 of file ProductResolvers.h.

References edm::ProductResolverBase::putOrMergeProduct_(), and edm::ProductResolverBase::putProduct_().

285  {
286  return realProduct_.productWasFetchedAndIsValid(iSkipCurrentProcess);
287  }
DataManagingOrAliasProductResolver & realProduct_
bool productWasFetchedAndIsValid(bool iSkipCurrentProcess) const
Provenance const* edm::SwitchBaseProductResolver::provenance_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 298 of file ProductResolvers.h.

298 { return &productData_.provenance(); }
Provenance const & provenance() const
Definition: ProductData.h:32
void edm::SwitchBaseProductResolver::putOrMergeProduct_ ( std::unique_ptr< WrapperBase edp,
MergeableRunProductMetadata const *  mergeableRunProductMetadata 
) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 652 of file ProductResolvers.cc.

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

653  {
655  << "SwitchBaseProductResolver::putOrMergeProduct_(std::unique_ptr<WrapperBase> edp, "
656  "MergeableRunProductMetadata const*) not implemented and should never be called.\n"
657  << "Contact a Framework developer\n";
658  }
void edm::SwitchBaseProductResolver::putProduct_ ( std::unique_ptr< WrapperBase edp) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 637 of file ProductResolvers.cc.

References edm::ProductResolverBase::branchDescription(), edm::BranchDescription::branchName(), defaultStatus_, edm::WaitingTaskList::doneWaiting(), Exception, edm::errors::InsertFailure, prefetchRequested_, edm::DataManagingProductResolver::ResolveFailed, status_, and waitingTasks_.

637  {
638  if (status_ != defaultStatus_) {
640  << "Attempt to insert more than one product for a branch " << branchDescription().branchName()
641  << "This makes no sense for SwitchBaseProductResolver.\nContact a Framework developer";
642  }
643  // Let's use ResolveFailed to signal that produce() was called, as
644  // there is no real product in this resolver
646  bool expected = false;
647  if (prefetchRequested_.compare_exchange_strong(expected, true)) {
648  waitingTasks_.doneWaiting(std::exception_ptr());
649  }
650  }
static constexpr const ProductStatus defaultStatus_
std::string const & branchName() const
std::atomic< bool > prefetchRequested_
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
BranchDescription const & branchDescription() const
DataManagingOrAliasProductResolver const& edm::SwitchBaseProductResolver::realProduct ( ) const
inlineprotected
void edm::SwitchBaseProductResolver::resetBranchDescription_ ( std::shared_ptr< BranchDescription const >  bd)
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 295 of file ProductResolvers.h.

295  {
297  }
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
Definition: ProductData.cc:29
void edm::SwitchBaseProductResolver::resetProductData_ ( bool  deleteEarly)
finalprivatevirtual

Implements edm::DataManagingOrAliasProductResolver.

Definition at line 668 of file ProductResolvers.cc.

References defaultStatus_, productData_, realProduct_, edm::ProductData::resetProductData(), edm::DataManagingOrAliasProductResolver::resetProductData_(), and status_.

668  {
670  realProduct_.resetProductData_(deleteEarly);
671  if (not deleteEarly) {
673  }
674  }
static constexpr const ProductStatus defaultStatus_
DataManagingOrAliasProductResolver & realProduct_
void resetProductData()
Definition: ProductData.h:53
void resetProductData_(bool deleteEarly) override=0
std::string const& edm::SwitchBaseProductResolver::resolvedModuleLabel_ ( ) const
inlinefinalprivatevirtual
ProductResolverBase::Resolution edm::SwitchBaseProductResolver::resolveProductImpl ( Resolution  res) const
protected

Definition at line 621 of file ProductResolvers.cc.

References edm::ProductResolverBase::Resolution::data(), productData_, Resolution, edm::ProductData::sharedConstWrapper(), and edm::ProductData::unsafe_setWrapper().

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

621  {
622  if (res.data() == nullptr)
623  return res;
624  // Use the Wrapper of the pointed-to resolver, but the provenance of this resolver
625  productData_.unsafe_setWrapper(res.data()->sharedConstWrapper());
626  return Resolution(&productData_);
627  }
Definition: Electron.h:6
void unsafe_setWrapper(std::unique_ptr< WrapperBase > iValue) const
Definition: ProductData.cc:38
void edm::SwitchBaseProductResolver::setProcessHistory_ ( ProcessHistory const &  ph)
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 303 of file ProductResolvers.h.

void setProcessHistory(ProcessHistory const &ph)
Definition: ProductData.h:61
void edm::SwitchBaseProductResolver::setProvenance_ ( ProductProvenanceRetriever const *  provRetriever,
ProcessHistory const &  ph,
ProductID const &  pid 
)
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 660 of file ProductResolvers.cc.

References edm::ProductResolverBase::branchDescription(), edm::ProductProvenanceRetriever::insertIntoSet(), parentageID_, productData_, and edm::ProductData::setProvenance().

662  {
663  // insertIntoSet is const, so let's exploit that to fake the getting of the "input" product
664  provRetriever->insertIntoSet(ProductProvenance(branchDescription().branchID(), parentageID_));
665  productData_.setProvenance(provRetriever, ph, pid);
666  }
void setProvenance(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)
Definition: ProductData.h:65
BranchDescription const & branchDescription() const
void edm::SwitchBaseProductResolver::setupUnscheduled ( UnscheduledConfigurator const &  iConfigure)
finalvirtual

Reimplemented from edm::ProductResolverBase.

Definition at line 617 of file ProductResolvers.cc.

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

617  {
618  worker_ = iConfigure.findWorker(branchDescription().moduleLabel());
619  }
BranchDescription const & branchDescription() const
std::string const & moduleLabel() const
bool edm::SwitchBaseProductResolver::singleProduct_ ( ) const
inlinefinalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 306 of file ProductResolvers.h.

306 { return true; }
ProductStatus edm::SwitchBaseProductResolver::status ( void  ) const
inlineprotected
WaitingTaskList& edm::SwitchBaseProductResolver::waitingTasks ( ) const
inlineprotected

Definition at line 276 of file ProductResolvers.h.

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

276 { return waitingTasks_; }
Worker* edm::SwitchBaseProductResolver::worker ( ) const
inlineprotected

Member Data Documentation

constexpr const ProductStatus edm::SwitchBaseProductResolver::defaultStatus_ = ProductStatus::NotPut
staticprivate

Definition at line 308 of file ProductResolvers.h.

Referenced by putProduct_(), and resetProductData_().

ParentageID edm::SwitchBaseProductResolver::parentageID_
private

Definition at line 318 of file ProductResolvers.h.

Referenced by setProvenance_(), and SwitchBaseProductResolver().

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

Definition at line 316 of file ProductResolvers.h.

Referenced by putProduct_().

ProductData edm::SwitchBaseProductResolver::productData_
private

Definition at line 313 of file ProductResolvers.h.

Referenced by resetProductData_(), resolveProductImpl(), and setProvenance_().

DataManagingOrAliasProductResolver& edm::SwitchBaseProductResolver::realProduct_
private

Definition at line 311 of file ProductResolvers.h.

Referenced by resetProductData_().

ProductStatus edm::SwitchBaseProductResolver::status_
mutableprivate

Definition at line 320 of file ProductResolvers.h.

Referenced by putProduct_(), and resetProductData_().

WaitingTaskList edm::SwitchBaseProductResolver::waitingTasks_
mutableprivate

Definition at line 315 of file ProductResolvers.h.

Referenced by putProduct_().

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

Definition at line 314 of file ProductResolvers.h.

Referenced by setupUnscheduled().