Public Member Functions | Private Attributes | List of all members
art::detail::KeptProvenance Class Reference

#include <KeptProvenance.h>

Public Member Functions

 ~KeptProvenance ()
 
 KeptProvenance (DropMetaData dropMetaData, bool dropMetaDataForDroppedData, std::set< ProductID > &branchesWithStoredHistory)
 
ProductProvenance const & insert (ProductProvenance const &)
 
ProductProvenance const & emplace (ProductID, ProductStatus)
 
void setStatus (ProductProvenance const &, ProductStatus)
 
auto begin () const
 
auto end () const
 
void insertAncestors (ProductProvenance const &iGetParents, Principal const &principal)
 

Private Attributes

DropMetaData const dropMetaData_
 
bool const dropMetaDataForDroppedData_
 
std::set< ProductID > & branchesWithStoredHistory_
 
std::set< ProductProvenanceprovenance_ {}
 

Detailed Description

Definition at line 22 of file KeptProvenance.h.

Constructor & Destructor Documentation

art::detail::KeptProvenance::~KeptProvenance ( )
default
art::detail::KeptProvenance::KeptProvenance ( DropMetaData  dropMetaData,
bool  dropMetaDataForDroppedData,
std::set< ProductID > &  branchesWithStoredHistory 
)

Definition at line 17 of file KeptProvenance.cc.

20  : dropMetaData_{dropMetaData}
21  , dropMetaDataForDroppedData_{dropMetaDataForDroppedData}
22  , branchesWithStoredHistory_{branchesWithStoredHistory}
23  {}
DropMetaData const dropMetaData_
bool const dropMetaDataForDroppedData_
std::set< ProductID > & branchesWithStoredHistory_

Member Function Documentation

auto art::detail::KeptProvenance::begin ( ) const
inline

Definition at line 36 of file KeptProvenance.h.

37  {
38  return provenance_.begin();
39  }
std::set< ProductProvenance > provenance_
ProductProvenance const & art::detail::KeptProvenance::emplace ( ProductID  pid,
ProductStatus  status 
)

Definition at line 32 of file KeptProvenance.cc.

33  {
34  return *provenance_.emplace(pid, status).first;
35  }
std::set< ProductProvenance > provenance_
auto art::detail::KeptProvenance::end ( ) const
inline

Definition at line 42 of file KeptProvenance.h.

43  {
44  return provenance_.end();
45  }
std::set< ProductProvenance > provenance_
ProductProvenance const & art::detail::KeptProvenance::insert ( ProductProvenance const &  pp)

Definition at line 26 of file KeptProvenance.cc.

27  {
28  return *provenance_.insert(pp).first;
29  }
std::set< ProductProvenance > provenance_
void art::detail::KeptProvenance::insertAncestors ( ProductProvenance const &  iGetParents,
Principal const &  principal 
)

Definition at line 38 of file KeptProvenance.cc.

40  {
41  vector<ProductProvenance const*> stacked_pp;
42  stacked_pp.push_back(&pp);
43  while (1) {
44  if (stacked_pp.size() == 0) {
45  break;
46  }
47  ProductProvenance const* current_pp = stacked_pp.back();
48  stacked_pp.pop_back();
49  for (auto const parent_pid : current_pp->parentage().parents()) {
50  auto parent_pp =
51  principal.branchMapper().branchToProductProvenance(parent_pid);
52  if (!parent_pp || (dropMetaData_ != DropMetaData::DropNone)) {
53  continue;
54  }
55 
56  // These two data structures should be in sync.
57  branchesWithStoredHistory_.insert(parent_pid);
58  provenance_.insert(*parent_pp);
59 
60  auto const* parent_bd =
61  principal.getForOutput(parent_pp->productID(), false).desc();
62 
63  if (!parent_bd) {
64  // FIXME: Is this an error condition?
65  continue;
66  }
67  if (!parent_bd->produced()) {
68  // We got it from the input, nothing to do.
69  continue;
70  }
73  stacked_pp.push_back(parent_pp.get());
74  }
75  }
76  }
77  }
DropMetaData const dropMetaData_
bool const dropMetaDataForDroppedData_
std::set< ProductProvenance > provenance_
std::set< ProductID > & branchesWithStoredHistory_
void art::detail::KeptProvenance::setStatus ( ProductProvenance const &  key,
ProductStatus  status 
)

Definition at line 80 of file KeptProvenance.cc.

82  {
83  if (provenance_.erase(key) != 1ull) {
84  throw Exception(errors::LogicError, "KeptProvenance::setStatus")
85  << "Attempt to set product status for product whose provenance is "
86  "not "
87  "being recorded.\n";
88  }
89  provenance_.emplace(key.productID(), status);
90  }
std::set< ProductProvenance > provenance_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66

Member Data Documentation

std::set<ProductID>& art::detail::KeptProvenance::branchesWithStoredHistory_
private

Definition at line 53 of file KeptProvenance.h.

DropMetaData const art::detail::KeptProvenance::dropMetaData_
private

Definition at line 51 of file KeptProvenance.h.

bool const art::detail::KeptProvenance::dropMetaDataForDroppedData_
private

Definition at line 52 of file KeptProvenance.h.

std::set<ProductProvenance> art::detail::KeptProvenance::provenance_ {}
private

Definition at line 54 of file KeptProvenance.h.


The documentation for this class was generated from the following files: