clang-tidy: add a subset of cppcoreguidelines and other style checks
[lttng-tools.git] / src / bin / lttng-sessiond / ust-registry.hpp
index c438211005bbe9dd78c48ba0410cf0fb2f975075..5d8bdb7cee020407098f78bbce22eab9236fed1f 100644 (file)
@@ -47,30 +47,29 @@ class registry_session;
 
 namespace details {
 
-template <class MappingIntegerType>
-typename trace::typed_enumeration_type<MappingIntegerType>::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 <class MappingIntegerType>
 typename trace::typed_enumeration_type<MappingIntegerType>::mappings mappings_from_ust_ctl_entries(
                const lttng_ust_ctl_enum_entry *in_entries, size_t in_entry_count)
 {
        typename trace::typed_enumeration_type<MappingIntegerType>::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<MappingIntegerType>(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;
@@ -83,6 +82,10 @@ public:
 
        registry_enum(std::string name, enum lttng::sessiond::trace::integer_type::signedness signedness);
        virtual ~registry_enum() = default;
+       registry_enum(const registry_enum&) = delete;
+       registry_enum(registry_enum&&) = delete;
+       registry_enum& operator=(registry_enum&&) = delete;
+       registry_enum& operator=(const registry_enum&) = delete;
 
        std::string name;
        enum lttng::sessiond::trace::integer_type::signedness signedness;
@@ -122,7 +125,7 @@ public:
                        _mappings;
 
 protected:
-       virtual bool _is_equal(const registry_enum& base_other) const noexcept
+       bool _is_equal(const registry_enum& base_other) const noexcept override
        {
                const auto &other = static_cast<decltype(*this)&>(base_other);
 
This page took 0.026159 seconds and 4 git commands to generate.