CMS 3D CMS Logo

ProductData.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_ProductData_h
2 #define DataFormats_Common_ProductData_h
3 
4 /*----------------------------------------------------------------------
5 
6 ProductData: A collection of information related to a single EDProduct. This
7 is the storage unit of such information.
8 
9 ----------------------------------------------------------------------*/
10 
12 #include <memory>
13 
14 namespace edm {
15  class BranchDescription;
16  class MergeableRunProductMetadataBase;
17  class WrapperBase;
18 
19  class ProductData {
20  public:
21  ProductData();
22 
23  explicit ProductData(std::shared_ptr<BranchDescription const> bd);
24 
25  // For use by FWLite
26  ProductData(WrapperBase* product, Provenance const& prov);
27 
28  std::shared_ptr<BranchDescription const> const& branchDescription() const {
30  }
31 
32  Provenance const& provenance() const { return prov_;}
33 
34  WrapperBase const* wrapper() const { return wrapper_.get();}
35  WrapperBase* unsafe_wrapper() const { return const_cast<WrapperBase*>(wrapper_.get()); }
36  std::shared_ptr<WrapperBase const> sharedConstWrapper() const {
37  return wrapper_;
38  }
39 
41  std::swap(wrapper_, other.wrapper_);
42  prov_.swap(other.prov_);
43  }
44 
45  void setWrapper(std::unique_ptr<WrapperBase> iValue);
46 
47  //Not const thread-safe update
48  void unsafe_setWrapper(std::unique_ptr<WrapperBase> iValue) const;
49  void unsafe_setWrapper(std::shared_ptr<WrapperBase const> iValue) const; // for SwitchProducer
50 
51  void resetBranchDescription(std::shared_ptr<BranchDescription const> bd);
52 
54  wrapper_.reset();
55  }
56 
57  void unsafe_resetProductData() const {
58  wrapper_.reset();
59  }
60 
63  }
64 
65  void setProvenance(ProductProvenanceRetriever const* provRetriever, ProcessHistory const& ph, ProductID const& pid) {
66  prov_.setProductID(pid);
67  prov_.setStore(provRetriever);
69  }
70 
73  }
74 
75  // NOTE: We should probably think hard about whether these
76  // variables should be declared "mutable" as part of
77  // the effort to make the Framework multithread capable ...
78 
79  private:
80  // "non-const data" (updated every event)
81  mutable std::shared_ptr<WrapperBase const> wrapper_;
83  };
84 
85  // Free swap function
86  inline void swap(ProductData& a, ProductData& b) {
87  a.swap(b);
88  }
89 }
90 #endif
Provenance const & provenance() const
Definition: ProductData.h:32
void setProcessHistory(ProcessHistory const &ph)
Definition: ProductData.h:61
std::shared_ptr< BranchDescription const > const & branchDescription() const
Definition: ProductData.h:28
WrapperBase const * wrapper() const
Definition: ProductData.h:34
std::shared_ptr< WrapperBase const > wrapper_
Definition: ProductData.h:81
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
Definition: ProductData.cc:29
void unsafe_setWrapper(std::unique_ptr< WrapperBase > iValue) const
Definition: ProductData.cc:38
void setProvenance(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)
Definition: ProductData.h:65
Provenance prov_
Definition: ProductData.h:82
void resetProductData()
Definition: ProductData.h:53
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void setStore(ProductProvenanceRetriever const *store)
Definition: Provenance.h:79
void setMergeableRunProductMetadata(MergeableRunProductMetadataBase const *mrpm)
Definition: ProductData.h:71
void setWrapper(std::unique_ptr< WrapperBase > iValue)
Definition: ProductData.cc:33
std::shared_ptr< BranchDescription const > const & constBranchDescriptionPtr() const
Definition: Provenance.h:46
double b
Definition: hdecay.h:120
void setProductID(ProductID const &pid)
Definition: Provenance.h:85
HLT enums.
void setProcessHistory(ProcessHistory const &ph)
Definition: Provenance.h:81
double a
Definition: hdecay.h:121
void setMergeableRunProductMetadata(MergeableRunProductMetadataBase const *mrpm)
Definition: Provenance.h:87
void unsafe_resetProductData() const
Definition: ProductData.h:57
void swap(Provenance &)
Definition: Provenance.cc:70
std::shared_ptr< WrapperBase const > sharedConstWrapper() const
Definition: ProductData.h:36
void swap(ProductData &other)
Definition: ProductData.h:40
WrapperBase * unsafe_wrapper() const
Definition: ProductData.h:35