LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::TypeLabel Class Reference

#include "TypeLabel.h"

Public Member Functions

 TypeLabel (TypeID const &itemtype, std::string const &instanceName, bool const supportsView, bool const transient=false)
 
 TypeLabel (TypeID const &itemtype, std::string const &instanceName, bool const supportsView, std::string emulatedModule)
 
 ~TypeLabel ()
 
auto const & typeID () const
 
std::string className () const
 
std::string friendlyClassName () const
 
std::string const & emulatedModule () const
 
std::string const & productInstanceName () const
 
bool hasEmulatedModule () const
 
bool supportsView () const
 
bool transient () const
 

Private Attributes

TypeID typeID_
 
std::string productInstanceName_
 
bool supportsView_
 
bool transient_ {false}
 
std::shared_ptr< std::string > emulatedModule_
 

Friends

bool operator< (TypeLabel const &a, TypeLabel const &b)
 
std::ostream & operator<< (std::ostream &os, TypeLabel const &tl)
 

Detailed Description

Definition at line 22 of file TypeLabel.h.

Constructor & Destructor Documentation

art::TypeLabel::TypeLabel ( TypeID const &  itemtype,
std::string const &  instanceName,
bool const  supportsView,
bool const  transient = false 
)

Definition at line 10 of file TypeLabel.cc.

References productInstanceName_, supportsView(), supportsView_, and transient_.

14  : typeID_{itemtype}
15  , productInstanceName_{instanceName}
17  , transient_{transient}
18  {}
bool supportsView() const
Definition: TypeLabel.h:62
TypeID typeID_
Definition: TypeLabel.h:73
bool transient_
Definition: TypeLabel.h:76
std::string productInstanceName_
Definition: TypeLabel.h:74
bool supportsView_
Definition: TypeLabel.h:75
art::TypeLabel::TypeLabel ( TypeID const &  itemtype,
std::string const &  instanceName,
bool const  supportsView,
std::string  emulatedModule 
)

Definition at line 20 of file TypeLabel.cc.

References emulatedModule(), emulatedModule_, productInstanceName_, supportsView(), supportsView_, and ~TypeLabel().

24  : typeID_{itemtype}
25  , productInstanceName_{instanceName}
27  , emulatedModule_{std::make_unique<std::string>(std::move(emulatedModule))}
28  {}
std::string const & emulatedModule() const
Definition: TypeLabel.cc:33
std::shared_ptr< std::string > emulatedModule_
Definition: TypeLabel.h:77
bool supportsView() const
Definition: TypeLabel.h:62
TypeID typeID_
Definition: TypeLabel.h:73
std::string productInstanceName_
Definition: TypeLabel.h:74
bool supportsView_
Definition: TypeLabel.h:75
art::TypeLabel::~TypeLabel ( )
default

Referenced by TypeLabel().

Member Function Documentation

std::string art::TypeLabel::className ( ) const
inline

Definition at line 41 of file TypeLabel.h.

References art::TypeID::className(), and typeID_.

Referenced by art::BranchDescription::BranchDescription(), art::ProducesCollector::insertOrThrow(), art::operator<(), and art::operator<<().

42  {
43  return typeID_.className();
44  }
TypeID typeID_
Definition: TypeLabel.h:73
std::string className() const
Definition: TypeID.cc:48
std::string const & art::TypeLabel::emulatedModule ( ) const

Definition at line 33 of file TypeLabel.cc.

References emulatedModule_, and art::errors::NullPointerError.

Referenced by art::BranchDescription::BranchDescription(), friendlyClassName(), art::operator<<(), and TypeLabel().

34  {
35  if (!emulatedModule_) {
36  throw Exception(errors::NullPointerError, "TypeLabel::emulatedModule\n")
37  << "Attempt to retrieve an emulated module name when one does not "
38  "exist.\n";
39  }
40  return *emulatedModule_;
41  }
std::shared_ptr< std::string > emulatedModule_
Definition: TypeLabel.h:77
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string art::TypeLabel::friendlyClassName ( ) const
inline

Definition at line 46 of file TypeLabel.h.

References emulatedModule(), art::TypeID::friendlyClassName(), and typeID_.

47  {
48  return typeID_.friendlyClassName();
49  }
std::string friendlyClassName() const
Definition: TypeID.cc:61
TypeID typeID_
Definition: TypeLabel.h:73
bool art::TypeLabel::hasEmulatedModule ( ) const
inline

Definition at line 57 of file TypeLabel.h.

References emulatedModule_.

Referenced by art::BranchDescription::BranchDescription(), art::operator<(), and art::operator<<().

58  {
59  return static_cast<bool>(emulatedModule_);
60  }
std::shared_ptr< std::string > emulatedModule_
Definition: TypeLabel.h:77
std::string const& art::TypeLabel::productInstanceName ( ) const
inline

Definition at line 52 of file TypeLabel.h.

References productInstanceName_.

Referenced by art::BranchDescription::BranchDescription(), art::ProducesCollector::insertOrThrow(), and art::operator<<().

53  {
54  return productInstanceName_;
55  }
std::string productInstanceName_
Definition: TypeLabel.h:74
bool art::TypeLabel::supportsView ( ) const
inline

Definition at line 62 of file TypeLabel.h.

References supportsView_.

Referenced by art::BranchDescription::BranchDescription(), art::operator<<(), and TypeLabel().

63  {
64  return supportsView_;
65  }
bool supportsView_
Definition: TypeLabel.h:75
bool art::TypeLabel::transient ( ) const
inline

Definition at line 67 of file TypeLabel.h.

References transient_.

Referenced by art::BranchDescription::BranchDescription(), and art::operator<<().

68  {
69  return transient_;
70  }
bool transient_
Definition: TypeLabel.h:76
auto const& art::TypeLabel::typeID ( ) const
inline

Definition at line 36 of file TypeLabel.h.

References typeID_.

37  {
38  return typeID_;
39  }
TypeID typeID_
Definition: TypeLabel.h:73

Friends And Related Function Documentation

bool operator< ( TypeLabel const &  a,
TypeLabel const &  b 
)
friend

Definition at line 46 of file TypeLabel.cc.

47  {
48  auto const& a_class_name = a.className();
49  auto const& b_class_name = b.className();
50  auto const& a_emulated_module =
51  a.hasEmulatedModule() ? *a.emulatedModule_ : "<none>";
52  auto const& b_emulated_module =
53  b.hasEmulatedModule() ? *b.emulatedModule_ : "<none>";
54  return std::tie(a_emulated_module, a.productInstanceName_, a_class_name) <
55  std::tie(b_emulated_module, b.productInstanceName_, b_class_name);
56  }
std::ostream& operator<< ( std::ostream &  os,
TypeLabel const &  tl 
)
friend

Definition at line 59 of file TypeLabel.cc.

60  {
61  os << "Emulated module: '"
62  << (tl.hasEmulatedModule() ? tl.emulatedModule() : "<none>") << "'\n"
63  << "Product instance name: '" << tl.productInstanceName() << "'\n"
64  << "Class name: '" << tl.className() << "'\n"
65  << "Supports views: '" << std::boolalpha << tl.supportsView()
66  << '\n'
67  << "Transient: '" << tl.transient();
68  return os;
69  }

Member Data Documentation

std::shared_ptr<std::string> art::TypeLabel::emulatedModule_
private
Initial value:
{
nullptr}

Definition at line 77 of file TypeLabel.h.

Referenced by emulatedModule(), hasEmulatedModule(), art::operator<(), and TypeLabel().

std::string art::TypeLabel::productInstanceName_
private

Definition at line 74 of file TypeLabel.h.

Referenced by art::operator<(), productInstanceName(), and TypeLabel().

bool art::TypeLabel::supportsView_
private

Definition at line 75 of file TypeLabel.h.

Referenced by supportsView(), and TypeLabel().

bool art::TypeLabel::transient_ {false}
private

Definition at line 76 of file TypeLabel.h.

Referenced by transient(), and TypeLabel().

TypeID art::TypeLabel::typeID_
private

Definition at line 73 of file TypeLabel.h.

Referenced by className(), friendlyClassName(), and typeID().


The documentation for this class was generated from the following files: