CMS 3D CMS Logo

Parentage.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_Parentage_h
2 #define DataFormats_Provenance_Parentage_h
3 
4 /*----------------------------------------------------------------------
5 
6 Parentage: The products that were read in producing this product.
7 
8 ----------------------------------------------------------------------*/
11 
12 #include <iosfwd>
13 #include <vector>
14 
15 /*
16  Parentage
17 
18  definitions:
19  Product: The WrapperBase to which a provenance object is associated
20 
21  Parents: The EDProducts used as input by the creator.
22 */
23 
24 namespace edm {
25  class Parentage {
26  public:
27  Parentage();
28 
29  explicit Parentage(std::vector<BranchID> const& parents);
30  explicit Parentage(std::vector<BranchID>&& parents);
31 
32  Parentage(Parentage const&) = default;
33  Parentage(Parentage&&) = default;
34 
35  Parentage& operator=(Parentage const&) = default;
36  Parentage& operator=(Parentage&&) = default;
37 
39 
40  ParentageID id() const;
41 
42  void write(std::ostream& os) const;
43 
44  std::vector<BranchID> const& parents() const {return parents_;}
45  std::vector<BranchID>& parentsForUpdate() {return parents_;}
46  void setParents(std::vector<BranchID> const& parents) {parents_ = parents;}
47  void swap(Parentage& other) {parents_.swap(other.parents_);}
49  struct Transients {
51  void reset() {}
52  };
53 
54  private:
55  // The Branch IDs of the parents
56  std::vector<BranchID> parents_;
58  };
59 
60  // Free swap function
61  inline
62  void
64  a.swap(b);
65  }
66 
67  inline
68  std::ostream&
69  operator<<(std::ostream& os, Parentage const& p) {
70  p.write(os);
71  return os;
72  }
73 
74  // Only the 'salient attributes' are testing in equality comparison.
75  bool operator==(Parentage const& a, Parentage const& b);
76  inline bool operator!=(Parentage const& a, Parentage const& b) { return !(a == b); }
77 }
78 #endif
79 
void write(std::ostream &os) const
Definition: Parentage.cc:36
std::vector< BranchID > & parentsForUpdate()
Definition: Parentage.h:45
std::vector< BranchID > parents_
Definition: Parentage.h:56
ParentageID id() const
Definition: Parentage.cc:23
void swap(Parentage &other)
Definition: Parentage.h:47
std::vector< BranchID > const & parents() const
Definition: Parentage.h:44
Transients transient_
Definition: Parentage.h:57
void setParents(std::vector< BranchID > const &parents)
Definition: Parentage.h:46
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &) noexcept
void initializeTransients()
Definition: Parentage.h:48
double b
Definition: hdecay.h:120
HLT enums.
double a
Definition: hdecay.h:121
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Parentage & operator=(Parentage const &)=default