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 {
22  class ProductProvenance;
23  using ProductProvenances = std::vector<ProductProvenance>;
24 
25  bool operator<(ProductProvenance const& a,
26  ProductProvenance const& b) noexcept;
27  std::ostream& operator<<(std::ostream& os, ProductProvenance const& p);
28  bool operator==(ProductProvenance const& a,
29  ProductProvenance const& b) noexcept;
30  bool operator!=(ProductProvenance const& a,
31  ProductProvenance const& b) noexcept;
32 }
33 
35 public:
36  ProductProvenance() = default;
38 
40 
42  ProductStatus status,
43  std::shared_ptr<Parentage> parentagePtr);
44 
45  ProductProvenance(ProductID pid, ProductStatus status, ParentageID const& id);
46 
48  ProductStatus status,
49  std::vector<ProductID> const& parents);
50 
51  // use compiler-generated copy c'tor, copy assignment, and d'tor
52 
53  void write(std::ostream& os) const;
54 
55  ProductID
56  productID() const noexcept
57  {
58  return productID_;
59  }
61  productStatus() const noexcept
62  {
63  return productStatus_;
64  }
65  ParentageID const&
66  parentageID() const noexcept
67  {
68  return parentageID_;
69  }
70  Parentage const& parentage() const;
71  void
72  setStatus(ProductStatus const status) const noexcept
73  {
75  }
76  void setPresent() const noexcept;
77  void setNotPresent() const noexcept;
78 
79  bool
80  noParentage() const noexcept
81  {
82  return transients_.get().noParentage_;
83  }
84 
85  struct Transients {
86  Transients() = default;
87  std::shared_ptr<Parentage> parentagePtr_{nullptr};
88  bool noParentage_{false};
89  };
90 
91 private:
92  std::shared_ptr<Parentage>&
93  parentagePtr() const noexcept
94  {
95  return transients_.get().parentagePtr_;
96  }
97 
102 };
103 
104 inline bool
106 {
107  return a.productID() < b.productID();
108 }
109 
110 inline std::ostream&
111 art::operator<<(std::ostream& os, ProductProvenance const& p)
112 {
113  p.write(os);
114  return os;
115 }
116 
117 inline bool
119 {
120  return !(a == b);
121 }
122 
123 #endif /* canvas_Persistency_Provenance_ProductProvenance_h */
124 
125 // Local Variables:
126 // mode: c++
127 // End:
std::ostream & operator<<(std::ostream &os, EDAnalyzer::Table< T > const &t)
Definition: EDAnalyzer.h:184
void setStatus(ProductStatus const status) const noexcept
ParentageID const & parentageID() const noexcept
int status
Definition: fabricate.py:1613
const char * p
Definition: xmltok.h:285
void setPresent() const noexcept
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
void write(std::ostream &os) const
ProductID productID() const noexcept
std::shared_ptr< Parentage > parentagePtr_
bool operator<(ProductInfo const &a, ProductInfo const &b)
Definition: ProductInfo.h:44
constexpr ProductStatus uninitialized() noexcept
Definition: ProductStatus.h:30
std::vector< ProductProvenance > ProductProvenances
ProductStatus productStatus_
bool noParentage() const noexcept
Parentage const & parentage() const
Transient< Transients > transients_
const double a
void setNotPresent() const noexcept
unsigned char ProductStatus
Definition: ProductStatus.h:6
ProductStatus productStatus() const noexcept
const hit & b
Definition: hits.cxx:21
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
bool operator==(Provenance const &a, Provenance const &b)
Definition: Provenance.h:168
std::shared_ptr< Parentage > & parentagePtr() const noexcept