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

#include "TypeID.h"

Public Member Functions

 ~TypeID () noexcept
 
 TypeID () noexcept
 
 TypeID (std::type_info const &) noexcept
 
 TypeID (std::type_info const *) noexcept
 
template<typename T >
 TypeID (T const &val) noexcept
 
 TypeID (TypeID const &) noexcept
 
 TypeID (TypeID &) noexcept
 
TypeIDoperator= (TypeID const &) noexcept
 
TypeIDoperator= (TypeID &) noexcept
 
std::type_info const & typeInfo () const
 
char const * name () const
 
std::string className () const
 
std::string friendlyClassName () const
 
bool operator< (TypeID const &) const
 
bool operator== (TypeID const &) const
 
 operator bool () const
 
void swap (TypeID &)
 
void print (std::ostream &) const
 

Private Attributes

std::type_info const * ti_ {nullptr}
 

Detailed Description

Definition at line 20 of file TypeID.h.

Constructor & Destructor Documentation

art::TypeID::~TypeID ( )
defaultnoexcept
art::TypeID::TypeID ( )
defaultnoexcept
art::TypeID::TypeID ( std::type_info const &  )
explicitnoexcept
art::TypeID::TypeID ( std::type_info const *  )
explicitnoexcept
template<typename T >
art::TypeID::TypeID ( T const &  val)
explicitnoexcept

Definition at line 49 of file TypeID.h.

49  : ti_{&typeid(val)}
50  {}
std::type_info const * ti_
Definition: TypeID.h:45
art::TypeID::TypeID ( TypeID const &  )
defaultnoexcept
art::TypeID::TypeID ( TypeID )
defaultnoexcept

Member Function Documentation

string art::TypeID::className ( ) const

Definition at line 48 of file TypeID.cc.

References art::uniform_type_name().

Referenced by art::TypeLabel::className(), art::Assns< L, R, void >::className(), art::ProductInserter::getProductDescription_(), art::is_assns(), art::is_instantiation_of(), and art::rootNames::metaBranchRootName().

49  {
50  auto hash_code = typeInfo().hash_code();
51  std::lock_guard sentry{cache_mutex};
52  auto entry = name_cache.find(hash_code);
53  if (entry == name_cache.end()) {
54  entry =
55  name_cache.emplace(hash_code, uniform_type_name(typeInfo())).first;
56  }
57  return entry->second;
58  }
std::string uniform_type_name(std::type_info const &tid)
std::type_info const & typeInfo() const
Definition: TypeID.cc:36
string art::TypeID::friendlyClassName ( ) const
char const * art::TypeID::name ( ) const

Definition at line 42 of file TypeID.cc.

43  {
44  return ti_->name();
45  }
std::type_info const * ti_
Definition: TypeID.h:45
art::TypeID::operator bool ( ) const
explicit

Definition at line 78 of file TypeID.cc.

79  {
80  return ti_ != nullptr;
81  }
std::type_info const * ti_
Definition: TypeID.h:45
bool art::TypeID::operator< ( TypeID const &  rhs) const

Definition at line 67 of file TypeID.cc.

References ti_.

68  {
69  return ti_->before(*rhs.ti_);
70  }
std::type_info const * ti_
Definition: TypeID.h:45
TypeID & art::TypeID::operator= ( TypeID const &  )
defaultnoexcept
TypeID & art::TypeID::operator= ( TypeID )
defaultnoexcept
bool art::TypeID::operator== ( TypeID const &  rhs) const

Definition at line 73 of file TypeID.cc.

References ti_.

74  {
75  return *ti_ == *rhs.ti_;
76  }
std::type_info const * ti_
Definition: TypeID.h:45
void art::TypeID::print ( std::ostream &  os) const

Definition at line 90 of file TypeID.cc.

Referenced by art::operator<<().

91  {
92  os << className();
93  }
std::string className() const
Definition: TypeID.cc:48
void art::TypeID::swap ( TypeID other)

Definition at line 84 of file TypeID.cc.

References art::swap(), and ti_.

Referenced by art::is_assns(), and art::swap().

85  {
86  std::swap(ti_, other.ti_);
87  }
void swap(TypeID &left, TypeID &right)
Definition: TypeID.cc:108
std::type_info const * ti_
Definition: TypeID.h:45
type_info const & art::TypeID::typeInfo ( ) const

Definition at line 36 of file TypeID.cc.

Referenced by art::ProductRetriever::getContainerForView_(), and art::Group::resolveProductIfAvailable().

37  {
38  return *ti_;
39  }
std::type_info const * ti_
Definition: TypeID.h:45

Member Data Documentation

std::type_info const* art::TypeID::ti_ {nullptr}
private

Definition at line 45 of file TypeID.h.

Referenced by operator<(), operator==(), and swap().


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