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 mergeProduct (std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
 
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
 
WrapperBase const * product () const
 
WrapperBaseproduct ()
 
ProductData const & productData () const
 
ProductDataproductData ()
 
 ProductHolderBase ()
 
 ProductHolderBase (ProductHolderBase const &)=delete
 
ProductID const & productID () const
 
std::string const & productInstanceName () const
 
ProductProvenance const * productProvenancePtr () const
 
TypeID productType () const
 
bool productUnavailable () const
 
bool productWasDeleted () const
 
Provenance const * provenance () const
 
bool provenanceAvailable () const
 
bool putOrMergeProduct () const
 
void putProduct (std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const
 
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, Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
 
void setProcessHistory (ProcessHistory const &ph)
 
void setProductDeleted ()
 
void setProvenance (ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)
 
bool singleProduct () const
 
void swap (ProductHolderBase &rhs)
 
void throwProductDeletedException () const
 
void unsafe_deleteProduct () 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 const &productProvenance) const =0
 
virtual void mergeProduct_ (std::unique_ptr< WrapperBase > edp) const =0
 
virtual bool onDemand_ () const =0
 
virtual ProductProvenance const * productProvenancePtr_ () 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) const =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, Principal const &principal, bool skipCurrentProcess, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const =0
 
virtual void setProcessHistory_ (ProcessHistory const &ph)=0
 
virtual void setProductDeleted_ () const =0
 
virtual void setProvenance_ (ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)=0
 
virtual bool singleProduct_ () const =0
 
virtual void swap_ (ProductHolderBase &rhs)=0
 
WrapperBaseunsafe_product () const
 

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 164 of file ProductHolder.h.

References checkType_().

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

164  {
165  checkType_(prod);
166  }
virtual void checkType_(WrapperBase const &prod) const =0
virtual void edm::ProductHolderBase::checkType_ ( WrapperBase const &  prod) const
privatepure virtual
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 const &  productProvenance 
) const
inline

Definition at line 151 of file ProductHolder.h.

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

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

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

Definition at line 155 of file ProductHolder.h.

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

155  {
156  mergeProduct_(std::move(edp));
157  }
virtual void mergeProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const =0
def move
Definition: eostools.py:510
virtual void edm::ProductHolderBase::mergeProduct_ ( std::unique_ptr< WrapperBase edp,
ProductProvenance const &  productProvenance 
) const
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 203 of file ProductHolder.cc.

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

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

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

Definition at line 79 of file ProductHolder.h.

References onDemand_().

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

79 {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 113 of file ProductHolder.h.

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

Referenced by mergeTheProduct(), and throwProductDeletedException().

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

Definition at line 87 of file ProductHolder.h.

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

87 { return getProductData().wrapper(); }
WrapperBase const * wrapper() const
Definition: ProductData.h:32
virtual ProductData const & getProductData() const =0
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 133 of file ProductHolder.h.

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

Referenced by write().

133 {return getProductData().provenance().productID();}
Provenance const & provenance() const
Definition: ProductData.h:30
virtual ProductData const & getProductData() const =0
ProductID const & productID() const
Definition: Provenance.h:67
std::string const& edm::ProductHolderBase::productInstanceName ( ) const
inline

Definition at line 110 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 const* edm::ProductHolderBase::productProvenancePtr ( ) const
inline

Definition at line 90 of file ProductHolder.h.

References productProvenancePtr_().

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

Definition at line 335 of file ProductHolder.cc.

References product().

335  {
336  return TypeID(product()->wrappedTypeInfo());
337  }
WrapperBase const * product() const
Definition: ProductHolder.h:85
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 const * edm::ProductHolderBase::provenance ( ) const
bool edm::ProductHolderBase::provenanceAvailable ( ) const

Definition at line 323 of file ProductHolder.cc.

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

323  {
324  // If this product is from a the current process,
325  // the provenance is available if and only if a product has been put.
326  if(branchDescription().produced()) {
327  return product() && product()->isPresent();
328  }
329  // If this product is from a prior process, the provenance is available,
330  // although the per event part may have been dropped.
331  return true;
332  }
WrapperBase const * product() const
Definition: ProductHolder.h:85
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 146 of file ProductHolder.h.

References putOrMergeProduct_().

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

146  {
147  return putOrMergeProduct_();
148  }
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 
) const
inline

Definition at line 136 of file ProductHolder.h.

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

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

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

Definition at line 141 of file ProductHolder.h.

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

141  {
142  putProduct_(std::move(edp));
143  }
def move
Definition: eostools.py:510
virtual void putProduct_(std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance) const =0
virtual void edm::ProductHolderBase::putProduct_ ( std::unique_ptr< WrapperBase edp,
ProductProvenance const &  productProvenance 
) const
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 340 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_().

340  {
341  // Check if the types match.
342  TypeID typeID(prod.dynamicTypeInfo());
343  if(typeID != branchDescription().unwrappedTypeID()) {
344  // Types do not match.
346  << "Product on branch " << branchDescription().branchName() << " is of wrong type.\n"
347  << "It is supposed to be of type " << branchDescription().className() << ".\n"
348  << "It is actually of type " << typeID.className() << ".\n";
349  }
350  }
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 99 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 65 of file ProductHolder.h.

References resetProductData_().

65 { 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 107 of file ProductHolder.h.

References resolvedModuleLabel_().

107 {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,
Principal const &  principal,
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_().

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

Definition at line 122 of file ProductHolder.h.

References setProcessHistory_().

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

References setProductDeleted_().

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

61  {
63  }
virtual void setProductDeleted_() const =0
virtual void edm::ProductHolderBase::setProductDeleted_ ( ) const
privatepure virtual
void edm::ProductHolderBase::setProvenance ( ProductProvenanceRetriever const *  provRetriever,
ProcessHistory const &  ph,
ProductID const &  pid 
)
inline

Definition at line 119 of file ProductHolder.h.

References setProvenance_().

119 { setProvenance_(provRetriever, ph, pid); }
virtual void setProvenance_(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)=0
tuple pid
Definition: sysUtil.py:22
virtual void edm::ProductHolderBase::setProvenance_ ( ProductProvenanceRetriever const *  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::Principal::readAllFromSourceAndMergeImmediately().

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 168 of file ProductHolder.h.

References swap_().

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

168 {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::unsafe_deleteProduct ( ) const
inline

Definition at line 67 of file ProductHolder.h.

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

67  {
70  }
virtual void setProductDeleted_() const =0
virtual ProductData const & getProductData() const =0
void unsafe_resetProductData() const
Definition: ProductData.h:55
WrapperBase* edm::ProductHolderBase::unsafe_product ( ) const
inlineprivate

Definition at line 173 of file ProductHolder.h.

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

Referenced by mergeTheProduct().

173 { return getProductData().unsafe_wrapper(); }
virtual ProductData const & getProductData() const =0
WrapperBase * unsafe_wrapper() const
Definition: ProductData.h:34
void edm::ProductHolderBase::write ( std::ostream &  os) const

Definition at line 358 of file ProductHolder.cc.

References productID(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

358  {
359  // This is grossly inadequate. It is also not critical for the
360  // first pass.
361  os << std::string("ProductHolder for product with ID: ")
362  << productID();
363  }
ProductID const & productID() const