LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
RefCore.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
6 
7 #include <algorithm> // std::swap
8 
9 namespace art {
10 
12  void const* prodPtr,
13  EDProductGetter const* prodGetter) noexcept
14  : itemPtr_{prodPtr}, prodGetter_{prodGetter}
15  {}
16 
18  void const* prodPtr,
19  EDProductGetter const* prodGetter)
20  : id_{id}, transients_{prodPtr, prodGetter}
21  {}
22 
23  bool
25  {
26  if (productPtr()) {
27  return true;
28  }
29  return id_.isValid() && productGetter() != nullptr &&
30  productGetter()->getIt() != nullptr;
31  }
32 
33  void const*
34  RefCore::productPtr() const noexcept
35  {
36  return transients_.itemPtr_;
37  }
38 
39  // Used by isAvailable()
40  EDProductGetter const*
41  RefCore::productGetter() const noexcept
42  {
43  return transients_.prodGetter_;
44  }
45 
46  // Used by RefCoreStreamer on read to set itemPtr_ to the nullptr.
47  void
48  RefCore::setProductPtr(void const* prodPtr) const noexcept
49  {
50  transients_.itemPtr_ = prodPtr;
51  }
52 
53  // Used by RefCoreStreamer on read.
54  // Note: prodGetter_ is actually a Group for art, and a BranchData
55  // or AssnsBranchData for gallery.
56  void
57  RefCore::setProductGetter(EDProductGetter const* prodGetter) noexcept
58  {
59  transients_.prodGetter_ = prodGetter;
60  }
61 
62  void
64  {
65  std::swap(id_, other.id_);
67  }
68 
69  void
70  swap(RefCore& lhs, RefCore& rhs)
71  {
72  lhs.swap(rhs);
73  }
74 
75 } // namespace art
EDProduct const * getIt() const
EDProductGetter const * productGetter() const noexcept
Definition: RefCore.cc:41
constexpr RefCoreTransients()=default
bool isAvailable() const
Definition: RefCore.cc:24
void swap(RefCore &other)
Definition: RefCore.cc:63
constexpr bool isValid() const noexcept
Definition: ProductID.h:34
RefCoreTransients transients_
Definition: RefCore.h:71
constexpr RefCore()=default
ProductID id_
Definition: RefCore.h:70
void setProductGetter(EDProductGetter const *) noexcept
Definition: RefCore.cc:57
void const * productPtr() const noexcept
Definition: RefCore.cc:34
Definition: MVAAlg.h:12
void setProductPtr(void const *prodPtr) const noexcept
Definition: RefCore.cc:48
EDProductGetter const * prodGetter_
Definition: RefCore.h:19
void swap(RefCore &lhs, RefCore &rhs)
Definition: RefCore.cc:70