LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ProductRegistryHelper.cc
Go to the documentation of this file.
2 // vim: set sw=2:
3 
7 #include "cetlib/container_algorithms.h"
8 #include "cetlib_except/exception.h"
9 #include "range/v3/view.hpp"
10 
11 #include <memory>
12 
13 using namespace std;
14 
15 namespace art {
16 
17  ProductRegistryHelper::~ProductRegistryHelper() = default;
18 
19  ProductRegistryHelper::ProductRegistryHelper(product_creation_mode const mode)
20  : mode_{mode}
21  {}
22 
23  void
25  ProductDescriptions& productsToRegister,
26  ModuleDescription const& md)
27  {
28  // Possible products from input source
29  if (productList_) {
30  cet::transform_all(*productList_,
31  back_inserter(productsToRegister),
32  [](auto const& pr) { return pr.second; });
33  }
34 
35  // Now fill the descriptions for products that are to be produced.
36  fillDescriptions(md);
37  auto registerProductsPerBT = [this,
38  &productsToRegister](BranchType const bt) {
40  for (auto const& pd : expectedProducts | ::ranges::views::values) {
41  productsToRegister.push_back(pd);
42  }
43  };
44  for_each_branch_type(registerProductsPerBT);
45  }
46 
47  void
49  {
51  }
52 
53 } // namespace art
STL namespace.
std::vector< BranchDescription > ProductDescriptions
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
std::unique_ptr< ProductList const > productList_
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
void fillDescriptions(ModuleDescription const &md)
void fillDescriptions(ModuleDescription const &md)
TypeLabelLookup_t const & expectedProducts() const
BranchType
Definition: BranchType.h:20
Definition: MVAAlg.h:12
void for_each_branch_type(F f)
Definition: BranchType.h:38
TypeLabelLookup_t const & expectedProducts(BranchType) const