CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::DataManagingProductResolver Class Referenceabstract

#include <ProductResolvers.h>

Inheritance diagram for edm::DataManagingProductResolver:
edm::DataManagingOrAliasProductResolver edm::ProductResolverBase edm::MergeableInputProductResolver edm::ProducedProductResolver edm::DelayedReaderInputProductResolver edm::PutOnReadInputProductResolver edm::PuttableProductResolver edm::TransformingProductResolver edm::UnscheduledProductResolver

Public Types

enum  ProductStatus {
  ProductStatus::ProductSet, ProductStatus::NotPut, ProductStatus::ResolveFailed, ProductStatus::ResolveNotRun,
  ProductStatus::ProductDeleted
}
 

Public Member Functions

void connectTo (ProductResolverBase const &, Principal const *) final
 
 DataManagingProductResolver (std::shared_ptr< BranchDescription const > bd, ProductStatus iDefaultStatus)
 
void resetProductData_ (bool deleteEarly) override
 
void resetStatus ()
 
template<bool callResolver, typename FUNC >
ProductResolverBase::Resolution resolveProductImpl (FUNC resolver) const
 
- 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)
 
virtual void setupUnscheduled (UnscheduledConfigurator const &)
 
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

void checkType (WrapperBase const &prod) const
 
ProductStatus defaultStatus () const
 
ProductData const & getProductData () const final
 
template<bool callResolver, typename FUNC >
Resolution resolveProductImpl (FUNC resolver) const
 
void setFailedStatus () const
 
void setMergeableRunProductMetadataInProductData (MergeableRunProductMetadata const *)
 
void setProduct (std::unique_ptr< WrapperBase > edp) const
 
void setProduct (std::shared_ptr< WrapperBase > edp) const
 
ProductStatus status () const
 

Private Member Functions

BranchDescription const & branchDescription_ () const final
 
virtual bool isFromCurrentProcess () const =0
 
ProductProvenance const * productProvenancePtr_ () const final
 
bool productResolved_ () const final
 
bool productUnavailable_ () 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
 
void throwProductDeletedException () const
 

Private Attributes

ProductStatus const defaultStatus_
 
ProductData productData_
 
std::atomic< ProductStatustheStatus_
 

Detailed Description

Definition at line 50 of file ProductResolvers.h.

Member Enumeration Documentation

◆ ProductStatus

Enumerator
ProductSet 
NotPut 
ResolveFailed 
ResolveNotRun 
ProductDeleted 

Definition at line 52 of file ProductResolvers.h.

52 { ProductSet, NotPut, ResolveFailed, ResolveNotRun, ProductDeleted };

Constructor & Destructor Documentation

◆ DataManagingProductResolver()

edm::DataManagingProductResolver::DataManagingProductResolver ( std::shared_ptr< BranchDescription const >  bd,
ProductStatus  iDefaultStatus 
)
inline

Definition at line 54 of file ProductResolvers.h.

Member Function Documentation

◆ branchDescription_()

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

Implements edm::ProductResolverBase.

Definition at line 89 of file ProductResolvers.h.

References edm::ProductData::branchDescription(), and getProductData().

89 { return *getProductData().branchDescription(); }
ProductData const & getProductData() const final
std::shared_ptr< BranchDescription const > const & branchDescription() const
Definition: ProductData.h:29

◆ checkType()

void edm::DataManagingProductResolver::checkType ( WrapperBase const &  prod) const
protected

Definition at line 603 of file ProductResolvers.cc.

References edm::ProductResolverBase::branchDescription(), edm::BranchDescription::branchName(), edm::BranchDescription::className(), edm::errors::EventCorruption, Exception, dumpMFGeometry_cfg::prod, edm::TypeWithDict::unvalidatedTypeInfo(), and edm::BranchDescription::unwrappedType().

Referenced by edm::MergeableInputProductResolver::mergeProduct(), and setProduct().

603  {
604  // Check if the types match.
605  TypeID typeID(prod.dynamicTypeInfo());
606  if (typeID != TypeID{branchDescription().unwrappedType().unvalidatedTypeInfo()}) {
607  // Types do not match.
609  << "Product on branch " << branchDescription().branchName() << " is of wrong type.\n"
610  << "It is supposed to be of type " << branchDescription().className() << ".\n"
611  << "It is actually of type " << typeID.className() << ".\n";
612  }
613  }
TypeWithDict const & unwrappedType() const
std::string const & className() const
std::string const & branchName() const
std::type_info const & unvalidatedTypeInfo() const
Definition: TypeWithDict.h:81
BranchDescription const & branchDescription() const

◆ connectTo()

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

Implements edm::ProductResolverBase.

Definition at line 601 of file ProductResolvers.cc.

References cms::cuda::assert().

601 { assert(false); }
assert(be >=bs)

◆ defaultStatus()

ProductStatus edm::DataManagingProductResolver::defaultStatus ( ) const
inlineprotected

◆ getProductData()

ProductData const& edm::DataManagingProductResolver::getProductData ( ) const
inlinefinalprotectedvirtual

◆ isFromCurrentProcess()

virtual bool edm::DataManagingProductResolver::isFromCurrentProcess ( ) const
privatepure virtual

◆ productProvenancePtr_()

ProductProvenance const * edm::DataManagingProductResolver::productProvenancePtr_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 676 of file ProductResolvers.cc.

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

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

◆ productResolved_()

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

Implements edm::ProductResolverBase.

Definition at line 645 of file ProductResolvers.cc.

References defaultStatus(), or, ProductDeleted, alignCSCRings::s, and status().

645  {
646  auto s = status();
647  return (s != defaultStatus()) or (s == ProductStatus::ProductDeleted);
648  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
ProductStatus defaultStatus() const

◆ productUnavailable_()

bool edm::DataManagingProductResolver::productUnavailable_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 637 of file ProductResolvers.cc.

References getProductData(), edm::WrapperBase::isPresent(), ProductSet, ResolveNotRun, status(), and edm::ProductData::wrapper().

637  {
638  auto presentStatus = status();
639  if (presentStatus == ProductStatus::ProductSet) {
640  return !(getProductData().wrapper()->isPresent());
641  }
642  return presentStatus != ProductStatus::ResolveNotRun;
643  }
ProductData const & getProductData() const final
WrapperBase const * wrapper() const
Definition: ProductData.h:35
bool isPresent() const
Definition: WrapperBase.h:30

◆ productWasDeleted_()

bool edm::DataManagingProductResolver::productWasDeleted_ ( ) const
finalprivatevirtual

◆ productWasFetchedAndIsValid_()

bool edm::DataManagingProductResolver::productWasFetchedAndIsValid_ ( bool  iSkipCurrentProcess) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 653 of file ProductResolvers.cc.

References getProductData(), isFromCurrentProcess(), ProductSet, status(), and wrapper.

653  {
654  if (iSkipCurrentProcess and isFromCurrentProcess()) {
655  return false;
656  }
658  if (getProductData().wrapper()->isPresent()) {
659  return true;
660  }
661  }
662  return false;
663  }
ProductData const & getProductData() const final
virtual bool isFromCurrentProcess() const =0
static HepMC::HEPEVT_Wrapper wrapper

◆ provenance_()

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

Implements edm::ProductResolverBase.

Definition at line 93 of file ProductResolvers.h.

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

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

◆ resetBranchDescription_()

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

Implements edm::ProductResolverBase.

Definition at line 90 of file ProductResolvers.h.

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

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

◆ resetProductData_()

void edm::DataManagingProductResolver::resetProductData_ ( bool  deleteEarly)
overridevirtual

◆ resetStatus()

void edm::DataManagingProductResolver::resetStatus ( )
inline

Definition at line 62 of file ProductResolvers.h.

References defaultStatus_, and theStatus_.

Referenced by resetProductData_().

std::atomic< ProductStatus > theStatus_

◆ resolvedModuleLabel_()

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

Implements edm::ProductResolverBase.

Definition at line 95 of file ProductResolvers.h.

References edm::ProductResolverBase::moduleLabel().

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

◆ resolveProductImpl() [1/2]

template<bool callResolver, typename FUNC >
ProductResolverBase::Resolution edm::DataManagingProductResolver::resolveProductImpl ( FUNC  resolver) const

Definition at line 47 of file ProductResolvers.cc.

References getProductData(), ProductSet, edm::ProductResolverBase::productWasDeleted(), Resolution, ResolveNotRun, setFailedStatus(), status(), and throwProductDeletedException().

47  {
48  if (productWasDeleted()) {
50  }
51  auto presentStatus = status();
52 
53  if (callResolver && presentStatus == ProductStatus::ResolveNotRun) {
54  //if resolver fails because of exception or not setting product
55  // make sure the status goes to failed
56  auto failedStatusSetter = [this](ProductStatus* iPresentStatus) {
57  if (this->status() == ProductStatus::ResolveNotRun) {
58  this->setFailedStatus();
59  }
60  *iPresentStatus = this->status();
61  };
62  std::unique_ptr<ProductStatus, decltype(failedStatusSetter)> failedStatusGuard(&presentStatus,
63  failedStatusSetter);
64 
65  //If successful, this will call setProduct
66  resolver();
67  }
68 
69  if (presentStatus == ProductStatus::ProductSet) {
70  auto pd = &getProductData();
71  if (pd->wrapper()->isPresent()) {
72  return Resolution(pd);
73  }
74  }
75 
76  return Resolution(nullptr);
77  }
ProductData const & getProductData() const final

◆ resolveProductImpl() [2/2]

template<bool callResolver, typename FUNC >
Resolution edm::DataManagingProductResolver::resolveProductImpl ( FUNC  resolver) const
protected

◆ setFailedStatus()

void edm::DataManagingProductResolver::setFailedStatus ( ) const
inlineprotected

◆ setMergeableRunProductMetadataInProductData()

void edm::DataManagingProductResolver::setMergeableRunProductMetadataInProductData ( MergeableRunProductMetadata const *  mrpm)
protected

Definition at line 671 of file ProductResolvers.cc.

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

Referenced by edm::DelayedReaderInputProductResolver::setMergeableRunProductMetadata_().

672  {
674  }
void setMergeableRunProductMetadata(MergeableRunProductMetadataBase const *mrpm)
Definition: ProductData.h:60

◆ setProduct() [1/2]

void edm::DataManagingProductResolver::setProduct ( std::unique_ptr< WrapperBase edp) const
protected

◆ setProduct() [2/2]

void edm::DataManagingProductResolver::setProduct ( std::shared_ptr< WrapperBase edp) const
protected

Definition at line 624 of file ProductResolvers.cc.

References checkType(), eostools::move(), productData_, ProductSet, setFailedStatus(), theStatus_, and edm::ProductData::unsafe_setWrapper().

624  {
625  if (edp) {
626  checkType(*edp);
629  } else {
630  setFailedStatus();
631  }
632  }
void checkType(WrapperBase const &prod) const
std::atomic< ProductStatus > theStatus_
void unsafe_setWrapper(std::unique_ptr< WrapperBase > iValue) const
Definition: ProductData.cc:27
def move(src, dest)
Definition: eostools.py:511

◆ setProductID_()

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

Implements edm::ProductResolverBase.

Definition at line 669 of file ProductResolvers.cc.

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

669 { productData_.setProductID(pid); }
void setProductID(ProductID const &pid)
Definition: ProductData.h:58

◆ setProductProvenanceRetriever_()

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

Implements edm::ProductResolverBase.

Definition at line 665 of file ProductResolvers.cc.

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

665  {
666  productData_.setProvenance(provRetriever);
667  }
void setProvenance(ProductProvenanceLookup const *provRetriever)
Definition: ProductData.h:56

◆ singleProduct_()

bool edm::DataManagingProductResolver::singleProduct_ ( ) const
finalprivatevirtual

Implements edm::ProductResolverBase.

Definition at line 691 of file ProductResolvers.cc.

691 { return true; }

◆ status()

ProductStatus edm::DataManagingProductResolver::status ( void  ) const
inlineprotected

◆ throwProductDeletedException()

void edm::DataManagingProductResolver::throwProductDeletedException ( ) const
private

Definition at line 33 of file ProductResolvers.cc.

References edm::ProductResolverBase::branchDescription(), cppFunctionSkipper::exception, edm::ProductResolverBase::moduleLabel(), edm::ProductResolverBase::processName(), edm::ProductResolverBase::productInstanceName(), and edm::BranchDescription::unwrappedTypeID().

Referenced by resolveProductImpl().

33  {
35  exception << "DataManagingProductResolver::resolveProduct_: The product matching all criteria was already deleted\n"
36  << "Looking for type: " << branchDescription().unwrappedTypeID() << "\n"
37  << "Looking for module label: " << moduleLabel() << "\n"
38  << "Looking for productInstanceName: " << productInstanceName() << "\n"
39  << (processName().empty() ? "" : "Looking for process: ") << processName() << "\n"
40  << "This means there is a configuration error.\n"
41  << "The module which is asking for this data must be configured to state that it will read this data.";
42  throw exception;
43  }
std::string const & productInstanceName() const
TypeID unwrappedTypeID() const
std::string const & processName() const
std::string const & moduleLabel() const
BranchDescription const & branchDescription() const

Member Data Documentation

◆ defaultStatus_

ProductStatus const edm::DataManagingProductResolver::defaultStatus_
private

Definition at line 103 of file ProductResolvers.h.

Referenced by defaultStatus(), and resetStatus().

◆ productData_

ProductData edm::DataManagingProductResolver::productData_
private

◆ theStatus_

std::atomic<ProductStatus> edm::DataManagingProductResolver::theStatus_
mutableprivate