LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
art::TypeID Class Reference

#include "TypeID.h"

Public Member Functions

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

Private Attributes

std::type_info const * ti_ {nullptr}
 

Detailed Description

Definition at line 39 of file TypeID.h.

Constructor & Destructor Documentation

art::TypeID::TypeID ( )
default
art::TypeID::TypeID ( std::type_info const &  ti)
inlineexplicit

Definition at line 82 of file TypeID.h.

82 : ti_{&ti} {}
std::type_info const * ti_
Definition: TypeID.h:79
art::TypeID::TypeID ( std::type_info const *  ti)
inlineexplicit

Definition at line 84 of file TypeID.h.

84 : ti_{ti} {}
std::type_info const * ti_
Definition: TypeID.h:79
template<typename T >
art::TypeID::TypeID ( T const &  val)
inlineexplicit

Definition at line 87 of file TypeID.h.

87  : ti_{&typeid(val)}
88 {}
std::type_info const * ti_
Definition: TypeID.h:79

Member Function Documentation

string art::TypeID::className ( ) const

Definition at line 21 of file TypeID.cc.

References art::uniform_type_name().

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

22 {
23  static tbb::concurrent_unordered_map<size_t, string> s_nameMap;
24  auto hash_code = typeInfo().hash_code();
25  auto entry = s_nameMap.find(hash_code);
26  if (entry == s_nameMap.end()) {
27  entry = s_nameMap.emplace(hash_code, uniform_type_name(typeInfo())).first;
28  }
29  return entry->second;
30 }
std::string uniform_type_name(std::type_info const &tid)
std::type_info const & typeInfo() const
Definition: TypeID.h:114
char const * art::TypeID::name ( ) const
inline

Definition at line 91 of file TypeID.h.

References ti_.

92 {
93  return ti_->name();
94 }
std::type_info const * ti_
Definition: TypeID.h:79
art::TypeID::operator bool ( ) const
inlineexplicit

Definition at line 108 of file TypeID.h.

References ti_.

109 {
110  return ti_ != nullptr;
111 }
std::type_info const * ti_
Definition: TypeID.h:79
bool art::TypeID::operator< ( TypeID const &  rhs) const
inline

Definition at line 97 of file TypeID.h.

References ti_.

98 {
99  return ti_->before(*rhs.ti_);
100 }
std::type_info const * ti_
Definition: TypeID.h:79
bool art::TypeID::operator== ( TypeID const &  rhs) const
inline

Definition at line 103 of file TypeID.h.

References ti_.

104 {
105  return *ti_ == *rhs.ti_;
106 }
std::type_info const * ti_
Definition: TypeID.h:79
void art::TypeID::print ( std::ostream &  os) const

Definition at line 15 of file TypeID.cc.

Referenced by art::operator<<().

16 {
17  os << className();
18 }
std::string className() const
Definition: TypeID.cc:21
void art::TypeID::swap ( TypeID other)
inline

Definition at line 120 of file TypeID.h.

References art::swap(), and ti_.

Referenced by art::swap().

121 {
122  using std::swap;
123  swap(ti_, other.ti_);
124 }
void swap(TypeID &, TypeID &)
Definition: TypeID.h:139
void swap(TypeID &other)
Definition: TypeID.h:120
std::type_info const * ti_
Definition: TypeID.h:79
std::type_info const & art::TypeID::typeInfo ( ) const
inline

Definition at line 114 of file TypeID.h.

References ti_.

Referenced by art::RootDelayedReader::getProduct_(), art::AssnsGroup::makePartner(), and art::DataViewImpl::removeNonViewableMatches_().

115 {
116  return *ti_;
117 }
std::type_info const * ti_
Definition: TypeID.h:79

Member Data Documentation

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

Definition at line 79 of file TypeID.h.

Referenced by name(), operator bool(), operator<(), operator==(), swap(), and typeInfo().


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