test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
39  void swap(ProductData& other) {
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  void connectTo( ProductData const& iOther) {
70  wrapper_ = iOther.wrapper_;
71  // Then the product ID and the ProcessHistory
74  // Then the store, in case the product needs reading in a subprocess.
75  prov_.setStore(iOther.prov_.store());
76  }
77  // NOTE: We should probably think hard about whether these
78  // variables should be declared "mutable" as part of
79  // the effort to make the Framework multithread capable ...
80 
81  private:
82  // "non-const data" (updated every event)
83  mutable std::shared_ptr<WrapperBase> wrapper_;
85  };
86 
87  // Free swap function
88  inline void swap(ProductData& a, ProductData& b) {
89  a.swap(b);
90  }
91 }
92 #endif
Provenance const & provenance() const
Definition: ProductData.h:30
void setProcessHistory(ProcessHistory const &ph)
Definition: ProductData.h:59
ProductProvenanceRetriever const * store() const
Definition: Provenance.h:55
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 swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:116
void resetBranchDescription(std::shared_ptr< BranchDescription const > bd)
Definition: ProductData.cc:27
void unsafe_setWrapper(std::unique_ptr< WrapperBase > iValue) const
Definition: ProductData.cc:36
void setProvenance(ProductProvenanceRetriever const *provRetriever, ProcessHistory const &ph, ProductID const &pid)
Definition: ProductData.h:63
Provenance prov_
Definition: ProductData.h:84
void resetProductData()
Definition: ProductData.h:51
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
ProcessHistory const & processHistory() const
Definition: Provenance.h:56
void setStore(ProductProvenanceRetriever const *store)
Definition: Provenance.h:63
void setWrapper(std::unique_ptr< WrapperBase > iValue)
Definition: ProductData.cc:31
std::shared_ptr< BranchDescription const > const & constBranchDescriptionPtr() const
Definition: Provenance.h:45
tuple pid
Definition: sysUtil.py:22
double b
Definition: hdecay.h:120
void setProductID(ProductID const &pid)
Definition: Provenance.h:69
void setProcessHistory(ProcessHistory const &ph)
Definition: Provenance.h:65
double a
Definition: hdecay.h:121
ProductID const & productID() const
Definition: Provenance.h:67
void unsafe_resetProductData() const
Definition: ProductData.h:55
void connectTo(ProductData const &iOther)
Definition: ProductData.h:69
void swap(Provenance &)
Definition: Provenance.cc:64
std::shared_ptr< WrapperBase > wrapper_
Definition: ProductData.h:83
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