14 #include "cetlib/HorizontalRule.h" 15 #include "cetlib/exempt_ptr.h" 16 #include "cetlib_except/exception.h" 19 #include "range/v3/view.hpp" 35 ProductInserter::~ProductInserter() =
default;
40 : branchType_{bt},
principal_{&principal},
md_{&mc.moduleDescription()}
45 bool const checkProducts,
46 map<TypeLabel, BranchDescription>
const* expectedProducts,
47 std::vector<ProductID> retrievedPIDs)
50 std::lock_guard lock{*
mutex_};
52 vector<string> missing;
53 for (
auto const& [typeLabel, bd] : *expectedProducts) {
59 missing.emplace_back(desc.str());
61 if (!missing.empty()) {
63 HorizontalRule rule{25};
64 errmsg <<
"The following products have been declared with 'produces',\n" 65 <<
"but they have not been placed onto the event:\n" 67 for (
auto const& desc : missing) {
68 errmsg << desc << rule(
'=') <<
'\n';
76 auto pp = make_unique<ProductProvenance const>(
89 std::lock_guard lock{*
mutex_};
90 for (
auto&& [product, pd, range_set] :
92 auto pp = make_unique<ProductProvenance const>(pd.productID(),
95 make_unique<RangeSet>(std::move(range_set)) :
97 principal_->
put(pd, std::move(pp), std::move(product), std::move(rs));
106 bool const alwaysEnableLookupOfProducedProducts )
const 108 std::lock_guard lock{*
mutex_};
115 pid, alwaysEnableLookupOfProducedProducts);
116 if (!bd || (bd->producedClassName() != type.
className())) {
122 "ProductInserter::getProductDescription_: error while " 123 "trying to retrieve product description:\n")
124 <<
"No product is registered for\n" 127 <<
" product class name: '" << type.
className() <<
"'\n" 130 <<
" product instance name: '" << instance <<
"'\n"
std::string friendlyClassName() const
std::string const & moduleLabel() const
EDProductGetter const * productGetter_(ProductID id) const
const std::string instance
std::string const & processName() const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) const
EDProductGetter const * productGetter(ProductID id) const
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
void put(BranchDescription const &, std::unique_ptr< ProductProvenance const > &&, std::unique_ptr< EDProduct > &&, std::unique_ptr< RangeSet > &&)
std::string className() const
std::string canonicalProductName(std::string const &friendlyClassName, std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
BranchDescription const & getProductDescription_(TypeID const &type, std::string const &instance, bool const alwaysEnableLookupOfProducedProducts=false) const
std::map< TypeLabel, PMValue > putProducts_
std::unique_ptr< std::recursive_mutex > mutex_
static RangeSet invalid()
constexpr bool range_sets_supported(BranchType const bt)
constexpr ProductStatus present() noexcept
Provenance provenance_(ProductID id) const
ModuleDescription const * md_
Provenance provenance(ProductID id) const