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, 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, 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 29 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 163 of file ProductHolder.h.

References checkType_().

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

163  {
164  checkType_(prod);
165  }
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 63 of file ProductHolder.h.

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

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

63  {
66  }
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 150 of file ProductHolder.h.

References mergeProduct_().

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

150  {
151  mergeProduct_(std::move(edp), productProvenance);
152  }
virtual void mergeProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance &productProvenance)=0
void edm::ProductHolderBase::mergeProduct ( std::unique_ptr< WrapperBase edp) const
inline

Definition at line 154 of file ProductHolder.h.

References mergeProduct_().

154  {
155  mergeProduct_(std::move(edp));
156  }
virtual void mergeProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance &productProvenance)=0
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 200 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_().

200  {
201  if(product()->isMergeable()) {
202  product()->mergeProduct(edp.get());
203  } else if(product()->hasIsProductEqual()) {
204  if(!product()->isProductEqual(edp.get())) {
205  LogError("RunLumiMerging")
206  << "ProductHolderBase::mergeTheProduct\n"
207  << "Two run/lumi products for the same run/lumi which should be equal are not\n"
208  << "Using the first, ignoring the second\n"
209  << "className = " << branchDescription().className() << "\n"
210  << "moduleLabel = " << moduleLabel() << "\n"
211  << "instance = " << productInstanceName() << "\n"
212  << "process = " << processName() << "\n";
213  }
214  } else {
215  LogWarning("RunLumiMerging")
216  << "ProductHolderBase::mergeTheProduct\n"
217  << "Run/lumi product has neither a mergeProduct nor isProductEqual function\n"
218  << "Using the first, ignoring the second in merge\n"
219  << "className = " << branchDescription().className() << "\n"
220  << "moduleLabel = " << moduleLabel() << "\n"
221  << "instance = " << productInstanceName() << "\n"
222  << "process = " << processName() << "\n";
223  }
224  }
bool mergeProduct(WrapperBase const *newProduct)
Definition: WrapperBase.h:48
WrapperBase * product() const
Definition: ProductHolder.h:81
std::string const & moduleLabel() const
BranchDescription const & branchDescription() const
Definition: ProductHolder.h:90
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 75 of file ProductHolder.h.

References onDemand_().

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

75 {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 112 of file ProductHolder.h.

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

Referenced by mergeTheProduct(), and throwProductDeletedException().

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

Definition at line 44 of file ProductHolder.h.

References getProductData().

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

Definition at line 132 of file ProductHolder.h.

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

Referenced by write().

132 {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 109 of file ProductHolder.h.

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

Referenced by mergeTheProduct(), and throwProductDeletedException().

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

Definition at line 84 of file ProductHolder.h.

References productProvenancePtr_().

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

Definition at line 351 of file ProductHolder.cc.

References product().

351  {
352  return TypeID(product()->wrappedTypeInfo());
353  }
WrapperBase * product() const
Definition: ProductHolder.h:81
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 339 of file ProductHolder.cc.

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

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

Definition at line 145 of file ProductHolder.h.

References putOrMergeProduct_().

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

145  {
146  return putOrMergeProduct_();
147  }
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 135 of file ProductHolder.h.

References putProduct_().

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

135  {
136  putProduct_(std::move(edp), productProvenance);
137  }
virtual void putProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)=0
void edm::ProductHolderBase::putProduct ( std::unique_ptr< WrapperBase edp) const
inline

Definition at line 140 of file ProductHolder.h.

References putProduct_().

140  {
141  putProduct_(std::move(edp));
142  }
virtual void putProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)=0
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 356 of file ProductHolder.cc.

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

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

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

Definition at line 98 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 61 of file ProductHolder.h.

References resetProductData_().

61 { 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 106 of file ProductHolder.h.

References resolvedModuleLabel_().

106 {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,
ModuleCallingContext const *  mcc 
) const
inline

Definition at line 48 of file ProductHolder.h.

References resolveProduct_().

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

49  {
50  return resolveProduct_(resolveStatus, skipCurrentProcess, mcc);
51  }
virtual ProductData const * resolveProduct_(ResolveStatus &resolveStatus, bool skipCurrentProcess, ModuleCallingContext const *mcc) const =0
virtual ProductData const* edm::ProductHolderBase::resolveProduct_ ( ResolveStatus resolveStatus,
bool  skipCurrentProcess,
ModuleCallingContext const *  mcc 
) const
privatepure virtual
void edm::ProductHolderBase::setPrincipal ( Principal principal)
inline

Definition at line 95 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 121 of file ProductHolder.h.

References setProcessHistory_().

121 { 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 57 of file ProductHolder.h.

References setProductDeleted_().

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

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

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

263  {
265  }
Provenance prov_
Definition: ProductData.h:47
ProductData const & productData() const
Definition: ProductHolder.h:40
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 118 of file ProductHolder.h.

References setProvenance_().

118 { 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 93 of file ProductHolder.h.

References singleProduct_().

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

93 {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 167 of file ProductHolder.h.

References swap_().

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

167 {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:90
TypeID unwrappedTypeID() const
std::string const & processName() const
std::string const & productInstanceName() const
void edm::ProductHolderBase::write ( std::ostream &  os) const

Definition at line 374 of file ProductHolder.cc.

References productID(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

374  {
375  // This is grossly inadequate. It is also not critical for the
376  // first pass.
377  os << std::string("ProductHolder for product with ID: ")
378  << productID();
379  }
ProductID const & productID() const