LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
BranchKey.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Provenance_BranchKey_h
2 #define canvas_Persistency_Provenance_BranchKey_h
3 
4 /*----------------------------------------------------------------------
5 
6 BranchKey: The key used to identify a Group in the EventPrincipal. The
7 name of the branch to which the related data product will be written
8 is determined entirely from the BranchKey.
9 
10 ----------------------------------------------------------------------*/
11 
13 
14 #include <iosfwd>
15 #include <string>
16 #include <tuple>
17 #include <utility>
18 
19 namespace art {
20  class BranchDescription;
21 
22  struct BranchKey;
23 
24  bool operator<(BranchKey const& a, BranchKey const& b);
25  bool operator==(BranchKey const& a, BranchKey const& b);
26  bool operator!=(BranchKey const& a, BranchKey const& b);
27 
28  std::ostream& operator<<(std::ostream& os, BranchKey const& bk);
29 }
30 
32  BranchKey() = default;
33  BranchKey(std::string cn,
34  std::string ml,
35  std::string pin,
36  std::string pn,
38 
39  explicit BranchKey(BranchDescription const& desc);
40 
41  std::string branchName() const;
42 
43  std::string friendlyClassName_{};
44  std::string moduleLabel_{};
45  std::string productInstanceName_{};
46  std::string processName_{};
48 };
49 
50 inline art::BranchKey::BranchKey(std::string cn,
51  std::string ml,
52  std::string pin,
53  std::string pn,
54  BranchType const bt)
55  : friendlyClassName_{std::move(cn)}
56  , moduleLabel_{std::move(ml)}
57  , productInstanceName_{std::move(pin)}
58  , processName_{std::move(pn)}
59  , branchType_{bt}
60 {}
61 
62 inline bool
63 art::operator<(BranchKey const& a, BranchKey const& b)
64 {
65  return std::tie(a.friendlyClassName_,
66  a.moduleLabel_,
68  a.processName_,
69  a.branchType_) < std::tie(b.friendlyClassName_,
70  b.moduleLabel_,
72  b.processName_,
73  b.branchType_);
74 }
75 
76 inline bool
77 art::operator==(BranchKey const& a, BranchKey const& b)
78 {
79  return !(a < b || b < a);
80 }
81 
82 inline bool
83 art::operator!=(BranchKey const& a, BranchKey const& b)
84 {
85  return !(a == b);
86 }
87 
88 #endif /* canvas_Persistency_Provenance_BranchKey_h */
89 
90 // Local Variables:
91 // mode: c++
92 // End:
bool operator==(Provenance const &a, Provenance const &b) noexcept
Definition: Provenance.cc:141
std::string branchName() const
Definition: BranchKey.cc:23
std::string productInstanceName_
Definition: BranchKey.h:45
bool operator!=(ScheduleID const left, ScheduleID const right) noexcept
Definition: ScheduleID.cc:41
std::ostream & operator<<(std::ostream &os, const GroupSelector &gs)
bool operator<(ProductInfo const &a, ProductInfo const &b)
Definition: ProductInfo.cc:51
std::string friendlyClassName_
Definition: BranchKey.h:43
BranchKey()=default
std::string processName_
Definition: BranchKey.h:46
BranchType
Definition: BranchType.h:20
Definition: MVAAlg.h:12
std::string moduleLabel_
Definition: BranchKey.h:44