3 #include "cetlib/HorizontalRule.h" 4 #include "cetlib/container_algorithms.h" 18 case ConsumableType::Product:
21 case ConsumableType::Many:
22 result +=
"consumesMany";
24 case ConsumableType::ViewElement:
25 result +=
"consumesView";
31 result +=
", art::In";
64 module_context(cet::exempt_ptr<ModuleDescription const> md)
66 std::string result{
"module label: '"};
67 result += (md ? md->moduleLabel() :
"<invalid>");
68 result +=
"' of class type '";
69 result += (md ? md->moduleName() :
"<invalid>");
75 cet::exempt_ptr<art::Consumer>
85 moduleDescription_ = &md;
95 for (
auto& consumablesPerBranch : consumables_) {
96 cet::sort_all(consumablesPerBranch);
109 if (cet::binary_search_all(consumables_[bt], pi))
112 if (requireConsumes_) {
114 "Consumer: an error occurred during validation of a " 115 "retrieved product\n\n")
116 <<
"The following consumes (or mayConsume) statement is missing from\n" 117 << module_context(moduleDescription_) <<
":\n\n" 118 <<
" " << assemble_consumes_statement(bt, pi) <<
"\n\n";
121 missingConsumes_[bt].insert(pi);
131 if (std::all_of(cbegin(missingConsumes_),
132 cend(missingConsumes_),
133 [](
auto const& perBranch) {
return perBranch.empty(); }))
136 constexpr cet::HorizontalRule rule{60};
140 <<
"The following consumes (or mayConsume) statements are missing from\n" 141 << module_context(moduleDescription_) <<
'\n' 142 << rule(
'-') <<
'\n';
144 cet::for_all_with_index(
145 missingConsumes_, [&log](std::size_t
const i,
auto const& perBranch) {
146 for (
auto const& pi : perBranch) {
148 << assemble_consumes_statement(static_cast<BranchType>(i), pi)
static cet::exempt_ptr< Consumer > non_module_context()
void setModuleDescription(ModuleDescription const &md)
bool get_if_present(std::string const &key, T &value) const
std::string className() const
std::string const & BranchTypeToString(BranchType const bt)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
void prepareForJob(fhicl::ParameterSet const &pset)
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
void showMissingConsumes() const
ConsumableType consumableType_
void validateConsumedProduct(BranchType const bt, ProductInfo const &pi)