LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
TypeLabel.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Provenance_TypeLabel_h
2 #define canvas_Persistency_Provenance_TypeLabel_h
3 // vim: set sw=2 expandtab :
4 
5 //================================================================
6 // TypeLabel provides in-memory type information for use in
7 // constructing BranchDescription objects, etc.
8 //
9 // FIXME: A cleanup of the abstractions is required:
10 // - Does the 'transient' data mamber belong here? If so, what
11 // values should it have?
12 //================================================================
13 
15 
16 #include <iosfwd>
17 #include <memory>
18 #include <string>
19 
20 namespace art {
21 
22  class TypeLabel {
23  public:
24  TypeLabel(TypeID const& itemtype,
25  std::string const& instanceName,
26  bool const supportsView,
27  bool const transient = false);
28 
29  TypeLabel(TypeID const& itemtype,
30  std::string const& instanceName,
31  bool const supportsView,
32  std::string emulatedModule);
33  ~TypeLabel();
34 
35  auto const&
36  typeID() const
37  {
38  return typeID_;
39  }
40  std::string
41  className() const
42  {
43  return typeID_.className();
44  }
45  std::string
47  {
48  return typeID_.friendlyClassName();
49  }
50  std::string const& emulatedModule() const;
51  std::string const&
53  {
54  return productInstanceName_;
55  }
56  bool
58  {
59  return static_cast<bool>(emulatedModule_);
60  }
61  bool
62  supportsView() const
63  {
64  return supportsView_;
65  }
66  bool
67  transient() const
68  {
69  return transient_;
70  }
71 
72  private:
74  std::string productInstanceName_;
76  bool transient_{false};
77  std::shared_ptr<std::string> emulatedModule_{
78  nullptr}; // shared so TypeLabel is copyable
79  friend bool operator<(TypeLabel const& a, TypeLabel const& b);
80  friend std::ostream& operator<<(std::ostream& os, TypeLabel const& tl);
81  };
82 
83  bool operator<(TypeLabel const& a, TypeLabel const& b);
84  std::ostream& operator<<(std::ostream& os, TypeLabel const& tl);
85 
86 } // namespace art
87 
88 #endif /* canvas_Persistency_Provenance_TypeLabel_h */
89 
90 // Local Variables:
91 // mode: c++
92 // End:
std::string const & productInstanceName() const
Definition: TypeLabel.h:52
friend std::ostream & operator<<(std::ostream &os, TypeLabel const &tl)
Definition: TypeLabel.cc:59
std::string const & emulatedModule() const
Definition: TypeLabel.cc:33
std::shared_ptr< std::string > emulatedModule_
Definition: TypeLabel.h:77
TypeLabel(TypeID const &itemtype, std::string const &instanceName, bool const supportsView, bool const transient=false)
Definition: TypeLabel.cc:10
std::string friendlyClassName() const
Definition: TypeID.cc:61
bool hasEmulatedModule() const
Definition: TypeLabel.h:57
bool supportsView() const
Definition: TypeLabel.h:62
TypeID typeID_
Definition: TypeLabel.h:73
friend bool operator<(TypeLabel const &a, TypeLabel const &b)
Definition: TypeLabel.cc:46
bool transient_
Definition: TypeLabel.h:76
std::string className() const
Definition: TypeID.cc:48
auto const & typeID() const
Definition: TypeLabel.h:36
std::string productInstanceName_
Definition: TypeLabel.h:74
std::string friendlyClassName() const
Definition: TypeLabel.h:46
Definition: MVAAlg.h:12
std::string className() const
Definition: TypeLabel.h:41
bool supportsView_
Definition: TypeLabel.h:75