cpp-common: add `begin()` and `end()` to bt2::CommonEnumerationFieldClass
[babeltrace.git] / src / cpp-common / bt2 / field-class.hpp
index dc25d4cfcda310f186057e6c80e5cb189a34d010..c94e2cef5dbfe1b62abaa56626356b658cb9bd08 100644 (file)
@@ -14,6 +14,7 @@
 #include "common/assert.h"
 #include "internal/borrowed-obj.hpp"
 #include "internal/shared-obj.hpp"
+#include "internal/utils.hpp"
 #include "cpp-common/optional.hpp"
 #include "cpp-common/string_view.hpp"
 #include "common-iter.hpp"
@@ -23,7 +24,6 @@
 #include "value.hpp"
 
 namespace bt2 {
-
 namespace internal {
 
 struct FieldClassRefFuncs final
@@ -161,10 +161,10 @@ enum class FieldClassType
 template <typename LibObjT>
 class CommonFieldClass : public internal::BorrowedObj<LibObjT>
 {
-    /* Allow appendMember() to call `fc._libObjPtr()` */
+    /* Allow appendMember() to call `fc.libObjPtr()` */
     friend class CommonStructureFieldClass<bt_field_class>;
 
-    /* Allow appendOption() to call `fc._libObjPtr()` */
+    /* Allow appendOption() to call `fc.libObjPtr()` */
     friend class CommonVariantWithoutSelectorFieldClass<bt_field_class>;
 
     friend class CommonVariantWithIntegerSelectorFieldClass<
@@ -177,11 +177,11 @@ class CommonFieldClass : public internal::BorrowedObj<LibObjT>
         ConstVariantWithIntegerSelectorFieldClassOption<
             const bt_field_class_variant_with_selector_field_integer_signed_option>>;
 
-    /* Allow *FieldClass() to call `fc._libObjPtr()` */
+    /* Allow *FieldClass() to call `fc.libObjPtr()` */
     friend class CommonEventClass<bt_event_class>;
     friend class CommonStreamClass<bt_stream_class>;
 
-    /* Allow create*FieldClass() to call `fc._libObjPtr()` */
+    /* Allow create*FieldClass() to call `fc.libObjPtr()` */
     friend class CommonTraceClass<bt_trace_class>;
 
 private:
@@ -215,7 +215,7 @@ public:
 
     FieldClassType type() const noexcept
     {
-        return static_cast<FieldClassType>(bt_field_class_get_type(this->_libObjPtr()));
+        return static_cast<FieldClassType>(bt_field_class_get_type(this->libObjPtr()));
     }
 
     bool isBool() const noexcept
@@ -417,19 +417,19 @@ public:
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
-        bt_field_class_set_user_attributes(this->_libObjPtr(), userAttrs._libObjPtr());
+        bt_field_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr());
     }
 
     ConstMapValue userAttributes() const noexcept
     {
         return ConstMapValue {internal::CommonFieldClassSpec<const bt_field_class>::userAttributes(
-            this->_libObjPtr())};
+            this->libObjPtr())};
     }
 
     UserAttributes userAttributes() noexcept
     {
         return UserAttributes {
-            internal::CommonFieldClassSpec<LibObjT>::userAttributes(this->_libObjPtr())};
+            internal::CommonFieldClassSpec<LibObjT>::userAttributes(this->libObjPtr())};
     }
 
     Shared shared() const noexcept
@@ -440,13 +440,33 @@ public:
 protected:
     bool _libTypeIs(const bt_field_class_type type) const noexcept
     {
-        return bt_field_class_type_is(bt_field_class_get_type(this->_libObjPtr()), type);
+        return bt_field_class_type_is(bt_field_class_get_type(this->libObjPtr()), type);
     }
 };
 
 using FieldClass = CommonFieldClass<bt_field_class>;
 using ConstFieldClass = CommonFieldClass<const bt_field_class>;
 
+namespace internal {
+
+struct FieldClassTypeDescr
+{
+    using Const = ConstFieldClass;
+    using NonConst = FieldClass;
+};
+
+template <>
+struct TypeDescr<FieldClass> : public FieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstFieldClass> : public FieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
 template <typename LibObjT>
 class CommonBitArrayFieldClass final : public CommonFieldClass<LibObjT>
 {
@@ -479,7 +499,7 @@ public:
 
     std::uint64_t length() const noexcept
     {
-        return bt_field_class_bit_array_get_length(this->_libObjPtr());
+        return bt_field_class_bit_array_get_length(this->libObjPtr());
     }
 
     Shared shared() const noexcept
@@ -491,6 +511,26 @@ public:
 using BitArrayFieldClass = CommonBitArrayFieldClass<bt_field_class>;
 using ConstBitArrayFieldClass = CommonBitArrayFieldClass<const bt_field_class>;
 
+namespace internal {
+
+struct BitArrayFieldClassTypeDescr
+{
+    using Const = ConstBitArrayFieldClass;
+    using NonConst = BitArrayFieldClass;
+};
+
+template <>
+struct TypeDescr<BitArrayFieldClass> : public BitArrayFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstBitArrayFieldClass> : public BitArrayFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
 enum class DisplayBase
 {
     BINARY = BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY,
@@ -535,12 +575,12 @@ public:
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
-        bt_field_class_integer_get_field_value_range(this->_libObjPtr(), n);
+        bt_field_class_integer_set_field_value_range(this->libObjPtr(), n);
     }
 
     std::uint64_t fieldValueRange() const noexcept
     {
-        return bt_field_class_integer_get_field_value_range(this->_libObjPtr());
+        return bt_field_class_integer_get_field_value_range(this->libObjPtr());
     }
 
     void preferredDisplayBase(const DisplayBase base) noexcept
@@ -548,13 +588,13 @@ public:
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
         bt_field_class_integer_set_preferred_display_base(
-            this->_libObjPtr(), static_cast<bt_field_class_integer_preferred_display_base>(base));
+            this->libObjPtr(), static_cast<bt_field_class_integer_preferred_display_base>(base));
     }
 
     DisplayBase preferredDisplayBase() const noexcept
     {
         return static_cast<DisplayBase>(
-            bt_field_class_integer_get_preferred_display_base(this->_libObjPtr()));
+            bt_field_class_integer_get_preferred_display_base(this->libObjPtr()));
     }
 
     Shared shared() const noexcept
@@ -568,6 +608,26 @@ using ConstIntegerFieldClass = CommonIntegerFieldClass<const bt_field_class>;
 
 namespace internal {
 
+struct IntegerFieldClassTypeDescr
+{
+    using Const = ConstIntegerFieldClass;
+    using NonConst = IntegerFieldClass;
+};
+
+template <>
+struct TypeDescr<IntegerFieldClass> : public IntegerFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstIntegerFieldClass> : public IntegerFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
+namespace internal {
+
 template <typename LibObjT>
 struct ConstEnumerationFieldClassMappingSpec;
 
@@ -642,12 +702,12 @@ public:
     RangeSet ranges() const noexcept
     {
         return RangeSet {
-            internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::ranges(this->_libObjPtr())};
+            internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::ranges(this->libObjPtr())};
     }
 
     bpstd::string_view label() const noexcept
     {
-        return internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::label(this->_libObjPtr());
+        return internal::ConstEnumerationFieldClassMappingSpec<LibObjT>::label(this->libObjPtr());
     }
 };
 
@@ -677,6 +737,13 @@ struct CommonEnumerationFieldClassSpec<ConstUnsignedEnumerationFieldClassMapping
     {
         return bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const(libObjPtr, label);
     }
+
+    static bt_field_class_enumeration_add_mapping_status
+    addMapping(bt_field_class * const libObjPtr, const char * const label,
+               const bt_integer_range_set_unsigned * const libRanges) noexcept
+    {
+        return bt_field_class_enumeration_unsigned_add_mapping(libObjPtr, label, libRanges);
+    }
 };
 
 /* Functions specific to signed enumeration field classes */
@@ -694,6 +761,13 @@ struct CommonEnumerationFieldClassSpec<ConstSignedEnumerationFieldClassMapping>
     {
         return bt_field_class_enumeration_signed_borrow_mapping_by_label_const(libObjPtr, label);
     }
+
+    static bt_field_class_enumeration_add_mapping_status
+    addMapping(bt_field_class * const libObjPtr, const char * const label,
+               const bt_integer_range_set_signed * const libRanges) noexcept
+    {
+        return bt_field_class_enumeration_signed_add_mapping(libObjPtr, label, libRanges);
+    }
 };
 
 } /* namespace internal */
@@ -734,7 +808,7 @@ public:
 
     std::uint64_t size() const noexcept
     {
-        return bt_field_class_enumeration_get_mapping_count(this->_libObjPtr());
+        return bt_field_class_enumeration_get_mapping_count(this->libObjPtr());
     }
 
     Shared shared() const noexcept
@@ -753,6 +827,7 @@ private:
 
 public:
     using Shared = internal::SharedFieldClass<_ThisCommonEnumerationFieldClass, LibObjT>;
+    using Iterator = CommonIterator<CommonEnumerationFieldClass, MappingT>;
     using Mapping = MappingT;
 
     explicit CommonEnumerationFieldClass(const _LibObjPtr libObjPtr) noexcept :
@@ -779,13 +854,13 @@ public:
     Mapping operator[](const std::uint64_t index) const noexcept
     {
         return Mapping {internal::CommonEnumerationFieldClassSpec<MappingT>::mappingByIndex(
-            this->_libObjPtr(), index)};
+            this->libObjPtr(), index)};
     }
 
     nonstd::optional<Mapping> operator[](const char * const label) const noexcept
     {
         const auto libObjPtr = internal::CommonEnumerationFieldClassSpec<MappingT>::mappingByLabel(
-            this->_libObjPtr(), label);
+            this->libObjPtr(), label);
 
         if (libObjPtr) {
             return Mapping {libObjPtr};
@@ -799,6 +874,31 @@ public:
         return (*this)[label.data()];
     }
 
+    void addMapping(const char * const label, const typename Mapping::RangeSet ranges)
+    {
+        const auto status = internal::CommonEnumerationFieldClassSpec<MappingT>::addMapping(
+            this->libObjPtr(), label, ranges.libObjPtr());
+
+        if (status == BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR) {
+            throw LibMemoryError {};
+        }
+    }
+
+    void addMapping(const std::string& label, const typename Mapping::RangeSet ranges)
+    {
+        this->addMapping(label.data(), ranges);
+    }
+
+    Iterator begin() const noexcept
+    {
+        return Iterator {*this, 0};
+    }
+
+    Iterator end() const noexcept
+    {
+        return Iterator {*this, this->size()};
+    }
+
     Shared shared() const noexcept
     {
         return Shared {*this};
@@ -822,6 +922,38 @@ using ConstSignedEnumerationFieldClass =
 
 namespace internal {
 
+struct UnsignedEnumerationFieldClassTypeDescr
+{
+    using Const = ConstUnsignedEnumerationFieldClass;
+    using NonConst = UnsignedEnumerationFieldClass;
+};
+
+template <>
+struct TypeDescr<UnsignedEnumerationFieldClass> : public UnsignedEnumerationFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstUnsignedEnumerationFieldClass> : public UnsignedEnumerationFieldClassTypeDescr
+{
+};
+
+struct SignedEnumerationFieldClassTypeDescr
+{
+    using Const = ConstSignedEnumerationFieldClass;
+    using NonConst = SignedEnumerationFieldClass;
+};
+
+template <>
+struct TypeDescr<SignedEnumerationFieldClass> : public SignedEnumerationFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstSignedEnumerationFieldClass> : public SignedEnumerationFieldClassTypeDescr
+{
+};
+
 template <typename LibObjT>
 struct CommonStructureFieldClassMemberSpec;
 
@@ -881,19 +1013,19 @@ public:
 
     bpstd::string_view name() const noexcept
     {
-        return bt_field_class_structure_member_get_name(this->_libObjPtr());
+        return bt_field_class_structure_member_get_name(this->libObjPtr());
     }
 
     ConstFieldClass fieldClass() const noexcept
     {
         return ConstFieldClass {internal::CommonStructureFieldClassMemberSpec<
-            const bt_field_class_structure_member>::fieldClass(this->_libObjPtr())};
+            const bt_field_class_structure_member>::fieldClass(this->libObjPtr())};
     }
 
     _FieldClass fieldClass() noexcept
     {
         return _FieldClass {
-            internal::CommonStructureFieldClassMemberSpec<LibObjT>::fieldClass(this->_libObjPtr())};
+            internal::CommonStructureFieldClassMemberSpec<LibObjT>::fieldClass(this->libObjPtr())};
     }
 };
 
@@ -904,6 +1036,22 @@ using ConstStructureFieldClassMember =
 
 namespace internal {
 
+struct StructureFieldClassMemberTypeDescr
+{
+    using Const = ConstStructureFieldClassMember;
+    using NonConst = StructureFieldClassMember;
+};
+
+template <>
+struct TypeDescr<StructureFieldClassMember> : public StructureFieldClassMemberTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstStructureFieldClassMember> : public StructureFieldClassMemberTypeDescr
+{
+};
+
 template <typename LibObjT>
 struct CommonStructureFieldClassSpec;
 
@@ -982,7 +1130,7 @@ public:
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
         const auto status =
-            bt_field_class_structure_append_member(this->_libObjPtr(), name, fc._libObjPtr());
+            bt_field_class_structure_append_member(this->libObjPtr(), name, fc.libObjPtr());
 
         if (status == BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR) {
             throw LibMemoryError {};
@@ -996,7 +1144,7 @@ public:
 
     std::uint64_t size() const noexcept
     {
-        return bt_field_class_structure_get_member_count(this->_libObjPtr());
+        return bt_field_class_structure_get_member_count(this->libObjPtr());
     }
 
     Iterator begin() const noexcept
@@ -1013,13 +1161,13 @@ public:
     {
         return ConstStructureFieldClassMember {
             internal::CommonStructureFieldClassSpec<const bt_field_class>::memberByIndex(
-                this->_libObjPtr(), index)};
+                this->libObjPtr(), index)};
     }
 
     Member operator[](const std::uint64_t index) noexcept
     {
         return Member {internal::CommonStructureFieldClassSpec<LibObjT>::memberByIndex(
-            this->_libObjPtr(), index)};
+            this->libObjPtr(), index)};
     }
 
     nonstd::optional<ConstStructureFieldClassMember>
@@ -1027,7 +1175,7 @@ public:
     {
         const auto libObjPtr =
             internal::CommonStructureFieldClassSpec<const bt_field_class>::memberByName(
-                this->_libObjPtr(), name);
+                this->libObjPtr(), name);
 
         if (libObjPtr) {
             return ConstStructureFieldClassMember {libObjPtr};
@@ -1044,8 +1192,8 @@ public:
 
     nonstd::optional<Member> operator[](const char * const name) noexcept
     {
-        const auto libObjPtr = internal::CommonStructureFieldClassSpec<LibObjT>::memberByName(
-            this->_libObjPtr(), name);
+        const auto libObjPtr =
+            internal::CommonStructureFieldClassSpec<LibObjT>::memberByName(this->libObjPtr(), name);
 
         if (libObjPtr) {
             return Member {libObjPtr};
@@ -1070,6 +1218,22 @@ using ConstStructureFieldClass = CommonStructureFieldClass<const bt_field_class>
 
 namespace internal {
 
+struct StructureFieldClassTypeDescr
+{
+    using Const = ConstStructureFieldClass;
+    using NonConst = StructureFieldClass;
+};
+
+template <>
+struct TypeDescr<StructureFieldClass> : public StructureFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstStructureFieldClass> : public StructureFieldClassTypeDescr
+{
+};
+
 template <typename LibObjT>
 struct CommonArrayFieldClassSpec;
 
@@ -1134,13 +1298,13 @@ public:
     {
         return ConstFieldClass {
             internal::CommonArrayFieldClassSpec<const bt_field_class>::elementFieldClass(
-                this->_libObjPtr())};
+                this->libObjPtr())};
     }
 
     _FieldClass elementFieldClass() noexcept
     {
         return _FieldClass {
-            internal::CommonArrayFieldClassSpec<LibObjT>::elementFieldClass(this->_libObjPtr())};
+            internal::CommonArrayFieldClassSpec<LibObjT>::elementFieldClass(this->libObjPtr())};
     }
 
     Shared shared() const noexcept
@@ -1152,6 +1316,26 @@ public:
 using ArrayFieldClass = CommonArrayFieldClass<bt_field_class>;
 using ConstArrayFieldClass = CommonArrayFieldClass<const bt_field_class>;
 
+namespace internal {
+
+struct ArrayFieldClassTypeDescr
+{
+    using Const = ConstArrayFieldClass;
+    using NonConst = ArrayFieldClass;
+};
+
+template <>
+struct TypeDescr<ArrayFieldClass> : public ArrayFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstArrayFieldClass> : public ArrayFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
 template <typename LibObjT>
 class CommonStaticArrayFieldClass final : public CommonArrayFieldClass<LibObjT>
 {
@@ -1184,7 +1368,7 @@ public:
 
     std::uint64_t length() const noexcept
     {
-        return bt_field_class_array_static_get_length(this->_libObjPtr());
+        return bt_field_class_array_static_get_length(this->libObjPtr());
     }
 
     Shared shared() const noexcept
@@ -1196,6 +1380,26 @@ public:
 using StaticArrayFieldClass = CommonStaticArrayFieldClass<bt_field_class>;
 using ConstStaticArrayFieldClass = CommonStaticArrayFieldClass<const bt_field_class>;
 
+namespace internal {
+
+struct StaticArrayFieldClassTypeDescr
+{
+    using Const = ConstStaticArrayFieldClass;
+    using NonConst = StaticArrayFieldClass;
+};
+
+template <>
+struct TypeDescr<StaticArrayFieldClass> : public StaticArrayFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstStaticArrayFieldClass> : public StaticArrayFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
 template <typename LibObjT>
 class CommonDynamicArrayWithLengthFieldClass final : public CommonArrayFieldClass<LibObjT>
 {
@@ -1232,7 +1436,7 @@ public:
     {
         return ConstFieldPath {
             bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const(
-                this->_libObjPtr())};
+                this->libObjPtr())};
     }
 
     Shared shared() const noexcept
@@ -1248,6 +1452,24 @@ using ConstDynamicArrayWithLengthFieldClass =
 
 namespace internal {
 
+struct DynamicArrayWithLengthFieldClassTypeDescr
+{
+    using Const = ConstDynamicArrayWithLengthFieldClass;
+    using NonConst = DynamicArrayWithLengthFieldClass;
+};
+
+template <>
+struct TypeDescr<DynamicArrayWithLengthFieldClass> :
+    public DynamicArrayWithLengthFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstDynamicArrayWithLengthFieldClass> :
+    public DynamicArrayWithLengthFieldClassTypeDescr
+{
+};
+
 template <typename LibObjT>
 struct CommonOptionFieldClassSpec;
 
@@ -1312,13 +1534,13 @@ public:
     {
         return ConstFieldClass {
             internal::CommonOptionFieldClassSpec<const bt_field_class>::fieldClass(
-                this->_libObjPtr())};
+                this->libObjPtr())};
     }
 
     _FieldClass fieldClass() noexcept
     {
         return _FieldClass {
-            internal::CommonOptionFieldClassSpec<LibObjT>::fieldClass(this->_libObjPtr())};
+            internal::CommonOptionFieldClassSpec<LibObjT>::fieldClass(this->libObjPtr())};
     }
 
     Shared shared() const noexcept
@@ -1330,6 +1552,26 @@ public:
 using OptionFieldClass = CommonOptionFieldClass<bt_field_class>;
 using ConstOptionFieldClass = CommonOptionFieldClass<const bt_field_class>;
 
+namespace internal {
+
+struct OptionFieldClassTypeDescr
+{
+    using Const = ConstOptionFieldClass;
+    using NonConst = OptionFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionFieldClass> : public OptionFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionFieldClass> : public OptionFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
 template <typename LibObjT>
 class CommonOptionWithSelectorFieldClass : public CommonOptionFieldClass<LibObjT>
 {
@@ -1368,7 +1610,7 @@ public:
     {
         return ConstFieldPath {
             bt_field_class_option_with_selector_field_borrow_selector_field_path_const(
-                this->_libObjPtr())};
+                this->libObjPtr())};
     }
 
     Shared shared() const noexcept
@@ -1380,6 +1622,26 @@ public:
 using OptionWithSelectorFieldClass = CommonOptionWithSelectorFieldClass<bt_field_class>;
 using ConstOptionWithSelectorFieldClass = CommonOptionWithSelectorFieldClass<const bt_field_class>;
 
+namespace internal {
+
+struct OptionWithSelectorFieldClassTypeDescr
+{
+    using Const = ConstOptionWithSelectorFieldClass;
+    using NonConst = OptionWithSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionWithSelectorFieldClass> : public OptionWithSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionWithSelectorFieldClass> : public OptionWithSelectorFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
 template <typename LibObjT>
 class CommonOptionWithBoolSelectorFieldClass : public CommonOptionWithSelectorFieldClass<LibObjT>
 {
@@ -1417,7 +1679,7 @@ public:
     bool selectorIsReversed() const noexcept
     {
         return bt_field_class_option_with_selector_field_bool_selector_is_reversed(
-            this->_libObjPtr());
+            this->libObjPtr());
     }
 
     Shared shared() const noexcept
@@ -1433,6 +1695,24 @@ using ConstOptionWithBoolSelectorFieldClass =
 
 namespace internal {
 
+struct OptionWithBoolSelectorFieldClassTypeDescr
+{
+    using Const = ConstOptionWithBoolSelectorFieldClass;
+    using NonConst = OptionWithBoolSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionWithBoolSelectorFieldClass> :
+    public OptionWithBoolSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionWithBoolSelectorFieldClass> :
+    public OptionWithBoolSelectorFieldClassTypeDescr
+{
+};
+
 template <typename RangeSetT>
 struct CommonOptionWithIntegerSelectorFieldClassSpec;
 
@@ -1504,7 +1784,7 @@ public:
     RangeSet ranges() const noexcept
     {
         return RangeSet {internal::CommonOptionWithIntegerSelectorFieldClassSpec<RangeSetT>::ranges(
-            this->_libObjPtr())};
+            this->libObjPtr())};
     }
 
     Shared shared() const noexcept
@@ -1527,6 +1807,42 @@ using ConstOptionWithSignedIntegerSelectorFieldClass =
 
 namespace internal {
 
+struct OptionWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+    using Const = ConstOptionWithUnsignedIntegerSelectorFieldClass;
+    using NonConst = OptionWithUnsignedIntegerSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionWithUnsignedIntegerSelectorFieldClass> :
+    public OptionWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionWithUnsignedIntegerSelectorFieldClass> :
+    public OptionWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+struct OptionWithSignedIntegerSelectorFieldClassTypeDescr
+{
+    using Const = ConstOptionWithSignedIntegerSelectorFieldClass;
+    using NonConst = OptionWithSignedIntegerSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<OptionWithSignedIntegerSelectorFieldClass> :
+    public OptionWithSignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstOptionWithSignedIntegerSelectorFieldClass> :
+    public OptionWithSignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
 template <typename LibObjT>
 struct CommonVariantFieldClassOptionSpec;
 
@@ -1585,19 +1901,19 @@ public:
 
     bpstd::string_view name() const noexcept
     {
-        return bt_field_class_variant_option_get_name(this->_libObjPtr());
+        return bt_field_class_variant_option_get_name(this->libObjPtr());
     }
 
     ConstFieldClass fieldClass() const noexcept
     {
         return ConstFieldClass {internal::CommonVariantFieldClassOptionSpec<
-            const bt_field_class_variant_option>::fieldClass(this->_libObjPtr())};
+            const bt_field_class_variant_option>::fieldClass(this->libObjPtr())};
     }
 
     _FieldClass fieldClass() noexcept
     {
         return _FieldClass {
-            internal::CommonVariantFieldClassOptionSpec<LibObjT>::fieldClass(this->_libObjPtr())};
+            internal::CommonVariantFieldClassOptionSpec<LibObjT>::fieldClass(this->libObjPtr())};
     }
 };
 
@@ -1608,6 +1924,22 @@ using ConstVariantFieldClassOption =
 
 namespace internal {
 
+struct VariantFieldClassOptionTypeDescr
+{
+    using Const = ConstVariantFieldClassOption;
+    using NonConst = VariantFieldClassOption;
+};
+
+template <>
+struct TypeDescr<VariantFieldClassOption> : public VariantFieldClassOptionTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantFieldClassOption> : public VariantFieldClassOptionTypeDescr
+{
+};
+
 template <typename LibObjT>
 struct ConstVariantWithIntegerSelectorFieldClassOptionSpec;
 
@@ -1696,7 +2028,7 @@ public:
 
     ConstVariantFieldClassOption asBaseOption() const noexcept
     {
-        return ConstVariantFieldClassOption {_Spec::asBaseOption(this->_libObjPtr())};
+        return ConstVariantFieldClassOption {_Spec::asBaseOption(this->libObjPtr())};
     }
 
     bpstd::string_view name() const noexcept
@@ -1711,7 +2043,7 @@ public:
 
     RangeSet ranges() const noexcept
     {
-        return RangeSet {_Spec::ranges(this->_libObjPtr())};
+        return RangeSet {_Spec::ranges(this->libObjPtr())};
     }
 };
 
@@ -1804,7 +2136,7 @@ public:
 
     std::uint64_t size() const noexcept
     {
-        return bt_field_class_variant_get_option_count(this->_libObjPtr());
+        return bt_field_class_variant_get_option_count(this->libObjPtr());
     }
 
     Iterator begin() const noexcept
@@ -1821,13 +2153,13 @@ public:
     {
         return ConstVariantFieldClassOption {
             internal::CommonVariantFieldClassSpec<const bt_field_class>::optionByIndex(
-                this->_libObjPtr(), index)};
+                this->libObjPtr(), index)};
     }
 
     Option operator[](const std::uint64_t index) noexcept
     {
         return Option {internal::CommonVariantFieldClassSpec<LibObjT>::optionByIndex(
-            this->_libObjPtr(), index)};
+            this->libObjPtr(), index)};
     }
 
     nonstd::optional<ConstVariantFieldClassOption>
@@ -1835,7 +2167,7 @@ public:
     {
         const auto libObjPtr =
             internal::CommonVariantFieldClassSpec<const bt_field_class>::optionByName(
-                this->_libObjPtr(), name);
+                this->libObjPtr(), name);
 
         if (libObjPtr) {
             return ConstVariantFieldClassOption {libObjPtr};
@@ -1853,7 +2185,7 @@ public:
     nonstd::optional<Option> operator[](const char * const name) noexcept
     {
         const auto libObjPtr =
-            internal::CommonVariantFieldClassSpec<LibObjT>::optionByName(this->_libObjPtr(), name);
+            internal::CommonVariantFieldClassSpec<LibObjT>::optionByName(this->libObjPtr(), name);
 
         if (libObjPtr) {
             return Option {libObjPtr};
@@ -1876,6 +2208,26 @@ public:
 using VariantFieldClass = CommonVariantFieldClass<bt_field_class>;
 using ConstVariantFieldClass = CommonVariantFieldClass<const bt_field_class>;
 
+namespace internal {
+
+struct VariantFieldClassTypeDescr
+{
+    using Const = ConstVariantFieldClass;
+    using NonConst = VariantFieldClass;
+};
+
+template <>
+struct TypeDescr<VariantFieldClass> : public VariantFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantFieldClass> : public VariantFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
 template <typename LibObjT>
 class CommonVariantWithoutSelectorFieldClass : public CommonVariantFieldClass<LibObjT>
 {
@@ -1913,7 +2265,7 @@ public:
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
         const auto status = bt_field_class_variant_without_selector_append_option(
-            this->_libObjPtr(), name, fc._libObjPtr());
+            this->libObjPtr(), name, fc.libObjPtr());
 
         if (status ==
             BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
@@ -1938,6 +2290,24 @@ using ConstVariantWithoutSelectorFieldClass =
 
 namespace internal {
 
+struct VariantWithoutSelectorFieldClassTypeDescr
+{
+    using Const = ConstVariantWithoutSelectorFieldClass;
+    using NonConst = VariantWithoutSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<VariantWithoutSelectorFieldClass> :
+    public VariantWithoutSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantWithoutSelectorFieldClass> :
+    public VariantWithoutSelectorFieldClassTypeDescr
+{
+};
+
 template <typename OptionT>
 struct CommonVariantWithIntegerSelectorFieldClassSpec;
 
@@ -2041,7 +2411,7 @@ public:
     {
         return ConstFieldPath {
             bt_field_class_variant_with_selector_field_borrow_selector_field_path_const(
-                this->_libObjPtr())};
+                this->libObjPtr())};
     }
 
     Shared shared() const noexcept
@@ -2092,12 +2462,12 @@ public:
 
     Option operator[](const std::uint64_t index) const noexcept
     {
-        return Option {_Spec::optionByIndex(this->_libObjPtr(), index)};
+        return Option {_Spec::optionByIndex(this->libObjPtr(), index)};
     }
 
     nonstd::optional<Option> operator[](const char * const name) const noexcept
     {
-        const auto libObjPtr = _Spec::optionByName(this->_libObjPtr(), name);
+        const auto libObjPtr = _Spec::optionByName(this->libObjPtr(), name);
 
         if (libObjPtr) {
             return Option {libObjPtr};
@@ -2117,7 +2487,7 @@ public:
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
         const auto status =
-            _Spec::appendOption(this->_libObjPtr(), name, fc._libObjPtr(), ranges._libObjPtr());
+            _Spec::appendOption(this->libObjPtr(), name, fc.libObjPtr(), ranges.libObjPtr());
 
         if (status ==
             BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
@@ -2149,25 +2519,65 @@ using VariantWithSignedIntegerSelectorFieldClass = CommonVariantWithIntegerSelec
 using ConstVariantWithSignedIntegerSelectorFieldClass = CommonVariantWithIntegerSelectorFieldClass<
     const bt_field_class, ConstVariantWithSignedIntegerSelectorFieldClassOption>;
 
+namespace internal {
+
+struct VariantWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+    using Const = ConstVariantWithUnsignedIntegerSelectorFieldClass;
+    using NonConst = VariantWithUnsignedIntegerSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<VariantWithUnsignedIntegerSelectorFieldClass> :
+    public VariantWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantWithUnsignedIntegerSelectorFieldClass> :
+    public VariantWithUnsignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+struct VariantWithSignedIntegerSelectorFieldClassTypeDescr
+{
+    using Const = ConstVariantWithSignedIntegerSelectorFieldClass;
+    using NonConst = VariantWithSignedIntegerSelectorFieldClass;
+};
+
+template <>
+struct TypeDescr<VariantWithSignedIntegerSelectorFieldClass> :
+    public VariantWithSignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstVariantWithSignedIntegerSelectorFieldClass> :
+    public VariantWithSignedIntegerSelectorFieldClassTypeDescr
+{
+};
+
+} /* namespace internal */
+
 template <typename LibObjT>
 CommonBitArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asBitArray() const noexcept
 {
     BT_ASSERT_DBG(this->isBitArray());
-    return CommonBitArrayFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonBitArrayFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonIntegerFieldClass<LibObjT> CommonFieldClass<LibObjT>::asInteger() const noexcept
 {
     BT_ASSERT_DBG(this->isInteger());
-    return CommonIntegerFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonIntegerFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonBaseEnumerationFieldClass<LibObjT> CommonFieldClass<LibObjT>::asEnumeration() const noexcept
 {
     BT_ASSERT_DBG(this->isEnumeration());
-    return CommonBaseEnumerationFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonBaseEnumerationFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2176,7 +2586,7 @@ CommonFieldClass<LibObjT>::asUnsignedEnumeration() const noexcept
 {
     BT_ASSERT_DBG(this->isUnsignedEnumeration());
     return CommonEnumerationFieldClass<LibObjT, ConstUnsignedEnumerationFieldClassMapping> {
-        this->_libObjPtr()};
+        this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2185,28 +2595,28 @@ CommonFieldClass<LibObjT>::asSignedEnumeration() const noexcept
 {
     BT_ASSERT_DBG(this->isSignedEnumeration());
     return CommonEnumerationFieldClass<LibObjT, ConstSignedEnumerationFieldClassMapping> {
-        this->_libObjPtr()};
+        this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonStructureFieldClass<LibObjT> CommonFieldClass<LibObjT>::asStructure() const noexcept
 {
     BT_ASSERT_DBG(this->isStructure());
-    return CommonStructureFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonStructureFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asArray() const noexcept
 {
     BT_ASSERT_DBG(this->isArray());
-    return CommonArrayFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonArrayFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonStaticArrayFieldClass<LibObjT> CommonFieldClass<LibObjT>::asStaticArray() const noexcept
 {
     BT_ASSERT_DBG(this->isStaticArray());
-    return CommonStaticArrayFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonStaticArrayFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2214,14 +2624,14 @@ CommonDynamicArrayWithLengthFieldClass<LibObjT>
 CommonFieldClass<LibObjT>::asDynamicArrayWithLength() const noexcept
 {
     BT_ASSERT_DBG(this->isDynamicArrayWithLength());
-    return CommonDynamicArrayWithLengthFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonDynamicArrayWithLengthFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonOptionFieldClass<LibObjT> CommonFieldClass<LibObjT>::asOption() const noexcept
 {
     BT_ASSERT_DBG(this->isOption());
-    return CommonOptionFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonOptionFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2229,7 +2639,7 @@ CommonOptionWithSelectorFieldClass<LibObjT>
 CommonFieldClass<LibObjT>::asOptionWithSelector() const noexcept
 {
     BT_ASSERT_DBG(this->isOptionWithSelector());
-    return CommonOptionWithSelectorFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonOptionWithSelectorFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2237,7 +2647,7 @@ CommonOptionWithBoolSelectorFieldClass<LibObjT>
 CommonFieldClass<LibObjT>::asOptionWithBoolSelector() const noexcept
 {
     BT_ASSERT_DBG(this->isOptionWithBoolSelector());
-    return CommonOptionWithBoolSelectorFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonOptionWithBoolSelectorFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2246,7 +2656,7 @@ CommonFieldClass<LibObjT>::asOptionWithUnsignedIntegerSelector() const noexcept
 {
     BT_ASSERT_DBG(this->isOptionWithUnsignedIntegerSelector());
     return CommonOptionWithIntegerSelectorFieldClass<LibObjT, ConstUnsignedIntegerRangeSet> {
-        this->_libObjPtr()};
+        this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2255,14 +2665,14 @@ CommonFieldClass<LibObjT>::asOptionWithSignedIntegerSelector() const noexcept
 {
     BT_ASSERT_DBG(this->isOptionWithSignedIntegerSelector());
     return CommonOptionWithIntegerSelectorFieldClass<LibObjT, ConstSignedIntegerRangeSet> {
-        this->_libObjPtr()};
+        this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonVariantFieldClass<LibObjT> CommonFieldClass<LibObjT>::asVariant() const noexcept
 {
     BT_ASSERT_DBG(this->isVariant());
-    return CommonVariantFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonVariantFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2270,7 +2680,7 @@ CommonVariantWithoutSelectorFieldClass<LibObjT>
 CommonFieldClass<LibObjT>::asVariantWithoutSelector() const noexcept
 {
     BT_ASSERT_DBG(this->isVariantWithoutSelector());
-    return CommonVariantWithoutSelectorFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonVariantWithoutSelectorFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2278,7 +2688,7 @@ CommonVariantWithSelectorFieldClass<LibObjT>
 CommonFieldClass<LibObjT>::asVariantWithSelector() const noexcept
 {
     BT_ASSERT_DBG(this->isVariantWithSelector());
-    return CommonVariantWithSelectorFieldClass<LibObjT> {this->_libObjPtr()};
+    return CommonVariantWithSelectorFieldClass<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2288,7 +2698,7 @@ CommonFieldClass<LibObjT>::asVariantWithUnsignedIntegerSelector() const noexcept
 {
     BT_ASSERT_DBG(this->isVariantWithUnsignedIntegerSelector());
     return CommonVariantWithIntegerSelectorFieldClass<
-        LibObjT, ConstVariantWithUnsignedIntegerSelectorFieldClassOption> {this->_libObjPtr()};
+        LibObjT, ConstVariantWithUnsignedIntegerSelectorFieldClassOption> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
@@ -2298,7 +2708,7 @@ CommonFieldClass<LibObjT>::asVariantWithSignedIntegerSelector() const noexcept
 {
     BT_ASSERT_DBG(this->isVariantWithSignedIntegerSelector());
     return CommonVariantWithIntegerSelectorFieldClass<
-        LibObjT, ConstVariantWithSignedIntegerSelectorFieldClassOption> {this->_libObjPtr()};
+        LibObjT, ConstVariantWithSignedIntegerSelectorFieldClassOption> {this->libObjPtr()};
 }
 
 } /* namespace bt2 */
This page took 0.049347 seconds and 4 git commands to generate.