LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ModuleGraphInfoMap.cc
Go to the documentation of this file.
3 #include "cetlib/container_algorithms.h"
4 
5 #include <algorithm>
6 
12 
13 namespace {
14  auto
15  map_to_vec(collection_map_t const& modules)
16  {
18  cet::copy_all(modules, back_inserter(tmp));
19  return tmp;
20  }
21 }
22 
24  collection_map_t const& modules)
25  : modules_{map_to_vec(modules)}
27  , end_{cend(modules_)}
28 {}
29 
30 auto
32  -> distance_t
33 {
34  auto const it = std::find_if(
35  begin_, end_, [&name](auto const& pr) { return pr.first == name; });
36  if (it == end_) {
37  throw Exception{
39  "An error occurred while constructing the data-dependency graph.\n"}
40  << "The module name '" << name << "' is not included in the set of\n"
41  << "filters and producers configured for this job. This error can\n"
42  << "happen if a 'consumes' statement in one of the modules specifies\n"
43  << "either the current process name or the literal string "
44  "\"current_process\"\n"
45  << "for the input tag. If you have encountered this error under a\n"
46  << "different circumstance, please contact artists@fnal.gov for "
47  "guidance.\n";
48  }
49  return std::distance(begin_, it);
50 }
51 
52 auto
54  -> ModuleGraphInfo const&
55 {
56  return modules_[vertex_index(name)].second;
57 }
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:93
std::vector< collection_map_t::value_type > collection_t
std::map< module_name_t, ModuleGraphInfo > collection_map_t
collection_t::const_iterator const begin_
Float_t tmp
Definition: plot.C:35
collection_t::difference_type distance_t
std::set< std::string > name_set_t
ModuleGraphInfoMap(collection_map_t const &paths)
auto vertex_index(module_name_t const &name) const -> distance_t
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
auto const & info(std::size_t const i) const
auto const & name(std::size_t const i) const
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:85
std::vector< std::string > names_t
std::string module_name_t
collection_t::const_iterator const end_