ModuleBase.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_ModuleBase_h
2 #define art_Framework_Core_ModuleBase_h
3 // vim: set sw=2 expandtab :
4 
10 
11 #include <array>
12 #include <optional>
13 #include <string>
14 #include <vector>
15 
16 namespace art {
17  class ModuleBase {
18  public:
19  virtual ~ModuleBase() noexcept;
20  ModuleBase();
21 
22  ModuleDescription const& moduleDescription() const;
24 
25  std::array<std::vector<ProductInfo>, NumBranchTypes> const& getConsumables()
26  const;
27  void sortConsumables(std::string const& current_process_name);
28 
29  protected:
30  // Consumes information
32 
33  template <typename T, BranchType = InEvent>
35  template <typename Element, BranchType = InEvent>
37  template <typename T, BranchType = InEvent>
38  void consumesMany();
39 
40  template <typename T, BranchType = InEvent>
42  template <typename Element, BranchType = InEvent>
44  template <typename T, BranchType = InEvent>
45  void mayConsumeMany();
46 
47  private:
48  std::optional<ModuleDescription> md_{std::nullopt};
50  };
51 
52  template <typename T, BranchType BT>
55  {
56  return collector_.consumes<T, BT>(tag);
57  }
58 
59  template <typename T, BranchType BT>
62  {
63  return collector_.consumesView<T, BT>(tag);
64  }
65 
66  template <typename T, BranchType BT>
67  void
69  {
70  collector_.consumesMany<T, BT>();
71  }
72 
73  template <typename T, BranchType BT>
76  {
77  return collector_.mayConsume<T, BT>(tag);
78  }
79 
80  template <typename T, BranchType BT>
83  {
84  return collector_.mayConsumeView<T, BT>(tag);
85  }
86 
87  template <typename T, BranchType BT>
88  void
90  {
92  }
93 
94 } // namespace art
95 
96 #endif /* art_Framework_Core_ModuleBase_h */
97 
98 // Local Variables:
99 // mode: c++
100 // End:
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:49
ConsumesCollector & consumesCollector()
Definition: ModuleBase.cc:53
void mayConsumeMany()
Definition: ModuleBase.h:89
ViewToken< Element > consumesView(InputTag const &)
std::string string
Definition: nybbler.cc:12
ProductToken< T > mayConsume(InputTag const &)
Definition: ModuleBase.h:75
ViewToken< Element > consumesView(InputTag const &)
void sortConsumables(std::string const &current_process_name)
Definition: ModuleBase.cc:45
ProductToken< T > consumes(InputTag const &)
ViewToken< Element > mayConsumeView(InputTag const &)
void setModuleDescription(ModuleDescription const &)
Definition: ModuleBase.cc:33
virtual ~ModuleBase() noexcept
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:48
void consumesMany()
Definition: ModuleBase.h:68
ProductToken< T > consumes(InputTag const &)
Definition: ModuleBase.h:54
ViewToken< Element > mayConsumeView(InputTag const &)
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
Definition: ModuleBase.cc:39
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:15