LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ModuleContext.h
Go to the documentation of this file.
1 #ifndef art_Persistency_Provenance_ModuleContext_h
2 #define art_Persistency_Provenance_ModuleContext_h
3 
6 
7 namespace art {
8  class ModuleContext {
9  explicit ModuleContext() = default;
10 
11  public:
12  explicit ModuleContext(PathContext const& pathContext,
13  ModuleDescription const& md)
14  : pathContext_{pathContext}, md_{md}
15  {}
16 
17  // This constructor is used in cases where the path context is
18  // unneeded.
19  explicit ModuleContext(ModuleDescription const& md) : md_{md} {}
20 
21  static ModuleContext
23  {
24  return ModuleContext{};
25  }
26 
27  auto
28  scheduleID() const
29  {
30  return pathContext_.scheduleID();
31  }
32  auto const&
33  pathName() const
34  {
35  return pathContext_.pathName();
36  }
37  auto const&
39  {
40  return md_;
41  }
42  auto const&
43  moduleLabel() const
44  {
45  return md_.moduleLabel();
46  }
47  auto const&
48  moduleName() const
49  {
50  return md_.moduleName();
51  }
52  bool
53  onEndPath() const
54  {
55  return pathName() == PathContext::end_path();
56  }
57  bool
58  onTriggerPath() const
59  {
60  return pathName() != PathContext::end_path() &&
61  pathName() != PathContext::art_path() && !pathName().empty();
62  }
63  bool
64  onSamePathAs(std::string const& module_label) const
65  {
66  return pathContext_.contains(module_label);
67  }
68 
69  private:
72  };
73 }
74 
75 #endif /* art_Persistency_Provenance_ModuleContext_h */
76 
77 // Local Variables:
78 // mode: c++
79 // End:
static std::string art_path()
Definition: PathContext.h:26
static std::string end_path()
Definition: PathContext.h:14
auto const & pathName() const
Definition: ModuleContext.h:33
bool onEndPath() const
Definition: ModuleContext.h:53
std::string const & moduleLabel() const
ModuleContext(PathContext const &pathContext, ModuleDescription const &md)
Definition: ModuleContext.h:12
auto scheduleID() const
Definition: ModuleContext.h:28
ModuleContext()=default
bool contains(std::string const &module_label) const
Definition: PathContext.h:74
ModuleContext(ModuleDescription const &md)
Definition: ModuleContext.h:19
PathContext pathContext_
Definition: ModuleContext.h:70
auto scheduleID() const
Definition: PathContext.h:52
auto const & pathName() const
Definition: PathContext.h:63
std::string const & moduleName() const
auto const & moduleName() const
Definition: ModuleContext.h:48
ModuleDescription md_
Definition: ModuleContext.h:71
static PathContext invalid()
Definition: PathContext.h:46
bool onSamePathAs(std::string const &module_label) const
Definition: ModuleContext.h:64
auto const & moduleDescription() const
Definition: ModuleContext.h:38
auto const & moduleLabel() const
Definition: ModuleContext.h:43
bool onTriggerPath() const
Definition: ModuleContext.h:58
Definition: MVAAlg.h:12
static ModuleContext invalid()
Definition: ModuleContext.h:22