X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-registry.hpp;fp=src%2Fbin%2Flttng-sessiond%2Fust-registry.hpp;h=2095cdda3ab3f15c8b04f7794971b784d241b0f7;hb=da9dd5212ebacf388ebe26aa80fd0ddcf7ffe049;hp=c438211005bbe9dd78c48ba0410cf0fb2f975075;hpb=45110cdd99bd9ecc13a12d29afde3fffa48b4641;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-registry.hpp b/src/bin/lttng-sessiond/ust-registry.hpp index c43821100..2095cdda3 100644 --- a/src/bin/lttng-sessiond/ust-registry.hpp +++ b/src/bin/lttng-sessiond/ust-registry.hpp @@ -47,30 +47,29 @@ class registry_session; namespace details { -template -typename trace::typed_enumeration_type::mapping mapping_from_ust_ctl_entry( - const lttng_ust_ctl_enum_entry& entry) -{ - if (entry.u.extra.options & LTTNG_UST_CTL_UST_ENUM_ENTRY_OPTION_IS_AUTO) { - return {entry.string}; - - } else { - return {entry.string, - {(MappingIntegerType) entry.start.value, - (MappingIntegerType) entry.end.value}}; - } -} - template typename trace::typed_enumeration_type::mappings mappings_from_ust_ctl_entries( const lttng_ust_ctl_enum_entry *in_entries, size_t in_entry_count) { typename trace::typed_enumeration_type::mappings mappings; + MappingIntegerType next_range_begin = 0; for (size_t entry_idx = 0; entry_idx < in_entry_count; entry_idx++) { const auto& entry = in_entries[entry_idx]; - - mappings.emplace_back(mapping_from_ust_ctl_entry(entry)); + MappingIntegerType range_begin, range_end; + + if (entry.u.extra.options & LTTNG_UST_CTL_UST_ENUM_ENTRY_OPTION_IS_AUTO) { + range_begin = range_end = next_range_begin; + } else { + range_begin = (MappingIntegerType) entry.start.value; + range_end = (MappingIntegerType) entry.end.value; + } + + next_range_begin = range_end + 1; + mappings.emplace_back(entry.string, + typename trace::typed_enumeration_type< + MappingIntegerType>::mapping::range_t{ + range_begin, range_end}); } return mappings;