CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions
edm::ProductHolderBase Class Referenceabstract

#include <ProductHolder.h>

Inheritance diagram for edm::ProductHolderBase:
edm::AliasProductHolder edm::InputProductHolder edm::NoProcessProductHolder edm::ProducedProductHolder edm::ScheduledProductHolder edm::SourceProductHolder edm::UnscheduledProductHolder

Public Types

enum  ResolveStatus { ProductFound, ProductNotFound, Ambiguous }
 

Public Member Functions

BranchDescription const & branchDescription () const
 
void checkType (WrapperBase const &prod) const
 
void deleteProduct ()
 
void mergeProduct (std::unique_ptr< WrapperBase > edp, ProductProvenance &productProvenance)
 
void mergeProduct (std::unique_ptr< WrapperBase > edp) const
 
void mergeTheProduct (std::unique_ptr< WrapperBase > edp) const
 
std::string const & moduleLabel () const
 
bool onDemand () const
 
ProductHolderBaseoperator= (ProductHolderBase const &)=delete
 
std::string const & processName () const
 
WrapperBaseproduct () const
 
ProductData const & productData () const
 
ProductDataproductData ()
 
 ProductHolderBase ()
 
 ProductHolderBase (ProductHolderBase const &)=delete
 
ProductID const & productID () const
 
std::string const & productInstanceName () const
 
ProductProvenanceproductProvenancePtr () const
 
TypeID productType () const
 
bool productUnavailable () const
 
bool productWasDeleted () const
 
Provenanceprovenance () const
 
bool provenanceAvailable () const
 
bool putOrMergeProduct () const
 
void putProduct (std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)
 
void putProduct (std::unique_ptr< WrapperBase > edp) const
 
void reallyCheckType (WrapperBase const &prod) const
 
void resetBranchDescription (std::shared_ptr< BranchDescription const > bd)
 
void resetProductData ()
 
void resetStatus ()
 
std::string const & resolvedModuleLabel () const
 
ProductData const * resolveProduct (ResolveStatus &resolveStatus, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
void setPrincipal (Principal *principal)
 
void setProcessHistory (ProcessHistory const &ph)
 
void setProductDeleted ()
 
void setProductProvenance (ProductProvenance const &prov) const
 
void setProvenance (std::shared_ptr< ProductProvenanceRetriever > provRetriever, ProcessHistory const &ph, ProductID const &pid)
 
bool singleProduct () const
 
void swap (ProductHolderBase &rhs)
 
void throwProductDeletedException () const
 
void write (std::ostream &os) const
 
virtual ~ProductHolderBase ()
 

Private Member Functions

virtual BranchDescription const & branchDescription_ () const =0
 
virtual void checkType_ (WrapperBase const &prod) const =0
 
virtual ProductData const & getProductData () const =0
 
virtual ProductDatagetProductData ()=0
 
virtual void mergeProduct_ (std::unique_ptr< WrapperBase > edp, ProductProvenance &productProvenance)=0
 
virtual void mergeProduct_ (std::unique_ptr< WrapperBase > edp) const =0
 
virtual bool onDemand_ () const =0
 
virtual ProductProvenanceproductProvenancePtr_ () const =0
 
virtual bool productUnavailable_ () const =0
 
virtual bool productWasDeleted_ () const =0
 
virtual bool putOrMergeProduct_ () const =0
 
virtual void putProduct_ (std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)=0
 
virtual void putProduct_ (std::unique_ptr< WrapperBase > edp) const =0
 
virtual void resetBranchDescription_ (std::shared_ptr< BranchDescription const > bd)=0
 
virtual void resetProductData_ ()=0
 
virtual void resetStatus_ ()=0
 
virtual std::string const & resolvedModuleLabel_ () const =0
 
virtual ProductData const * resolveProduct_ (ResolveStatus &resolveStatus, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const =0
 
virtual void setPrincipal_ (Principal *principal)=0
 
virtual void setProcessHistory_ (ProcessHistory const &ph)=0
 
virtual void setProductDeleted_ ()=0
 
virtual void setProvenance_ (std::shared_ptr< ProductProvenanceRetriever > provRetriever, ProcessHistory const &ph, ProductID const &pid)=0
 
virtual bool singleProduct_ () const =0
 
virtual void swap_ (ProductHolderBase &rhs)=0
 

Detailed Description

Definition at line 30 of file ProductHolder.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

edm::ProductHolderBase::ProductHolderBase ( )

Definition at line 27 of file ProductHolder.cc.

27 {}
edm::ProductHolderBase::~ProductHolderBase ( )
virtual

Definition at line 29 of file ProductHolder.cc.

29 {}
edm::ProductHolderBase::ProductHolderBase ( ProductHolderBase const &  )
delete

Member Function Documentation

BranchDescription const& edm::ProductHolderBase::branchDescription ( ) const
inline
virtual BranchDescription const& edm::ProductHolderBase::branchDescription_ ( ) const
privatepure virtual
void edm::ProductHolderBase::checkType ( WrapperBase const &  prod) const
inline

Definition at line 166 of file ProductHolder.h.

References checkType_().

Referenced by edm::AliasProductHolder::checkType_(), edm::Principal::checkUniquenessAndType(), and edm::Principal::putOrMerge().

166  {
167  checkType_(prod);
168  }
virtual void checkType_(WrapperBase const &prod) const =0
virtual void edm::ProductHolderBase::checkType_ ( WrapperBase const &  prod) const
privatepure virtual
void edm::ProductHolderBase::deleteProduct ( )
inline

Definition at line 66 of file ProductHolder.h.

References getProductData(), edm::ProductData::resetProductData(), and setProductDeleted_().

Referenced by edm::Principal::deleteProduct().

66  {
69  }
virtual ProductData const & getProductData() const =0
void resetProductData()
Definition: ProductData.h:36
virtual void setProductDeleted_()=0
virtual ProductData const& edm::ProductHolderBase::getProductData ( ) const
privatepure virtual
virtual ProductData& edm::ProductHolderBase::getProductData ( )
privatepure virtual
void edm::ProductHolderBase::mergeProduct ( std::unique_ptr< WrapperBase edp,
ProductProvenance productProvenance 
)
inline

Definition at line 153 of file ProductHolder.h.

References mergeProduct_(), and eostools::move().

Referenced by edm::AliasProductHolder::mergeProduct_(), and edm::Principal::putOrMerge().

153  {
154  mergeProduct_(std::move(edp), productProvenance);
155  }
virtual void mergeProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance &productProvenance)=0
def move
Definition: eostools.py:510
void edm::ProductHolderBase::mergeProduct ( std::unique_ptr< WrapperBase edp) const
inline

Definition at line 157 of file ProductHolder.h.

References mergeProduct_(), and eostools::move().

157  {
158  mergeProduct_(std::move(edp));
159  }
virtual void mergeProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance &productProvenance)=0
def move
Definition: eostools.py:510
virtual void edm::ProductHolderBase::mergeProduct_ ( std::unique_ptr< WrapperBase edp,
ProductProvenance productProvenance 
)
privatepure virtual
virtual void edm::ProductHolderBase::mergeProduct_ ( std::unique_ptr< WrapperBase edp) const
privatepure virtual
void edm::ProductHolderBase::mergeTheProduct ( std::unique_ptr< WrapperBase edp) const

Definition at line 206 of file ProductHolder.cc.

References branchDescription(), edm::BranchDescription::className(), edm::WrapperBase::hasIsProductEqual(), edm::WrapperBase::isProductEqual(), edm::WrapperBase::mergeProduct(), moduleLabel(), processName(), product(), and productInstanceName().

Referenced by edm::InputProductHolder::mergeProduct_(), and edm::ProducedProductHolder::mergeProduct_().

206  {
207  if(product()->isMergeable()) {
208  product()->mergeProduct(edp.get());
209  } else if(product()->hasIsProductEqual()) {
210  if(!product()->isProductEqual(edp.get())) {
211  LogError("RunLumiMerging")
212  << "ProductHolderBase::mergeTheProduct\n"
213  << "Two run/lumi products for the same run/lumi which should be equal are not\n"
214  << "Using the first, ignoring the second\n"
215  << "className = " << branchDescription().className() << "\n"
216  << "moduleLabel = " << moduleLabel() << "\n"
217  << "instance = " << productInstanceName() << "\n"
218  << "process = " << processName() << "\n";
219  }
220  } else {
221  LogWarning("RunLumiMerging")
222  << "ProductHolderBase::mergeTheProduct\n"
223  << "Run/lumi product has neither a mergeProduct nor isProductEqual function\n"
224  << "Using the first, ignoring the second in merge\n"
225  << "className = " << branchDescription().className() << "\n"
226  << "moduleLabel = " << moduleLabel() << "\n"
227  << "instance = " << productInstanceName() << "\n"
228  << "process = " << processName() << "\n";
229  }
230  }
bool mergeProduct(WrapperBase const *newProduct)
Definition: WrapperBase.h:48
WrapperBase * product() const
Definition: ProductHolder.h:84
std::string const & moduleLabel() const
BranchDescription const & branchDescription() const
Definition: ProductHolder.h:93
std::string const & className() const
std::string const & processName() const
bool hasIsProductEqual() const
Definition: WrapperBase.h:49
bool isProductEqual(WrapperBase const *newProduct) const
Definition: WrapperBase.h:50
std::string const & productInstanceName() const
std::string const& edm::ProductHolderBase::moduleLabel ( ) const
inline
bool edm::ProductHolderBase::onDemand ( ) const
inline

Definition at line 78 of file ProductHolder.h.

References onDemand_().

Referenced by edm::AliasProductHolder::onDemand_(), and edm::ProducedProductHolder::productUnavailable_().

78 {return onDemand_();}
virtual bool onDemand_() const =0
virtual bool edm::ProductHolderBase::onDemand_ ( ) const
privatepure virtual
ProductHolderBase& edm::ProductHolderBase::operator= ( ProductHolderBase const &  )
delete
std::string const& edm::ProductHolderBase::processName ( ) const
inline

Definition at line 115 of file ProductHolder.h.

References branchDescription(), and edm::BranchDescription::processName().

Referenced by mergeTheProduct(), and throwProductDeletedException().

115 {return branchDescription().processName();}
std::string const & processName() const
BranchDescription const & branchDescription() const
Definition: ProductHolder.h:93
WrapperBase* edm::ProductHolderBase::product ( ) const
inline
ProductData const& edm::ProductHolderBase::productData ( ) const
inline
ProductData& edm::ProductHolderBase::productData ( )
inline

Definition at line 45 of file ProductHolder.h.

References getProductData().

45  {
46  return getProductData();
47  }
virtual ProductData const & getProductData() const =0
ProductID const& edm::ProductHolderBase::productID ( ) const
inline

Definition at line 135 of file ProductHolder.h.

References getProductData(), edm::Provenance::productID(), and edm::ProductData::prov_.

Referenced by write().

135 {return getProductData().prov_.productID();}
Provenance prov_
Definition: ProductData.h:47
virtual ProductData const & getProductData() const =0
ProductID const & productID() const
Definition: Provenance.h:78
std::string const& edm::ProductHolderBase::productInstanceName ( ) const
inline

Definition at line 112 of file ProductHolder.h.

References branchDescription(), and edm::BranchDescription::productInstanceName().

Referenced by mergeTheProduct(), and throwProductDeletedException().

BranchDescription const & branchDescription() const
Definition: ProductHolder.h:93
std::string const & productInstanceName() const
ProductProvenance* edm::ProductHolderBase::productProvenancePtr ( ) const
inline

Definition at line 87 of file ProductHolder.h.

References productProvenancePtr_().

87 { return productProvenancePtr_(); }
virtual ProductProvenance * productProvenancePtr_() const =0
virtual ProductProvenance* edm::ProductHolderBase::productProvenancePtr_ ( ) const
privatepure virtual
TypeID edm::ProductHolderBase::productType ( ) const

Definition at line 357 of file ProductHolder.cc.

References product().

357  {
358  return TypeID(product()->wrappedTypeInfo());
359  }
WrapperBase * product() const
Definition: ProductHolder.h:84
bool edm::ProductHolderBase::productUnavailable ( ) const
inline
virtual bool edm::ProductHolderBase::productUnavailable_ ( ) const
privatepure virtual
bool edm::ProductHolderBase::productWasDeleted ( ) const
inline
virtual bool edm::ProductHolderBase::productWasDeleted_ ( ) const
privatepure virtual
Provenance * edm::ProductHolderBase::provenance ( ) const
bool edm::ProductHolderBase::provenanceAvailable ( ) const

Definition at line 345 of file ProductHolder.cc.

References branchDescription(), edm::WrapperBase::isPresent(), edm::es::produced, and product().

345  {
346  // If this product is from a the current process,
347  // the provenance is available if and only if a product has been put.
348  if(branchDescription().produced()) {
349  return product() && product()->isPresent();
350  }
351  // If this product is from a prior process, the provenance is available,
352  // although the per event part may have been dropped.
353  return true;
354  }
WrapperBase * product() const
Definition: ProductHolder.h:84
bool isPresent() const
Definition: WrapperBase.h:22
BranchDescription const & branchDescription() const
Definition: ProductHolder.h:93
eventsetup::produce::Produce produced
Definition: ESProducts.cc:20
bool edm::ProductHolderBase::putOrMergeProduct ( ) const
inline

Definition at line 148 of file ProductHolder.h.

References putOrMergeProduct_().

Referenced by edm::Principal::putOrMerge(), and edm::AliasProductHolder::putOrMergeProduct_().

148  {
149  return putOrMergeProduct_();
150  }
virtual bool putOrMergeProduct_() const =0
virtual bool edm::ProductHolderBase::putOrMergeProduct_ ( ) const
privatepure virtual
void edm::ProductHolderBase::putProduct ( std::unique_ptr< WrapperBase edp,
ProductProvenance const &  productProvenance 
)
inline

Definition at line 138 of file ProductHolder.h.

References eostools::move(), and putProduct_().

Referenced by edm::EventPrincipal::put(), edm::EventPrincipal::putOnRead(), edm::Principal::putOrMerge(), edm::AliasProductHolder::putProduct_(), and edm::EventPrincipal::readFromSource_().

138  {
139  putProduct_(std::move(edp), productProvenance);
140  }
virtual void putProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)=0
def move
Definition: eostools.py:510
void edm::ProductHolderBase::putProduct ( std::unique_ptr< WrapperBase edp) const
inline

Definition at line 143 of file ProductHolder.h.

References eostools::move(), and putProduct_().

143  {
144  putProduct_(std::move(edp));
145  }
virtual void putProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)=0
def move
Definition: eostools.py:510
virtual void edm::ProductHolderBase::putProduct_ ( std::unique_ptr< WrapperBase edp,
ProductProvenance const &  productProvenance 
)
privatepure virtual
virtual void edm::ProductHolderBase::putProduct_ ( std::unique_ptr< WrapperBase edp) const
privatepure virtual
void edm::ProductHolderBase::reallyCheckType ( WrapperBase const &  prod) const

Definition at line 362 of file ProductHolder.cc.

References branchDescription(), edm::BranchDescription::branchName(), edm::BranchDescription::className(), edm::WrapperBase::dynamicTypeInfo(), edm::errors::EventCorruption, Exception, and edm::BranchDescription::unwrappedTypeID().

Referenced by edm::ProducedProductHolder::checkType_().

362  {
363  // Check if the types match.
364  TypeID typeID(prod.dynamicTypeInfo());
365  if(typeID != branchDescription().unwrappedTypeID()) {
366  // Types do not match.
368  << "Product on branch " << branchDescription().branchName() << " is of wrong type.\n"
369  << "It is supposed to be of type " << branchDescription().className() << ".\n"
370  << "It is actually of type " << typeID.className() << ".\n";
371  }
372  }
std::string const & branchName() const
BranchDescription const & branchDescription() const
Definition: ProductHolder.h:93
std::string const & className() const
TypeID unwrappedTypeID() const
void edm::ProductHolderBase::resetBranchDescription ( std::shared_ptr< BranchDescription const >  bd)
inline

Definition at line 101 of file ProductHolder.h.

References resetBranchDescription_().

Referenced by edm::Principal::adjustToNewProductRegistry().

virtual void resetBranchDescription_(std::shared_ptr< BranchDescription const > bd)=0
virtual void edm::ProductHolderBase::resetBranchDescription_ ( std::shared_ptr< BranchDescription const >  bd)
privatepure virtual
void edm::ProductHolderBase::resetProductData ( )
inline

Definition at line 64 of file ProductHolder.h.

References resetProductData_().

64 { resetProductData_(); }
virtual void resetProductData_()=0
virtual void edm::ProductHolderBase::resetProductData_ ( )
privatepure virtual
void edm::ProductHolderBase::resetStatus ( )
inline
virtual void edm::ProductHolderBase::resetStatus_ ( )
privatepure virtual
std::string const& edm::ProductHolderBase::resolvedModuleLabel ( ) const
inline

Definition at line 109 of file ProductHolder.h.

References resolvedModuleLabel_().

109 {return resolvedModuleLabel_();}
virtual std::string const & resolvedModuleLabel_() const =0
virtual std::string const& edm::ProductHolderBase::resolvedModuleLabel_ ( ) const
privatepure virtual
ProductData const* edm::ProductHolderBase::resolveProduct ( ResolveStatus resolveStatus,
bool  skipCurrentProcess,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const
inline

Definition at line 49 of file ProductHolder.h.

References resolveProduct_().

Referenced by edm::AliasProductHolder::resolveProduct_(), and edm::NoProcessProductHolder::resolveProduct_().

52  {
53  return resolveProduct_(resolveStatus, skipCurrentProcess, sra, mcc);
54  }
virtual ProductData const * resolveProduct_(ResolveStatus &resolveStatus, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const =0
virtual ProductData const* edm::ProductHolderBase::resolveProduct_ ( ResolveStatus resolveStatus,
bool  skipCurrentProcess,
SharedResourcesAcquirer sra,
ModuleCallingContext const *  mcc 
) const
privatepure virtual
void edm::ProductHolderBase::setPrincipal ( Principal principal)
inline

Definition at line 98 of file ProductHolder.h.

References setPrincipal_().

virtual void setPrincipal_(Principal *principal)=0
virtual void edm::ProductHolderBase::setPrincipal_ ( Principal principal)
privatepure virtual
void edm::ProductHolderBase::setProcessHistory ( ProcessHistory const &  ph)
inline

Definition at line 124 of file ProductHolder.h.

References setProcessHistory_().

124 { setProcessHistory_(ph); }
virtual void setProcessHistory_(ProcessHistory const &ph)=0
virtual void edm::ProductHolderBase::setProcessHistory_ ( ProcessHistory const &  ph)
privatepure virtual
void edm::ProductHolderBase::setProductDeleted ( )
inline

Definition at line 60 of file ProductHolder.h.

References setProductDeleted_().

Referenced by edm::AliasProductHolder::setProductDeleted_().

60  {
62  }
virtual void setProductDeleted_()=0
virtual void edm::ProductHolderBase::setProductDeleted_ ( )
privatepure virtual
void edm::ProductHolderBase::setProductProvenance ( ProductProvenance const &  prov) const

Definition at line 269 of file ProductHolder.cc.

References productData(), edm::ProductData::prov_, and edm::Provenance::setProductProvenance().

Referenced by edm::ProducedProductHolder::mergeProduct_(), edm::InputProductHolder::putProduct_(), and edm::ProducedProductHolder::putProduct_().

269  {
271  }
Provenance prov_
Definition: ProductData.h:47
ProductData const & productData() const
Definition: ProductHolder.h:41
void setProductProvenance(ProductProvenance const &prov) const
Definition: Provenance.cc:78
void edm::ProductHolderBase::setProvenance ( std::shared_ptr< ProductProvenanceRetriever provRetriever,
ProcessHistory const &  ph,
ProductID const &  pid 
)
inline

Definition at line 121 of file ProductHolder.h.

References setProvenance_().

121 { setProvenance_(provRetriever, ph, pid); }
virtual void setProvenance_(std::shared_ptr< ProductProvenanceRetriever > provRetriever, ProcessHistory const &ph, ProductID const &pid)=0
tuple pid
Definition: sysUtil.py:22
virtual void edm::ProductHolderBase::setProvenance_ ( std::shared_ptr< ProductProvenanceRetriever provRetriever,
ProcessHistory const &  ph,
ProductID const &  pid 
)
privatepure virtual
bool edm::ProductHolderBase::singleProduct ( ) const
inline

Definition at line 96 of file ProductHolder.h.

References singleProduct_().

Referenced by edm::RunPrincipal::readImmediate(), and edm::LuminosityBlockPrincipal::readImmediate().

96 {return singleProduct_();}
virtual bool singleProduct_() const =0
virtual bool edm::ProductHolderBase::singleProduct_ ( ) const
privatepure virtual
void edm::ProductHolderBase::swap ( ProductHolderBase rhs)
inline

Definition at line 170 of file ProductHolder.h.

References swap_().

Referenced by edm::swap(), and edm::AliasProductHolder::swap_().

170 {swap_(rhs);}
virtual void swap_(ProductHolderBase &rhs)=0
virtual void edm::ProductHolderBase::swap_ ( ProductHolderBase rhs)
privatepure virtual
void edm::ProductHolderBase::throwProductDeletedException ( ) const

Definition at line 14 of file ProductHolder.cc.

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

Referenced by edm::InputProductHolder::resolveProduct_(), edm::ScheduledProductHolder::resolveProduct_(), edm::UnscheduledProductHolder::resolveProduct_(), and edm::SourceProductHolder::resolveProduct_().

14  {
16  exception << "ProductHolderBase::resolveProduct_: The product matching all criteria was already deleted\n"
17  << "Looking for type: " << branchDescription().unwrappedTypeID() << "\n"
18  << "Looking for module label: " << moduleLabel() << "\n"
19  << "Looking for productInstanceName: " << productInstanceName() << "\n"
20  << (processName().empty() ? "" : "Looking for process: ") << processName() << "\n"
21  << "This means there is a configuration error.\n"
22  << "The module which is asking for this data must be configured to state that it will read this data.";
23  throw exception;
24 
25  }
std::string const & moduleLabel() const
BranchDescription const & branchDescription() const
Definition: ProductHolder.h:93
TypeID unwrappedTypeID() const
std::string const & processName() const
std::string const & productInstanceName() const
void edm::ProductHolderBase::write ( std::ostream &  os) const

Definition at line 380 of file ProductHolder.cc.

References productID(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pkg.AbstractPkg::generate(), and edm::operator<<().

380  {
381  // This is grossly inadequate. It is also not critical for the
382  // first pass.
383  os << std::string("ProductHolder for product with ID: ")
384  << productID();
385  }
ProductID const & productID() const