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 WrapperBase;
17  class ProductData {
18  public:
19  ProductData();
20 
21  explicit ProductData(std::shared_ptr<BranchDescription const> bd);
22 
23  // For use by FWLite
24  ProductData(WrapperBase* product, Provenance const& prov);
25 
26  std::shared_ptr<BranchDescription const> const& branchDescription() const {
28  }
29 
30  Provenance const& provenance() const { return prov_;}
31 
32  WrapperBase const* wrapper() const { return wrapper_.get();}
33  WrapperBase* wrapper() { return wrapper_.get(); }
34  WrapperBase* unsafe_wrapper() const { return wrapper_.get(); }
35  std::shared_ptr<WrapperBase const> sharedConstWrapper() const {
36  return wrapper_;
37  }
38 
40  std::swap(wrapper_, other.wrapper_);
41  prov_.swap(other.prov_);
42  }
43 
44  void setWrapper(std::unique_ptr<WrapperBase> iValue);
45 
46  //Not const thread-safe update
47  void unsafe_setWrapper(std::unique_ptr<WrapperBase> iValue) const;
48 
49  void resetBranchDescription(std::shared_ptr<BranchDescription const> bd);
50 
52  wrapper_.reset();
53  }
54 
55  void unsafe_resetProductData() const {
56  wrapper_.reset();
57  }
58 
61  }
62 
63  void setProvenance(ProductProvenanceRetriever const* provRetriever, ProcessHistory const& ph, ProductID const& pid) {
64  prov_.setProductID(pid);
65  prov_.setStore(provRetriever);
67  }
68 
69  // NOTE: We should probably think hard about whether these
70  // variables should be declared "mutable" as part of
71  // the effort to make the Framework multithread capable ...
72 
73  private:
74  // "non-const data" (updated every event)
75  mutable std::shared_ptr<WrapperBase> wrapper_;
77  };
78 
79  // Free swap function
80  inline void swap(ProductData& a, ProductData& b) {
81  a.swap(b);
82  }
83 }
84 #endif
Provenance const & provenance() const
Definition: ProductData.h:30
void setProcessHistory(ProcessHistory const &ph)
Definition: ProductData.h:59
std::shared_ptr< BranchDescription const > const & branchDescription() const
Definition: ProductData.h:26
WrapperBase * wrapper()
Definition: ProductData.h:33
WrapperBase const * wrapper() const
Definition: ProductData.h:32
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:63
Provenance prov_
Definition: ProductData.h:76
void resetProductData()
Definition: ProductData.h:51
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void setStore(ProductProvenanceRetriever const *store)
Definition: Provenance.h:76
void setWrapper(std::unique_ptr< WrapperBase > iValue)
Definition: ProductData.cc:33
std::shared_ptr< BranchDescription const > const & constBranchDescriptionPtr() const
Definition: Provenance.h:44
double b
Definition: hdecay.h:120
void setProductID(ProductID const &pid)
Definition: Provenance.h:82
HLT enums.
void setProcessHistory(ProcessHistory const &ph)
Definition: Provenance.h:78
double a
Definition: hdecay.h:121
void unsafe_resetProductData() const
Definition: ProductData.h:55
void swap(Provenance &)
Definition: Provenance.cc:55
std::shared_ptr< WrapperBase > wrapper_
Definition: ProductData.h:75
std::shared_ptr< WrapperBase const > sharedConstWrapper() const
Definition: ProductData.h:35
void swap(ProductData &other)
Definition: ProductData.h:39
WrapperBase * unsafe_wrapper() const
Definition: ProductData.h:34