12#ifndef O2_FRAMEWORK_TYPEIDHELPERS_H_
13#define O2_FRAMEWORK_TYPEIDHELPERS_H_
17#if __cplusplus >= 202002L
18#include <source_location>
24#if defined(__CLING__) || __cplusplus < 202002L
27 static constexpr auto get() noexcept
29 constexpr std::string_view full_name{__PRETTY_FUNCTION__};
33 static constexpr std::string_view
value{
get()};
40#if !defined(__CLING__) && __cplusplus >= 202002L
43consteval static std::string_view type_name_impl(T*)
45 return std::source_location::current().function_name();
52constexpr static std::string_view type_name()
54#if defined(__CLING__) || __cplusplus < 202002L
55 constexpr std::string_view wrapped_name{unique_type_id_v<T>};
57 constexpr std::string_view wrapped_name = type_name_impl<T>(
nullptr);
59 const std::string_view left_marker{
"T = "};
60#if !defined(__clang__) && __cplusplus >= 202002L
61 const std::string_view right_marker{
";"};
63 const std::string_view right_marker{
"]"};
66 const auto left_marker_index = wrapped_name.find(left_marker);
67 const auto start_index = left_marker_index + left_marker.size();
68 const auto end_index = wrapped_name.find(right_marker, left_marker_index);
69 const auto length = end_index - start_index;
70 return wrapped_name.substr(start_index,
length);
78 constexpr uint32_t
r =
crc32(unique_type_id_v<T>.
data(), unique_type_id_v<T>.
size());
87inline static std::string type_to_task_name(std::string_view& camelCase)
89 std::ostringstream
str;
90 str << static_cast<char>(std::tolower(camelCase[0]));
92 for (
auto it = camelCase.begin() + 1; it != camelCase.end(); ++it) {
93 if (std::isupper(*it) && *(it - 1) !=
'-') {
96 str << static_cast<char>(std::tolower(*it));
consteval uint32_t crc32(char const *str, int length)
consteval uint32_t compile_time_hash(char const *str)
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