13 info.label =
"input_source";
19 std::map<std::string, std::set<ProductInfo>>
const& produced_products,
22 auto found = produced_products.find(info.label);
23 if (found ==
cend(produced_products)) {
31 return std::binary_search(
35 [](
auto const& a,
auto const& b) {
36 auto const& boundA = std::tie(a.friendlyClassName, a.label, a.instance);
37 auto const& boundB = std::tie(b.friendlyClassName, b.label, b.instance);
38 return boundA < boundB;
47 std::string
const& current_process,
48 std::map<std::string, std::set<ProductInfo>>
const& produced_products)
52 auto const mci = moduleConfig->moduleConfigInfo;
56 if (prod_info.process.name().empty()) {
57 if (!product_match_found(produced_products, prod_info)) {
58 return product_from_input_source(prod_info);
64 auto found_on_path = std::find_if(
65 firstModuleOnPath, moduleConfig, [&prod_info](
auto const& config) {
66 return config.moduleConfigInfo->modDescription.moduleLabel() ==
69 if (found_on_path == moduleConfig) {
70 return product_from_input_source(prod_info);
77 if (prod_info.process.name() != current_process) {
78 return product_from_input_source(prod_info);
82 if (product_match_found(produced_products, prod_info)) {
88 << moduleConfig->moduleConfigInfo->modDescription.moduleLabel()
89 <<
" expects to consume a product from module " << prod_info.label
90 <<
" with the signature:\n" 91 <<
" Friendly class name: " << prod_info.friendlyClassName <<
'\n' 92 <<
" Instance name: " << prod_info.instance <<
'\n' 93 <<
" Process name: " << prod_info.process.name() <<
'\n' 94 <<
"However, no product of that signature is provided by module " 95 << prod_info.label <<
".\n";
99 consumes_view_dependency(
101 std::string
const& module_name,
102 std::string
const& current_process,
103 std::map<std::string, std::set<std::string>>
const& viewable_products)
105 assert(prod_info.consumableType ==
109 if (prod_info.process.name().empty()) {
110 auto ml_found = viewable_products.find(prod_info.label);
111 if (ml_found ==
cend(viewable_products)) {
112 return product_from_input_source(prod_info);
115 auto prod_found = ml_found->second.find(prod_info.instance);
116 if (prod_found ==
cend(ml_found->second)) {
117 return product_from_input_source(prod_info);
126 if (prod_info.process.name() != current_process) {
127 return product_from_input_source(prod_info);
132 "An error occurred while checking data-product dependencies " 134 auto ml_found = viewable_products.find(prod_info.label);
135 if (ml_found ==
cend(viewable_products)) {
136 throw e <<
"Module " << module_name
137 <<
" expects to consume a view of type from module " 138 << prod_info.label <<
".\n" 139 <<
"However, module " << prod_info.label
140 <<
" does not produce a product\n" 141 <<
"for which a view can be formed.\n";
144 auto prod_found = ml_found->second.find(prod_info.instance);
145 if (prod_found ==
cend(ml_found->second)) {
146 throw e <<
"Module " << module_name
147 <<
" expects to consume a view with the following signature:\n" 148 <<
" Module label: " << prod_info.label <<
'\n' 149 <<
" Instance name: " << prod_info.instance <<
'\n' 150 <<
"However, module " << prod_info.label
151 <<
" does not produce a product for which such a view " 158 std::set<ProductInfo>
160 std::string
const& current_process,
161 ConsumesInfo::consumables_t::mapped_type
const& consumables,
162 std::map<std::string, std::set<ProductInfo>>
const& produced_products,
163 std::map<std::string, std::set<std::string>>
const& viewable_products,
167 auto const& module_name =
168 config_it->moduleConfigInfo->modDescription.moduleLabel();
169 std::set<ProductInfo> result;
170 for (
auto const& per_branch_type : consumables) {
171 for (
auto const& prod_info : per_branch_type) {
172 switch (prod_info.consumableType) {
174 auto dep = consumes_dependency(config_begin,
179 result.insert(std::move(dep));
187 auto const& class_name = prod_info.friendlyClassName;
188 for (
auto mit = config_begin; mit != config_it; ++mit) {
189 auto possible_products = produced_products.find(
190 mit->moduleConfigInfo->modDescription.moduleLabel());
191 if (possible_products ==
cend(produced_products)) {
194 cet::copy_if_all(possible_products->second,
195 inserter(result,
begin(result)),
196 [&class_name](
auto const&
pi) {
197 return class_name ==
pi.friendlyClassName;
203 auto dep = consumes_view_dependency(
204 prod_info, module_name, current_process, viewable_products);
205 result.insert(std::move(dep));
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
bool is_modifier(ModuleType const mt)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
std::set< ProductInfo > consumed_products_for_module(std::string const ¤t_process, ConsumesInfo::consumables_t::mapped_type const &consumables, std::map< std::string, std::set< ProductInfo >> const &produced_products, std::map< std::string, std::set< std::string >> const &viewable_products, config_const_iterator const config_begin, config_const_iterator const config_it)
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
std::vector< WorkerInPath::ConfigInfo >::const_iterator config_const_iterator