LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PathContext.h
Go to the documentation of this file.
1 #ifndef art_Persistency_Provenance_PathContext_h
2 #define art_Persistency_Provenance_PathContext_h
3 
6 #include "cetlib/container_algorithms.h"
7 
8 namespace art {
9  class PathContext {
10  explicit PathContext() = default;
11 
12  public:
13  static std::string
15  {
16  return "end_path";
17  }
18 
19  static auto
21  {
22  return PathSpec{end_path(), PathID{0}};
23  }
24 
25  static std::string
27  {
28  return "[art]";
29  }
30 
31  static auto
33  {
34  return PathSpec{art_path(), PathID::invalid()};
35  }
36 
37  explicit PathContext(ScheduleContext const& scheduleContext,
38  PathSpec const& pathSpec,
39  std::vector<std::string> sortedModuleNames)
40  : scheduleContext_{scheduleContext}
42  , sortedModuleLabels_{std::move(sortedModuleNames)}
43  {}
44 
45  static PathContext
47  {
48  return PathContext{};
49  }
50 
51  auto
52  scheduleID() const
53  {
54  return scheduleContext_.id();
55  }
56  auto const&
57  pathSpec() const
58  {
59  return pathSpec_;
60  }
61 
62  auto const&
63  pathName() const
64  {
65  return pathSpec_.name;
66  }
67  PathID
68  pathID() const noexcept
69  {
70  return pathSpec_.path_id;
71  }
72 
73  bool
74  contains(std::string const& module_label) const
75  {
76  return cet::binary_search_all(sortedModuleLabels_, module_label);
77  }
78 
79  private:
82  std::vector<std::string> sortedModuleLabels_{};
83  };
84 }
85 
86 #endif /* art_Persistency_Provenance_PathContext_h */
87 
88 // Local Variables:
89 // mode: c++
90 // End:
static std::string art_path()
Definition: PathContext.h:26
static std::string end_path()
Definition: PathContext.h:14
auto const & pathSpec() const
Definition: PathContext.h:57
std::vector< std::string > sortedModuleLabels_
Definition: PathContext.h:82
PathID path_id
Definition: PathSpec.h:49
bool contains(std::string const &module_label) const
Definition: PathContext.h:74
auto scheduleID() const
Definition: PathContext.h:52
auto const & pathName() const
Definition: PathContext.h:63
PathContext(ScheduleContext const &scheduleContext, PathSpec const &pathSpec, std::vector< std::string > sortedModuleNames)
Definition: PathContext.h:37
std::string name
Definition: PathSpec.h:48
static auto end_path_spec()
Definition: PathContext.h:20
PathContext()=default
static PathContext invalid()
Definition: PathContext.h:46
PathID pathID() const noexcept
Definition: PathContext.h:68
constexpr static auto invalid() noexcept
Definition: PathSpec.h:20
static ScheduleContext invalid()
Definition: MVAAlg.h:12
static auto art_path_spec()
Definition: PathContext.h:32
ScheduleContext scheduleContext_
Definition: PathContext.h:80
PathSpec pathSpec_
Definition: PathContext.h:81