19 map<size_t, string> name_cache{};
25 TypeID::~TypeID() noexcept = default;
26 TypeID::TypeID() noexcept = default;
27 TypeID::TypeID(TypeID const&) noexcept = default;
28 TypeID::TypeID(TypeID&) noexcept = default;
29 TypeID& TypeID::operator=(TypeID const&) noexcept = default;
30 TypeID& TypeID::operator=(TypeID&) noexcept = default;
32 TypeID::TypeID(type_info const& ti) noexcept : ti_{&ti} {}
33 TypeID::TypeID(type_info
const* ti) noexcept : ti_{ti} {}
36 TypeID::typeInfo()
const 48 TypeID::className()
const 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()) {
61 TypeID::friendlyClassName()
const 69 return ti_->before(*rhs.
ti_);
75 return *ti_ == *rhs.
ti_;
78 TypeID::operator bool()
const 80 return ti_ !=
nullptr;
90 TypeID::print(ostream& os)
const 124 auto comma_count = 0ul;
125 auto template_level = 0ul;
126 auto arg_start = string::npos;
128 pos = template_instance.find_first_of(
"<>,", pos);
129 while (pos != string::npos) {
130 switch (template_instance[pos]) {
133 if ((desired_arg == 0ul) && (template_level == 1ul)) {
140 if ((desired_arg == comma_count) && (template_level == 0ul)) {
144 template_instance.find_last_not_of(
" \t", pos - 1) + 1;
145 result = template_instance.substr(arg_start, arg_end - arg_start);
150 if (template_level != 1ul) {
154 if (comma_count == desired_arg) {
156 result = template_instance.substr(arg_start, pos - arg_start);
160 if (comma_count == desired_arg) {
167 pos = template_instance.find_first_of(
"<>,", pos);
179 static string const assns_start =
"art::Assns<"s;
183 result = assns_start + arg1 +
',' + arg0 +
',' + arg2 +
'>';
195 static string const assns_start =
"art::Assns<"s;
211 <<
"-- attempted to get unwrapped product from non-instance of art::Wrapper."s;
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
constexpr bool operator<(CryostatID const &a, CryostatID const &b)
Order cryostats with increasing ID.
string name_of_assns_partner(string assns_type_name)
ostream & operator<<(ostream &os, TypeID const &tid)
string name_of_unwrapped_product(string const &wrapped_name)
void print(std::ostream &) const
std::string uniform_type_name(std::type_info const &tid)
string name_of_assns_base(string assns_type_name)
bool is_instantiation_of(std::string const &type_name, std::string const &template_name)
string name_of_template_arg(string const &template_instance, size_t desired_arg)
std::string friendlyName(std::string const &iFullName)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
bool operator!=(TypeID const &a, TypeID const &b)
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
bool operator>(TypeID const &a, TypeID const &b)
void swap(TypeID &left, TypeID &right)
bool operator==(infinite_endcount_iterator< T > const &, count_iterator< T > const &)
bool is_assns(std::string const &type_name)
std::type_info const * ti_