LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ProductProvenance.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Provenance_ProductProvenance_h
2 #define canvas_Persistency_Provenance_ProductProvenance_h
3 
4 /*----------------------------------------------------------------------
5 
6 ProductProvenance: The event dependent portion of the description of a product
7 and how it came into existence, plus the status.
8 
9 ----------------------------------------------------------------------*/
10 
16 
17 #include <iosfwd>
18 #include <memory>
19 #include <vector>
20 
21 namespace art {
23  typedef std::vector<ProductProvenance> ProductProvenances;
24 
25  bool operator<(ProductProvenance const& a, ProductProvenance const& b);
26  std::ostream& operator<<(std::ostream& os, ProductProvenance const& p);
27  bool operator==(ProductProvenance const& a, ProductProvenance const& b);
28  bool operator!=(ProductProvenance const& a, ProductProvenance const& b);
29 }
30 
32 public:
33  ProductProvenance() = default;
35 
37 
39  ProductStatus status,
40  std::shared_ptr<Parentage> parentagePtr);
41 
42  ProductProvenance(ProductID pid, ProductStatus status, ParentageID const& id);
43 
45  ProductStatus status,
46  std::vector<ProductID> const& parents);
47 
48  // use compiler-generated copy c'tor, copy assignment, and d'tor
49 
50  void write(std::ostream& os) const;
51 
52  ProductID
53  productID() const
54  {
55  return productID_;
56  }
57  ProductStatus const&
58  productStatus() const
59  {
60  return productStatus_;
61  }
62  ParentageID const&
63  parentageID() const
64  {
65  return parentageID_;
66  }
67  Parentage const& parentage() const;
68  void
69  setStatus(ProductStatus status) const
70  {
71  productStatus_ = status;
72  }
73  void setPresent() const;
74  void setNotPresent() const;
75 
76  bool
77  noParentage() const
78  {
79  return transients_.get().noParentage_;
80  }
81 
82  struct Transients {
83  Transients() = default;
84  std::shared_ptr<Parentage> parentagePtr_{nullptr};
85  bool noParentage_{false};
86  };
87 
88 private:
89  std::shared_ptr<Parentage>&
90  parentagePtr() const
91  {
92  return transients_.get().parentagePtr_;
93  }
94 
99 };
100 
101 inline bool
103 {
104  return a.productID() < b.productID();
105 }
106 
107 inline std::ostream&
108 art::operator<<(std::ostream& os, ProductProvenance const& p)
109 {
110  p.write(os);
111  return os;
112 }
113 
114 inline bool
116 {
117  return !(a == b);
118 }
119 
120 #endif /* canvas_Persistency_Provenance_ProductProvenance_h */
121 
122 // Local Variables:
123 // mode: c++
124 // End:
std::ostream & operator<<(std::ostream &os, EDAnalyzer::Table< T > const &t)
Definition: EDAnalyzer.h:184
ProductID productID() const
std::shared_ptr< Parentage > & parentagePtr() const
ProductStatus const & productStatus() const
void setStatus(ProductStatus status) const
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
ProductStatus uninitialized()
Definition: ProductStatus.h:36
void write(std::ostream &os) const
unsigned char ProductStatus
Definition: ProductStatus.h:12
std::shared_ptr< Parentage > parentagePtr_
bool operator<(ProductInfo const &a, ProductInfo const &b)
Definition: ProductInfo.h:44
Parentage const & parentage() const
ProductStatus productStatus_
Transient< Transients > transients_
std::vector< ProductProvenance > ProductProvenances
HLT enums.
bool operator==(Provenance const &a, Provenance const &b)
Definition: Provenance.h:168
ParentageID const & parentageID() const