LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ProductTables.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Provenance_ProductTables_h
2 #define canvas_Persistency_Provenance_ProductTables_h
3 // vim: set sw=2 expandtab :
4 
9 #include "cetlib/exempt_ptr.h"
10 
11 #include <array>
12 
13 namespace art {
14 
15  // A ProductTable is a collection of lookups used in retrieving
16  // (views of) products.
17 
18  struct ProductTable {
19 
20  // A default-constructed ProductTable object represents an invalid table.
21  ProductTable() = default;
23  BranchType bt);
24 
25  cet::exempt_ptr<BranchDescription const> description(ProductID) const;
26  bool isValid{false};
27  ProductDescriptionsByID descriptions{};
30  };
31 
32  // The underlying representation of ProductTables is an array of
33  // ProductTable objects: one for each BranchType value.
34  class ProductTables {
35 
36  public:
38 
39  public:
40  static ProductTables invalid();
41 
42  auto const&
43  descriptions(BranchType const bt) const
44  {
45  return tables_[bt].descriptions;
46  }
47 
48  auto&
49  get(BranchType const bt)
50  {
51  return tables_[bt];
52  }
53 
54  auto const&
55  get(BranchType const bt) const
56  {
57  return tables_[bt];
58  }
59  bool
60  isValid() const
61  {
62  return isValid_;
63  }
64 
65  private:
66  explicit ProductTables() = default;
67 
68  private:
69  bool isValid_{false};
70  std::array<ProductTable, NumBranchTypes> tables_{{}};
71  };
72 
73 } // namespace art
74 
75 #endif /* canvas_Persistency_Provenance_ProductTables_h */
76 
77 // Local Variables:
78 // mode: c++
79 // End:
ProductTable()=default
ProductDescriptionsByID descriptions
Definition: ProductTables.h:27
std::vector< BranchDescription > ProductDescriptions
auto const & descriptions(BranchType const bt) const
Definition: ProductTables.h:43
bool isValid() const
Definition: ProductTables.h:60
cet::exempt_ptr< BranchDescription const > description(ProductID) const
ViewLookup_t viewLookup
Definition: ProductTables.h:29
ProcessLookup ViewLookup_t
Definition: type_aliases.h:18
BranchType
Definition: BranchType.h:20
Definition: MVAAlg.h:12
std::map< ProductID, BranchDescription > ProductDescriptionsByID
ProductLookup_t productLookup
Definition: ProductTables.h:28
std::map< std::string, ProcessLookup > ProductLookup_t
Definition: type_aliases.h:23