LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
InputTag.h
Go to the documentation of this file.
1 #ifndef canvas_Utilities_InputTag_h
2 #define canvas_Utilities_InputTag_h
3 // vim: set sw=2 expandtab :
4 
5 #include <any>
6 #include <iosfwd>
7 #include <string>
8 #include <tuple>
9 
10 namespace art {
11 
12  class InputTag {
13  public:
14  ~InputTag();
15  InputTag();
16 
17  InputTag(std::string const& label,
18  std::string const& instance,
19  std::string const& processName = {});
20 
21  InputTag(char const* label,
22  char const* instance,
23  char const* processName = "");
24 
25  InputTag(std::string const&);
26 
27  InputTag(char const*);
28 
29  InputTag(InputTag const&);
30  InputTag(InputTag&&);
31 
32  InputTag& operator=(InputTag const&);
33  InputTag& operator=(InputTag&&);
34 
35  bool operator==(InputTag const&) const noexcept;
36 
37  bool empty() const noexcept;
38 
39  std::string const& label() const noexcept;
40  std::string const& instance() const noexcept;
41  std::string const& process() const noexcept;
42 
43  std::string encode() const;
44 
45  private:
46  std::string label_{};
47  std::string instance_{};
48  std::string process_{};
49  };
50 
51  bool operator!=(InputTag const&, InputTag const&);
52 
53  void decode(std::any const&, InputTag&);
54 
55  std::ostream& operator<<(std::ostream&, InputTag const&);
56 
57 } // namespace art
58 
59 // Specialization to allow associative containers with InputTag as the
60 // key type.
61 namespace std {
62  template <>
63  class less<art::InputTag> {
64  public:
65  inline bool
67  art::InputTag const& rhs) const noexcept
68  {
69  auto const& a = std::tie(lhs.label(), lhs.instance(), lhs.process());
70  auto const& b = std::tie(rhs.label(), rhs.instance(), rhs.process());
71  return a < b;
72  }
73  };
74 }
75 
76 #endif /* canvas_Utilities_InputTag_h */
77 
78 // Local Variables:
79 // mode: c++
80 // End:
std::string const & instance() const noexcept
Definition: InputTag.cc:85
std::string label_
Definition: InputTag.h:46
STL namespace.
std::string process_
Definition: InputTag.h:48
bool operator!=(ScheduleID const left, ScheduleID const right) noexcept
Definition: ScheduleID.cc:41
std::string encode() const
Definition: InputTag.cc:97
std::string const & process() const noexcept
Definition: InputTag.cc:91
bool empty() const noexcept
Definition: InputTag.cc:73
bool operator==(InputTag const &) const noexcept
Definition: InputTag.cc:66
std::string const & label() const noexcept
Definition: InputTag.cc:79
std::ostream & operator<<(std::ostream &os, const GroupSelector &gs)
bool operator()(art::InputTag const &lhs, art::InputTag const &rhs) const noexcept
Definition: InputTag.h:66
InputTag & operator=(InputTag const &)
Definition: MVAAlg.h:12
std::string instance_
Definition: InputTag.h:47
void decode(std::any const &a, InputTag &tag)
Definition: InputTag.cc:117