PtrVectorBase.cc
Go to the documentation of this file.
3 
4 void
6 {
7  if (indicies_.size() == 0)
8  return; // Empty or already done.
10 
11  using std::swap;
12  indices_t tmp;
13  swap(indicies_, tmp); // Zero -- finished with these.
14 }
15 
16 void
17 art::PtrVectorBase::updateCore(RefCore const& productToBeInserted)
18 {
19  if (productToBeInserted.isNull()) {
20  throw art::Exception(errors::InvalidReference, "Inconsistency")
21  << "art::PtrVectorBase::updateCore: Ptr has invalid (zero) product ID,\n"
22  "so it cannot be added to a PtrVector. id should be ("
23  << id() << ")\n";
24  }
25  if (isNull()) {
26  core_ = productToBeInserted;
27  return;
28  }
29  if (core_.id() != productToBeInserted.id()) {
30  throw art::Exception(errors::InvalidReference, "Inconsistency")
31  << "art::PtrVectorBase::updateCore: Ptr is inconsistent with\n"
32  "PtrVector. id = ("
33  << productToBeInserted.id() << "), should be (" << core_.id() << ")\n";
34  }
35  if (core_.productGetter() == nullptr &&
36  productToBeInserted.productGetter() != nullptr) {
37  core_.setProductGetter(productToBeInserted.productGetter());
38  }
39  if (core_.productPtr() == nullptr &&
40  productToBeInserted.productPtr() != nullptr) {
41  core_.setProductPtr(productToBeInserted.productPtr());
42  }
43 }
void swap(PtrVectorBase &)
EDProductGetter const * productGetter() const noexcept
Definition: RefCore.cc:41
ProductID id() const noexcept
Definition: PtrVectorBase.h:80
bool isNull() const noexcept
Definition: PtrVectorBase.h:68
std::vector< key_type > indices_t
Definition: PtrVectorBase.h:22
constexpr bool isNull() const noexcept
Definition: RefCore.h:33
void swap(Handle< T > &a, Handle< T > &b)
string tmp
Definition: languages.py:63
void setProductGetter(EDProductGetter const *) noexcept
Definition: RefCore.cc:57
virtual void fill_from_offsets(indices_t const &indices) const =0
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void const * productPtr() const noexcept
Definition: RefCore.cc:34
void setProductPtr(void const *prodPtr) const noexcept
Definition: RefCore.cc:48
void fillPtrs() const
Definition: PtrVectorBase.cc:5
constexpr ProductID id() const noexcept
Definition: RefCore.h:46
void updateCore(RefCore const &core)