12#ifndef O2_FRAMEWORK_TYPEIDHELPERS_H_
13#define O2_FRAMEWORK_TYPEIDHELPERS_H_
16#if __cplusplus >= 202002L
17#include <source_location>
23#if defined(__CLING__) || __cplusplus < 202002L
26 static constexpr auto get() noexcept
28 constexpr std::string_view full_name{__PRETTY_FUNCTION__};
32 static constexpr std::string_view
value{
get()};
39#if !defined(__CLING__) && __cplusplus >= 202002L
42consteval static std::string_view type_name_impl(T*)
44 return std::source_location::current().function_name();
51constexpr static std::string_view type_name()
53#if defined(__CLING__) || __cplusplus < 202002L
54 constexpr std::string_view wrapped_name{unique_type_id_v<T>};
56 constexpr std::string_view wrapped_name = type_name_impl<T>(
nullptr);
58 const std::string_view left_marker{
"T = "};
59#if !defined(__clang__) && __cplusplus >= 202002L
60 const std::string_view right_marker{
";"};
62 const std::string_view right_marker{
"]"};
65 const auto left_marker_index = wrapped_name.find(left_marker);
66 const auto start_index = left_marker_index + left_marker.size();
67 const auto end_index = wrapped_name.find(right_marker, left_marker_index);
68 const auto length = end_index - start_index;
69 return wrapped_name.substr(start_index,
length);
77 return crc32(unique_type_id_v<T>.
data(), unique_type_id_v<T>.
size());
consteval uint32_t crc32(char const *str, int length)
GLsizei const GLfloat * value
GLuint GLsizei GLsizei * length
Defining PrimaryVertex explicitly as messageable.
constexpr auto unique_type_id_v
static constexpr uint32_t uniqueId()
static constexpr auto get() noexcept