cpp-common/bt2: use the "length" term everywhere instead of "size"
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 3 Nov 2023 16:03:02 +0000 (12:03 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 14 Dec 2023 15:57:04 +0000 (10:57 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I25ce7709679d016dff6b23aa323a0ca5ec738190
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11231
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/cpp-common/bt2/common-iterator.hpp
src/cpp-common/bt2/field-class.hpp
src/cpp-common/bt2/field-path.hpp
src/cpp-common/bt2/field.hpp
src/cpp-common/bt2/integer-range-set.hpp
src/cpp-common/bt2/trace-ir.hpp
src/cpp-common/bt2/value.hpp

index 51b8d8e2709d46976ca06f0b1a52a0b031d77267..99332d65310265ea09c5bcab6d37c4432c9a7c98 100644 (file)
@@ -77,7 +77,7 @@ public:
 private:
     void _updateCurrentValue() noexcept
     {
-        if (_mIdx < _mContainer.size()) {
+        if (_mIdx < _mContainer.length()) {
             _mCurrVal = _mContainer[_mIdx];
         } else {
             _mCurrVal = nonstd::nullopt;
index ae2c52a3711f58da6754e6ef82c32c849506e658..3d3c479554162b757b6094c0caf0e75fab0df207 100644 (file)
@@ -785,7 +785,7 @@ public:
         return *this;
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_field_class_enumeration_get_mapping_count(this->libObjPtr());
     }
@@ -875,7 +875,7 @@ public:
 
     Iterator end() const noexcept
     {
-        return Iterator {*this, this->size()};
+        return Iterator {*this, this->length()};
     }
 
     Shared shared() const noexcept
@@ -1145,7 +1145,7 @@ public:
         this->appendMember(name.data(), fc);
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_field_class_structure_get_member_count(this->libObjPtr());
     }
@@ -1157,7 +1157,7 @@ public:
 
     Iterator end() const noexcept
     {
-        return Iterator {*this, this->size()};
+        return Iterator {*this, this->length()};
     }
 
     Member operator[](const std::uint64_t index) const noexcept
@@ -2121,7 +2121,7 @@ public:
         return *this;
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_field_class_variant_get_option_count(this->libObjPtr());
     }
@@ -2133,7 +2133,7 @@ public:
 
     Iterator end() const noexcept
     {
-        return Iterator {*this, this->size()};
+        return Iterator {*this, this->length()};
     }
 
     Option operator[](const std::uint64_t index) const noexcept
@@ -2472,7 +2472,7 @@ public:
 
     Iterator end() const noexcept
     {
-        return Iterator {*this, this->size()};
+        return Iterator {*this, this->length()};
     }
 
     Shared shared() const noexcept
index eea27e12adae7ba191e0a60cad8a70cbd8710f0b..8f20405d324778ce94f80b47de1fab0936389af3 100644 (file)
@@ -158,7 +158,7 @@ public:
         return static_cast<Scope>(bt_field_path_get_root_scope(this->libObjPtr()));
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_field_path_get_item_count(this->libObjPtr());
     }
@@ -176,7 +176,7 @@ public:
 
     Iterator end() const noexcept
     {
-        return Iterator {*this, this->size()};
+        return Iterator {*this, this->length()};
     }
 
     Shared shared() const noexcept
index 241c17764b20ef4f3edca63410c16af49c91922b..d5048b6ea0b224aad6e5cc4e189070570bcd688f 100644 (file)
@@ -570,7 +570,7 @@ public:
     explicit EnumerationFieldClassMappingLabels(
         const bt_field_class_enumeration_mapping_label_array labels, const std::uint64_t size) :
         _mLabels {labels},
-        _mSize {size}
+        _mLen {size}
     {
     }
 
@@ -580,9 +580,9 @@ public:
     EnumerationFieldClassMappingLabels&
     operator=(const EnumerationFieldClassMappingLabels&) noexcept = default;
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
-        return _mSize;
+        return _mLen;
     }
 
     bpstd::string_view operator[](const std::uint64_t index) const noexcept
@@ -592,7 +592,7 @@ public:
 
 private:
     bt_field_class_enumeration_mapping_label_array _mLabels;
-    std::uint64_t _mSize;
+    std::uint64_t _mLen;
 };
 
 template <typename LibObjT>
@@ -1063,9 +1063,9 @@ public:
         return Class {internal::CommonFieldSpec<LibObjT>::cls(this->libObjPtr())};
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
-        return this->cls().size();
+        return this->cls().length();
     }
 
     CommonField<LibObjT> operator[](const std::uint64_t index) const noexcept
index f7ef1aaf77f966a95064e1b31149626a82fa5de2..d50fe28558efcdfdd7fec789cdbe2f53858f70ba 100644 (file)
@@ -60,7 +60,7 @@ struct CommonIntegerRangeSetSpec;
 template <>
 struct CommonIntegerRangeSetSpec<const bt_integer_range_set_unsigned> final
 {
-    static std::uint64_t size(const bt_integer_range_set_unsigned * const libRangePtr) noexcept
+    static std::uint64_t length(const bt_integer_range_set_unsigned * const libRangePtr) noexcept
     {
         return bt_integer_range_set_get_range_count(
             bt_integer_range_set_unsigned_as_range_set_const(libRangePtr));
@@ -97,7 +97,7 @@ struct CommonIntegerRangeSetSpec<const bt_integer_range_set_unsigned> final
 template <>
 struct CommonIntegerRangeSetSpec<const bt_integer_range_set_signed> final
 {
-    static std::uint64_t size(const bt_integer_range_set_signed * const libRangePtr) noexcept
+    static std::uint64_t length(const bt_integer_range_set_signed * const libRangePtr) noexcept
     {
         return bt_integer_range_set_get_range_count(
             bt_integer_range_set_signed_as_range_set_const(libRangePtr));
@@ -202,9 +202,9 @@ public:
         }
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
-        return _Spec::size(this->libObjPtr());
+        return _Spec::length(this->libObjPtr());
     }
 
     Range operator[](const std::uint64_t index) const noexcept
@@ -219,7 +219,7 @@ public:
 
     Iterator end() const noexcept
     {
-        return Iterator {*this, this->size()};
+        return Iterator {*this, this->length()};
     }
 
     Shared shared() const noexcept
index efdf0ba07e33bcd793a80f2dced0c11ad85bcf7b..5ee989601764d34fcea234c7eb46148e857cfa03 100644 (file)
@@ -720,7 +720,7 @@ public:
         return nonstd::nullopt;
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_trace_get_stream_count(this->libObjPtr());
     }
@@ -1514,7 +1514,7 @@ public:
         return nonstd::nullopt;
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_stream_class_get_event_class_count(this->libObjPtr());
     }
@@ -1996,7 +1996,7 @@ public:
             bt_trace_class_assigns_automatic_stream_class_id(this->libObjPtr()));
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_trace_class_get_stream_class_count(this->libObjPtr());
     }
index 1051cedf1b89bedea1c2f6edbe8adf50bc5a4fb5..c8e3dc791fce51678e5dc5301487fedcd3e58156 100644 (file)
@@ -771,12 +771,6 @@ public:
         return bt_value_array_get_length(this->libObjPtr());
     }
 
-    /* Required by the `CommonIterator` template class */
-    std::uint64_t size() const noexcept
-    {
-        return this->length();
-    }
-
     Iterator begin() const noexcept
     {
         return Iterator {*this, 0};
@@ -1070,14 +1064,14 @@ public:
         return *this;
     }
 
-    std::uint64_t size() const noexcept
+    std::uint64_t length() const noexcept
     {
         return bt_value_map_get_size(this->libObjPtr());
     }
 
     bool isEmpty() const noexcept
     {
-        return this->size() == 0;
+        return this->length() == 0;
     }
 
     nonstd::optional<CommonValue<LibObjT>> operator[](const char * const key) const noexcept
This page took 0.030422 seconds and 4 git commands to generate.