Public Member Functions | Private Attributes | List of all members
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.

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  }
QList< Entry > entry
int find(const type *d) const
Definition: qlist.h:88
QCollection::Item first()
Definition: qglist.cpp:807
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

Definition at line 61 of file TypeID.cc.

62  {
64  }
std::string className() const
Definition: TypeID.cc:48
std::string friendlyName(std::string const &iFullName)
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.

78 { return ti_ != nullptr; }
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.

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.

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 87 of file TypeID.cc.

88  {
89  os << className();
90  }
std::string className() const
Definition: TypeID.cc:48
void art::TypeID::swap ( TypeID other)

Definition at line 81 of file TypeID.cc.

82  {
83  std::swap(ti_, other.ti_);
84  }
void swap(TypeID &left, TypeID &right)
Definition: TypeID.cc:105
std::type_info const * ti_
Definition: TypeID.h:45
type_info const & art::TypeID::typeInfo ( ) const

Definition at line 36 of file TypeID.cc.

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.


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