#include "ProductInserter.h"
Definition at line 37 of file ProductInserter.h.
art::ProductInserter::~ProductInserter |
( |
| ) |
|
|
default |
void art::ProductInserter::commitProducts |
( |
| ) |
|
Definition at line 87 of file ProductInserter.cc.
References branchType_, art::RangeSet::invalid(), mutex_, art::productstatus::present(), principal_, art::Principal::put(), putProducts_, art::detail::range_sets_supported(), and util::values().
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));
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::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
Definition at line 44 of file ProductInserter.cc.
References branchType_, art::InEvent, art::RangeSet::invalid(), art::errors::LogicError, mutex_, art::productstatus::present(), principal_, art::Principal::put(), putProducts_, and util::values().
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>(
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 > &&)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::map< TypeLabel, PMValue > putProducts_
std::unique_ptr< std::recursive_mutex > mutex_
static RangeSet invalid()
constexpr ProductStatus present() noexcept
BranchDescription const & art::ProductInserter::getProductDescription_ |
( |
TypeID const & |
type, |
|
|
std::string const & |
instance, |
|
|
bool const |
alwaysEnableLookupOfProducedProducts = false |
|
) |
| const |
|
private |
Definition at line 103 of file ProductInserter.cc.
References branchType_, art::canonicalProductName(), art::TypeID::className(), art::TypeID::friendlyClassName(), art::Principal::getProductDescription(), instance, md_, art::ModuleDescription::moduleLabel(), mutex_, principal_, art::ModuleDescription::processName(), and art::errors::ProductRegistrationFailure.
Referenced by put().
108 std::lock_guard lock{*
mutex_};
113 ProductID
const pid{product_name};
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" 128 <<
" product friendly class name: '" <<
type.friendlyClassName()
130 <<
" product instance name: '" <<
instance <<
"'\n" std::string const & moduleLabel() const
const std::string instance
std::string const & processName() const
cet::exempt_ptr< BranchDescription const > getProductDescription(ProductID const pid, bool const alwaysEnableLookupOfProducedProducts=false) 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
std::unique_ptr< std::recursive_mutex > mutex_
ModuleDescription const * md_
template<typename PROD >
PutHandle< PROD > art::ProductInserter::put |
( |
std::unique_ptr< PROD > && |
edp, |
|
|
std::string const & |
instance = {} |
|
) |
| |
Definition at line 102 of file ProductInserter.h.
References art::RangeSet::invalid().
const std::string instance
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
static RangeSet invalid()
template<typename PROD >
PutHandle< PROD > art::ProductInserter::put |
( |
std::unique_ptr< PROD > && |
edp, |
|
|
std::string const & |
instance, |
|
|
RangeSet const & |
rs |
|
) |
| |
Definition at line 109 of file ProductInserter.h.
References getProductDescription_(), art::ProductID::invalid(), md_, mutex_, art::errors::NullPointerError, art::ProductInserter::PMValue::product, productGetter_(), art::errors::ProductPutFailure, putProducts_, and art::detail::type_label_for().
113 TypeID
const tid{
typeid(PROD)};
116 <<
"A null unique_ptr was passed to 'put'.\n" 117 <<
"The pointer is of type " << tid <<
".\n" 118 <<
"The specified productInstanceName was '" <<
instance <<
"'.\n";
121 std::lock_guard lock{*
mutex_};
124 auto const typeLabel =
126 auto wp = std::make_unique<Wrapper<PROD>>(std::move(edp));
130 cet::exempt_ptr<PROD const> product{wp->product()};
132 putProducts_.try_emplace(typeLabel, PMValue{std::move(wp), bd, rs})
135 constexpr cet::HorizontalRule rule{30};
137 <<
"Attempt to put multiple products with the following descriptions.\n" 138 <<
"Each product must be unique.\n" 140 << bd << rule(
'=') <<
'\n';
EDProductGetter const * productGetter_(ProductID id) const
TypeLabel type_label_for(TypeID const typeID, std::string const &instance, bool const supportsView, ModuleDescription const &md)
const std::string instance
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 constexpr ProductID invalid() noexcept
second_as<> second
Type of time stored in seconds, in double precision.
ModuleDescription const * md_
std::unique_ptr<std::recursive_mutex> art::ProductInserter::mutex_ |
|
mutableprivate |
The documentation for this class was generated from the following files: