[Bf-blender-cvs] [a26f710d627] virtual-array-attributes: rename to get_internal_span

Jacques Lucke noreply at git.blender.org
Thu Apr 15 17:14:44 CEST 2021


Commit: a26f710d6277d3141f8ee9aee62922811cc80b14
Author: Jacques Lucke
Date:   Thu Apr 15 16:44:05 2021 +0200
Branches: virtual-array-attributes
https://developer.blender.org/rBa26f710d6277d3141f8ee9aee62922811cc80b14

rename to get_internal_span

===================================================================

M	source/blender/blenlib/BLI_virtual_array.hh
M	source/blender/blenlib/tests/BLI_virtual_array_test.cc
M	source/blender/functions/FN_generic_virtual_array.hh
M	source/blender/functions/intern/generic_virtual_array.cc
M	source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc

===================================================================

diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh
index ff32f8d95c6..d15ccd695dd 100644
--- a/source/blender/blenlib/BLI_virtual_array.hh
+++ b/source/blender/blenlib/BLI_virtual_array.hh
@@ -88,13 +88,13 @@ template<typename T> class VArray {
 
   /* Returns the internally used span of the virtual array. This invokes undefined behavior is the
    * virtual array is not stored as a span internally. */
-  Span<T> get_span() const
+  Span<T> get_internal_span() const
   {
     BLI_assert(this->is_span());
     if (size_ == 0) {
       return {};
     }
-    return this->get_span_impl();
+    return this->get_internal_span_impl();
   }
 
   /* Returns true when the virtual array returns the same value for every index. */
@@ -142,7 +142,7 @@ template<typename T> class VArray {
     return false;
   }
 
-  virtual Span<T> get_span_impl() const
+  virtual Span<T> get_internal_span_impl() const
   {
     BLI_assert_unreachable();
     return {};
@@ -164,7 +164,7 @@ template<typename T> class VArray {
   virtual void materialize_impl(MutableSpan<T> r_span) const
   {
     if (this->is_span()) {
-      const Span<T> span = this->get_span();
+      const Span<T> span = this->get_internal_span();
       initialized_copy_n(span.data(), size_, r_span.data());
     }
     else if (this->is_single()) {
@@ -182,7 +182,7 @@ template<typename T> class VArray {
   virtual void materialize_to_uninitialized_impl(MutableSpan<T> r_span) const
   {
     if (this->is_span()) {
-      const Span<T> span = this->get_span();
+      const Span<T> span = this->get_internal_span();
       uninitialized_copy_n(span.data(), size_, r_span.data());
     }
     else if (this->is_single()) {
@@ -218,10 +218,10 @@ template<typename T> class VMutableArray : public VArray<T> {
     this->set_all_impl(src);
   }
 
-  MutableSpan<T> get_span()
+  MutableSpan<T> get_internal_span()
   {
     BLI_assert(this->is_span());
-    Span<T> span = static_cast<const VArray<T> *>(this)->get_span();
+    Span<T> span = static_cast<const VArray<T> *>(this)->get_internal_span();
     return MutableSpan<T>(const_cast<T *>(span.data()), span.size());
   }
 
@@ -231,7 +231,7 @@ template<typename T> class VMutableArray : public VArray<T> {
   virtual void set_all_impl(Span<T> src)
   {
     if (this->is_span()) {
-      const MutableSpan<T> span = this->get_span();
+      const MutableSpan<T> span = this->get_internal_span();
       initialized_copy_n(src.data(), this->size_, span.data());
     }
     else {
@@ -271,7 +271,7 @@ template<typename T> class VArray_For_Span : public VArray<T> {
     return true;
   }
 
-  Span<T> get_span_impl() const final
+  Span<T> get_internal_span_impl() const final
   {
     return Span<T>(data_, this->size_);
   }
@@ -307,7 +307,7 @@ template<typename T> class VMutableArray_For_MutableSpan : public VMutableArray<
     return true;
   }
 
-  Span<T> get_span_impl() const override
+  Span<T> get_internal_span_impl() const override
   {
     return Span<T>(data_, this->size_);
   }
@@ -357,7 +357,7 @@ template<typename T> class VArray_For_Single final : public VArray<T> {
     return this->size_ == 1;
   }
 
-  Span<T> get_span_impl() const override
+  Span<T> get_internal_span_impl() const override
   {
     return Span<T>(&value_, 1);
   }
@@ -394,7 +394,7 @@ template<typename T> class VArray_Span final : public Span<T> {
   {
     this->size_ = varray_.size();
     if (varray_.is_span()) {
-      this->data_ = varray_.get_span().data();
+      this->data_ = varray_.get_internal_span().data();
     }
     else {
       owned_data_.~Array();
@@ -418,7 +418,7 @@ template<typename T> class VMutableArray_Span final : public MutableSpan<T> {
   {
     this->size_ = varray_.size();
     if (varray_.is_span()) {
-      this->data_ = varray_.get_span().data();
+      this->data_ = varray_.get_internal_span().data();
     }
     else {
       if (materialize) {
@@ -542,7 +542,7 @@ inline void devirtualize_varray(const VArray<T> &varray, const Func &func, bool
     }
     if (varray.is_span()) {
       /* `VArray_For_Span` can be used for devirtualization, because it is declared `final`. */
-      const VArray_For_Span<T> varray_span{varray.get_span()};
+      const VArray_For_Span<T> varray_span{varray.get_internal_span()};
       func(varray_span);
       return;
     }
@@ -568,20 +568,20 @@ inline void devirtualize_varray2(const VArray<T1> &varray1,
     const bool is_single1 = varray1.is_single();
     const bool is_single2 = varray2.is_single();
     if (is_span1 && is_span2) {
-      const VArray_For_Span<T1> varray1_span{varray1.get_span()};
-      const VArray_For_Span<T2> varray2_span{varray2.get_span()};
+      const VArray_For_Span<T1> varray1_span{varray1.get_internal_span()};
+      const VArray_For_Span<T2> varray2_span{varray2.get_internal_span()};
       func(varray1_span, varray2_span);
       return;
     }
     if (is_span1 && is_single2) {
-      const VArray_For_Span<T1> varray1_span{varray1.get_span()};
+      const VArray_For_Span<T1> varray1_span{varray1.get_internal_span()};
       const VArray_For_Single<T2> varray2_single{varray2.get_single(), varray2.size()};
       func(varray1_span, varray2_single);
       return;
     }
     if (is_single1 && is_span2) {
       const VArray_For_Single<T1> varray1_single{varray1.get_single(), varray1.size()};
-      const VArray_For_Span<T2> varray2_span{varray2.get_span()};
+      const VArray_For_Span<T2> varray2_span{varray2.get_internal_span()};
       func(varray1_single, varray2_span);
       return;
     }
diff --git a/source/blender/blenlib/tests/BLI_virtual_array_test.cc b/source/blender/blenlib/tests/BLI_virtual_array_test.cc
index 059f9f2d5d1..a6d2ca10315 100644
--- a/source/blender/blenlib/tests/BLI_virtual_array_test.cc
+++ b/source/blender/blenlib/tests/BLI_virtual_array_test.cc
@@ -18,7 +18,7 @@ TEST(virtual_array, Span)
   EXPECT_EQ(varray.get(4), 7);
   EXPECT_TRUE(varray.is_span());
   EXPECT_FALSE(varray.is_single());
-  EXPECT_EQ(varray.get_span().data(), data.data());
+  EXPECT_EQ(varray.get_internal_span().data(), data.data());
 }
 
 TEST(virtual_array, Single)
diff --git a/source/blender/functions/FN_generic_virtual_array.hh b/source/blender/functions/FN_generic_virtual_array.hh
index fa4f9298441..bc9c3aa0e56 100644
--- a/source/blender/functions/FN_generic_virtual_array.hh
+++ b/source/blender/functions/FN_generic_virtual_array.hh
@@ -89,13 +89,13 @@ class GVArray {
 
   /* Returns the internally used span of the virtual array. This invokes undefined behavior is the
    * virtual array is not stored as a span internally. */
-  GSpan get_span() const
+  GSpan get_internal_span() const
   {
     BLI_assert(this->is_span());
     if (size_ == 0) {
       return GSpan(*type_);
     }
-    return this->get_span_impl();
+    return this->get_internal_span_impl();
   }
 
   /* Returns true when the virtual array returns the same value for every index. */
@@ -144,7 +144,7 @@ class GVArray {
   virtual void get_to_uninitialized_impl(const int64_t index, void *r_value) const = 0;
 
   virtual bool is_span_impl() const;
-  virtual GSpan get_span_impl() const;
+  virtual GSpan get_internal_span_impl() const;
 
   virtual bool is_single_impl() const;
   virtual void get_single_impl(void *UNUSED(r_value)) const;
@@ -179,10 +179,10 @@ class GVMutableArray : public GVArray {
     this->set_by_relocate_impl(index, value);
   }
 
-  GMutableSpan get_span()
+  GMutableSpan get_internal_span()
   {
     BLI_assert(this->is_span());
-    GSpan span = static_cast<const GVArray *>(this)->get_span();
+    GSpan span = static_cast<const GVArray *>(this)->get_internal_span();
     return GMutableSpan(span.type(), const_cast<void *>(span.data()), span.size());
   }
 
@@ -228,7 +228,7 @@ class GVArray_For_GSpan : public GVArray {
   void get_to_uninitialized_impl(const int64_t index, void *r_value) const override;
 
   bool is_span_impl() const override;
-  GSpan get_span_impl() const override;
+  GSpan get_internal_span_impl() const override;
 };
 
 class GVArray_For_Empty : public GVArray {
@@ -271,7 +271,7 @@ class GVMutableArray_For_GMutableSpan : public GVMutableArray {
   void set_by_relocate_impl(const int64_t index, void *value) override;
 
   bool is_span_impl() const override;
-  GSpan get_span_impl() const override;
+  GSpan get_internal_span_impl() const override;
 };
 
 class GVArray_For_SingleValueRef : public GVArray {
@@ -293,7 +293,7 @@ class GVArray_For_SingleValueRef : public GVArray {
   void get_to_uninitialized_impl(const int64_t index, void *r_value) const override;
 
   bool is_span_impl() const override;
-  GSpan get_span_impl() const override;
+  GSpan get_internal_span_impl() const override;
 
   bool is_single_impl() const override;
   void get_single_impl(void *r_value) const override;
@@ -335,9 +335,9 @@ template<typename T> class GVArray_For_VArray : public GVArray {
     return varray_->is_span();
   }
 
-  GSpan get_span_impl() const override
+  GSpan get_internal_span_impl() const override
   {
-    return GSpan(varray_->get_span());
+    return GSpan(varray_->get_internal_span());
   }
 
   bool is_single_impl() const override
@@ -383,9 +383,9 @@ template<typename T> class VArray_For_GVArray : public VArray<T> {
     return varray_->is_span();
   }
 
-  Span<T> get_span_impl() const override
+  Span<T> get_internal_span_impl() const override
   {
-    return varray_->get_span().template typed<T>();
+    return varray_->get_internal_span().template typed<T>();
   }
 
   bool is_single_impl() const override
@@ -434,9 +434,9 @@ template<typename T> class VMutableArray_For_GVMutableArray : public VMutableArr
     return varray_->is_span();
   }
 
-  Span<T> get_span_impl() const override
+  Span<T> get_internal_span_impl() const override
   {
-    return varray_->get_span().template typed<T>();
+    return varray_->get_internal_span().template typed<T>();
   }
 
   bool is_single_impl() const override
@@ -482,9 +482,9 @@ template<typename T> class GVMutableArray_For_VMutableArray : public GVMutableAr
     return varray_->is_span();
   }
 
-  GSpan get_span_impl() const override
+  GSpan get_internal_span_impl() const override
   {
-    

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list