LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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);
28 
29  TypeLabel(TypeID const& itemtype,
30  std::string const& instanceName,
31  bool const supportsView,
32  std::string emulatedModule);
33 
34  auto const&
35  typeID() const
36  {
37  return typeID_;
38  }
39  std::string
40  className() const
41  {
42  return typeID_.className();
43  }
44  std::string
46  {
47  return typeID_.friendlyClassName();
48  }
49  std::string const& emulatedModule() const;
50  std::string const&
52  {
53  return productInstanceName_;
54  }
55  bool
57  {
58  return static_cast<bool>(emulatedModule_);
59  }
60  bool
61  supportsView() const
62  {
63  return supportsView_;
64  }
65  bool
66  transient() const
67  {
68  return transient_;
69  }
70 
71  private:
73  std::string productInstanceName_;
75  bool transient_{false};
76  std::shared_ptr<std::string> emulatedModule_{
77  nullptr}; // shared so TypeLabel is copyable
78  friend bool operator<(TypeLabel const& a, TypeLabel const& b);
79  friend std::ostream& operator<<(std::ostream& os, TypeLabel const& tl);
80  };
81 
82  bool operator<(TypeLabel const& a, TypeLabel const& b);
83  std::ostream& operator<<(std::ostream& os, TypeLabel const& tl);
84 
85 } // namespace art
86 
87 #endif /* canvas_Persistency_Provenance_TypeLabel_h */
88 
89 // Local Variables:
90 // mode: c++
91 // End:
std::string const & productInstanceName() const
Definition: TypeLabel.h:51
friend std::ostream & operator<<(std::ostream &os, TypeLabel const &tl)
Definition: TypeLabel.cc:58
std::string const & emulatedModule() const
Definition: TypeLabel.cc:31
std::shared_ptr< std::string > emulatedModule_
Definition: TypeLabel.h:76
std::string friendlyClassName() const
Definition: TypeID.cc:33
bool hasEmulatedModule() const
Definition: TypeLabel.h:56
bool supportsView() const
Definition: TypeLabel.h:61
TypeID typeID_
Definition: TypeLabel.h:72
friend bool operator<(TypeLabel const &a, TypeLabel const &b)
Definition: TypeLabel.cc:45
TypeLabel(TypeID const &itemtype, std::string const &instanceName, bool const supportsView, bool const transient)
Definition: TypeLabel.cc:10
bool transient_
Definition: TypeLabel.h:75
std::string className() const
Definition: TypeID.cc:21
auto const & typeID() const
Definition: TypeLabel.h:35
std::string productInstanceName_
Definition: TypeLabel.h:73
std::string friendlyClassName() const
Definition: TypeLabel.h:45
HLT enums.
std::string className() const
Definition: TypeLabel.h:40
bool supportsView_
Definition: TypeLabel.h:74