[Bf-blender-cvs] [f0c164b8614] functions: rename SmallVector to Vector

Jacques Lucke noreply at git.blender.org
Mon Jul 22 18:13:33 CEST 2019


Commit: f0c164b861430b3a9f7e7dbb3f367085ef58b16f
Author: Jacques Lucke
Date:   Mon Jul 22 17:17:47 2019 +0200
Branches: functions
https://developer.blender.org/rBf0c164b861430b3a9f7e7dbb3f367085ef58b16f

rename SmallVector to Vector

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

M	source/blender/blenkernel/BKE_node_tree.hpp
M	source/blender/blenkernel/intern/node_tree.cpp
M	source/blender/blenlib/BLI_array_allocator.hpp
M	source/blender/blenlib/BLI_array_lookup.hpp
M	source/blender/blenlib/BLI_chained_strings.hpp
M	source/blender/blenlib/BLI_map.hpp
M	source/blender/blenlib/BLI_mempool.hpp
M	source/blender/blenlib/BLI_monotonic_allocator.hpp
M	source/blender/blenlib/BLI_multimap.hpp
M	source/blender/blenlib/BLI_object_pool.hpp
M	source/blender/blenlib/BLI_range.hpp
M	source/blender/blenlib/BLI_set.hpp
M	source/blender/blenlib/BLI_set_vector.hpp
M	source/blender/blenlib/BLI_stack.hpp
R092	source/blender/blenlib/BLI_small_vector.hpp	source/blender/blenlib/BLI_vector.hpp
M	source/blender/blenlib/CMakeLists.txt
M	source/blender/functions/backends/dependencies/fgraph_dependencies.cpp
M	source/blender/functions/backends/llvm/builder.hpp
M	source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
M	source/blender/functions/backends/llvm/llvm_types.cpp
M	source/blender/functions/backends/llvm/llvm_types.hpp
M	source/blender/functions/backends/tuple/tuple.hpp
M	source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
M	source/blender/functions/backends/tuple_call/tuple_call.cpp
M	source/blender/functions/backends/tuple_call/tuple_call.hpp
M	source/blender/functions/core/data_flow_graph.cpp
M	source/blender/functions/core/data_flow_graph.hpp
M	source/blender/functions/core/data_flow_graph_builder.cpp
M	source/blender/functions/core/data_flow_graph_builder.hpp
M	source/blender/functions/core/function.hpp
M	source/blender/functions/frontends/data_flow_nodes/graph_generation.cpp
M	source/blender/functions/frontends/data_flow_nodes/inserters.cpp
M	source/blender/functions/frontends/data_flow_nodes/inserters/nodes.cpp
M	source/blender/functions/functions/auto_vectorization.cpp
M	source/blender/functions/functions/switch.cpp
M	source/blender/functions/types/lists.hpp
M	source/blender/simulations/bparticles/action_interface.hpp
M	source/blender/simulations/bparticles/actions.cpp
M	source/blender/simulations/bparticles/attributes.cpp
M	source/blender/simulations/bparticles/attributes.hpp
M	source/blender/simulations/bparticles/c_wrapper.cpp
M	source/blender/simulations/bparticles/emitters.cpp
M	source/blender/simulations/bparticles/events.cpp
M	source/blender/simulations/bparticles/inserters.cpp
M	source/blender/simulations/bparticles/integrator.hpp
M	source/blender/simulations/bparticles/offset_handlers.cpp
M	source/blender/simulations/bparticles/particle_allocator.cpp
M	source/blender/simulations/bparticles/particle_allocator.hpp
M	source/blender/simulations/bparticles/particle_set.hpp
M	source/blender/simulations/bparticles/particles_container.cpp
M	source/blender/simulations/bparticles/particles_container.hpp
M	source/blender/simulations/bparticles/simulate.cpp
M	source/blender/simulations/bparticles/step_description.hpp
M	source/blender/simulations/bparticles/step_description_interfaces.cpp
M	source/blender/simulations/bparticles/step_description_interfaces.hpp
M	tests/gtests/blenlib/BLI_array_ref_test.cc
M	tests/gtests/blenlib/BLI_multimap_test.cc
M	tests/gtests/blenlib/BLI_range_test.cc
M	tests/gtests/blenlib/BLI_set_test.cc
M	tests/gtests/blenlib/BLI_string_ref_test.cc
R095	tests/gtests/blenlib/BLI_small_vector_test.cc	tests/gtests/blenlib/BLI_vector_test.cc
M	tests/gtests/blenlib/CMakeLists.txt

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

diff --git a/source/blender/blenkernel/BKE_node_tree.hpp b/source/blender/blenkernel/BKE_node_tree.hpp
index 5e8ea5320fc..8e2c55eca84 100644
--- a/source/blender/blenkernel/BKE_node_tree.hpp
+++ b/source/blender/blenkernel/BKE_node_tree.hpp
@@ -5,7 +5,7 @@
 #include "BLI_string_ref.hpp"
 #include "BLI_array_ref.hpp"
 #include "BLI_map.hpp"
-#include "BLI_small_vector.hpp"
+#include "BLI_vector.hpp"
 #include "BLI_listbase_wrapper.hpp"
 #include "BLI_multimap.hpp"
 #include "BLI_monotonic_allocator.hpp"
@@ -19,9 +19,9 @@ using BLI::ListBaseWrapper;
 using BLI::Map;
 using BLI::MonotonicAllocator;
 using BLI::MultiMap;
-using BLI::SmallVector;
 using BLI::StringRef;
 using BLI::StringRefNull;
+using BLI::Vector;
 
 using bNodeList = ListBaseWrapper<struct bNode *, true>;
 using bLinkList = ListBaseWrapper<struct bNodeLink *, true>;
@@ -106,20 +106,18 @@ class IndexedNodeTree {
   bool is_reroute(bNode *bnode) const;
   bool is_frame(bNode *bnode) const;
 
-  void find_connected_sockets_left(bNodeSocket *bsocket,
-                                   SmallVector<SocketWithNode> &r_sockets) const;
-  void find_connected_sockets_right(bNodeSocket *bsocket,
-                                    SmallVector<SocketWithNode> &r_sockets) const;
+  void find_connected_sockets_left(bNodeSocket *bsocket, Vector<SocketWithNode> &r_sockets) const;
+  void find_connected_sockets_right(bNodeSocket *bsocket, Vector<SocketWithNode> &r_sockets) const;
 
   bNodeTree *m_btree;
-  SmallVector<bNode *> m_original_nodes;
-  SmallVector<bNodeLink *> m_original_links;
-  SmallVector<bNode *> m_actual_nodes;
+  Vector<bNode *> m_original_nodes;
+  Vector<bNodeLink *> m_original_links;
+  Vector<bNode *> m_actual_nodes;
   Map<bNodeSocket *, bNode *> m_node_by_socket;
   MultiMap<bNodeSocket *, SocketWithNode> m_direct_links;
   MultiMap<bNodeSocket *, SocketWithNode> m_links;
   MultiMap<std::string, bNode *> m_nodes_by_idname;
-  SmallVector<SingleOriginLink> m_single_origin_links;
+  Vector<SingleOriginLink> m_single_origin_links;
 };
 
 class VirtualNode;
@@ -130,9 +128,9 @@ class VirtualNodeTree {
  private:
   bool m_frozen = false;
   MonotonicAllocator<> m_allocator;
-  SmallVector<VirtualNode *> m_nodes;
-  SmallVector<VirtualLink *> m_links;
-  SmallVector<VirtualSocket *> m_inputs_with_links;
+  Vector<VirtualNode *> m_nodes;
+  Vector<VirtualLink *> m_links;
+  Vector<VirtualSocket *> m_inputs_with_links;
   MultiMap<std::string, VirtualNode *> m_nodes_by_idname;
 
  public:
diff --git a/source/blender/blenkernel/intern/node_tree.cpp b/source/blender/blenkernel/intern/node_tree.cpp
index ca58c52c1ec..ed113c1b26f 100644
--- a/source/blender/blenkernel/intern/node_tree.cpp
+++ b/source/blender/blenkernel/intern/node_tree.cpp
@@ -29,12 +29,12 @@ IndexedNodeTree::IndexedNodeTree(bNodeTree *btree)
 
   for (bNodeLink *blink : m_original_links) {
     if (!this->is_reroute(blink->fromnode) && !m_links.contains(blink->fromsock)) {
-      SmallVector<SocketWithNode> connected;
+      Vector<SocketWithNode> connected;
       this->find_connected_sockets_right(blink->fromsock, connected);
       m_links.add_multiple_new(blink->fromsock, connected);
     }
     if (!this->is_reroute(blink->tonode) && !m_links.contains(blink->tosock)) {
-      SmallVector<SocketWithNode> connected;
+      Vector<SocketWithNode> connected;
       this->find_connected_sockets_left(blink->tosock, connected);
       m_links.add_multiple_new(blink->tosock, connected);
       if (connected.size() == 1) {
@@ -45,7 +45,7 @@ IndexedNodeTree::IndexedNodeTree(bNodeTree *btree)
 }
 
 void IndexedNodeTree::find_connected_sockets_left(bNodeSocket *bsocket,
-                                                  SmallVector<SocketWithNode> &r_sockets) const
+                                                  Vector<SocketWithNode> &r_sockets) const
 {
   BLI_assert(bsocket->in_out == SOCK_IN);
   auto from_sockets = m_direct_links.lookup_default(bsocket);
@@ -59,7 +59,7 @@ void IndexedNodeTree::find_connected_sockets_left(bNodeSocket *bsocket,
   }
 }
 void IndexedNodeTree::find_connected_sockets_right(bNodeSocket *bsocket,
-                                                   SmallVector<SocketWithNode> &r_sockets) const
+                                                   Vector<SocketWithNode> &r_sockets) const
 {
   BLI_assert(bsocket->in_out == SOCK_OUT);
   auto to_sockets = m_direct_links.lookup_default(bsocket);
@@ -146,8 +146,8 @@ VirtualNode *VirtualNodeTree::add_bnode(bNodeTree *btree, bNode *bnode)
   vnode->m_bnode = bnode;
   vnode->m_btree = btree;
 
-  SmallVector<bNodeSocket *, 10> original_inputs(bnode->inputs, true);
-  SmallVector<bNodeSocket *, 10> original_outputs(bnode->outputs, true);
+  Vector<bNodeSocket *, 10> original_inputs(bnode->inputs, true);
+  Vector<bNodeSocket *, 10> original_outputs(bnode->outputs, true);
 
   vnode->m_inputs = m_allocator.allocate_array<VirtualSocket>(original_inputs.size());
   vnode->m_outputs = m_allocator.allocate_array<VirtualSocket>(original_outputs.size());
@@ -221,7 +221,7 @@ static bool is_reroute(VirtualNode *vnode)
 }
 
 static void find_connected_sockets_left(VirtualSocket *vsocket,
-                                        SmallVector<VirtualSocket *> &r_found)
+                                        Vector<VirtualSocket *> &r_found)
 {
   BLI_assert(vsocket->is_input());
   for (VirtualSocket *other : vsocket->direct_links()) {
@@ -235,7 +235,7 @@ static void find_connected_sockets_left(VirtualSocket *vsocket,
 }
 
 static void find_connected_sockets_right(VirtualSocket *vsocket,
-                                         SmallVector<VirtualSocket *> &r_found)
+                                         Vector<VirtualSocket *> &r_found)
 {
   BLI_assert(vsocket->is_output());
   for (VirtualSocket *other : vsocket->direct_links()) {
@@ -253,14 +253,14 @@ BLI_NOINLINE void VirtualNodeTree::initialize_links()
   for (VirtualLink *vlink : m_links) {
     if (vlink->m_from->m_links.size() == 0) {
       VirtualSocket *vsocket = vlink->m_from;
-      SmallVector<VirtualSocket *> found;
+      Vector<VirtualSocket *> found;
       find_connected_sockets_right(vsocket, found);
       vsocket->m_links = m_allocator.allocate_array<VirtualSocket *>(found.size());
       vsocket->m_links.copy_from(found);
     }
     if (vlink->m_to->m_links.size() == 0) {
       VirtualSocket *vsocket = vlink->m_to;
-      SmallVector<VirtualSocket *> found;
+      Vector<VirtualSocket *> found;
       find_connected_sockets_left(vsocket, found);
       vsocket->m_links = m_allocator.allocate_array<VirtualSocket *>(found.size());
       vsocket->m_links.copy_from(found);
diff --git a/source/blender/blenlib/BLI_array_allocator.hpp b/source/blender/blenlib/BLI_array_allocator.hpp
index a247bff53e8..bc36d0f3ad7 100644
--- a/source/blender/blenlib/BLI_array_allocator.hpp
+++ b/source/blender/blenlib/BLI_array_allocator.hpp
@@ -13,8 +13,8 @@ namespace BLI {
 
 class ArrayAllocator {
  private:
-  SmallVector<void *, 16> m_all_pointers;
-  SmallVector<Stack<void *>, 16> m_pointer_stacks;
+  Vector<void *, 16> m_all_pointers;
+  Vector<Stack<void *>, 16> m_pointer_stacks;
   uint m_array_length;
 
  public:
@@ -149,18 +149,18 @@ class ArrayAllocator {
     return ScopedAllocation<T>(*this, this->allocate<T>(), sizeof(T));
   }
 
-  template<typename T> class Vector {
+  template<typename T> class VectorAdapter {
    private:
     ScopedAllocation<T> m_ptr;
     VectorAdaptor<T> m_vector;
 
    public:
-    Vector(ArrayAllocator &allocator)
+    VectorAdapter(ArrayAllocator &allocator)
         : m_ptr(allocator.allocate_scoped<T>()), m_vector(m_ptr, allocator.array_size())
     {
     }
 
-    ~Vector() = default;
+    ~VectorAdapter() = default;
 
     operator VectorAdaptor<T> &()
     {
diff --git a/source/blender/blenlib/BLI_array_lookup.hpp b/source/blender/blenlib/BLI_array_lookup.hpp
index 2b1a9ed2fd6..a0d861148a8 100644
--- a/source/blender/blenlib/BLI_array_lookup.hpp
+++ b/source/blender/blenlib/BLI_array_lookup.hpp
@@ -11,7 +11,7 @@
 #include <cmath>
 
 #include "BLI_utildefines.h"
-#include "BLI_small_vector.hpp"
+#include "BLI_vector.hpp"
 #include "BLI_math_bits.h"
 #include "BLI_ghash.h"
 #include "BLI_hash.h"
@@ -61,7 +61,7 @@ class ArrayLookup {
   }
 
   static const uint N_EXP = calc_exp(N);
-  using Mapping = SmallVector<int, (1 << N_EXP)>;
+  using Mapping = Vector<int, (1 << N_EXP)>;
 
   Mapping m_map;
   uint m_length;
@@ -318,7 +318,7 @@ class ArrayLookup {
 
  private:
   struct LookupStats {
-    SmallVector<uint> collisions_amount_distribution;
+    Vector<uint> collisions_amount_distribution;
     uint max_collisions = 0;
     float average_collisions;
   };
@@ -353,7 +353,7 @@ class ArrayLookup {
   LookupStats create_lookup_stats(Item *array) const
   {
     LookupStats stats;
-    stats.collisions_amount_distribution = SmallVector<uint>(m_map.size());
+    stats.collisions_amount_distribution = Vector<uint>(m_map.size());
     stats.collisions_amount_distribution.fill(0);
 
     uint collisions_sum = 0;
diff --git a/source/blender/blenlib/BLI_chained_strings.hpp b/source/blender/blenlib/BLI_chained_strings.hpp
index 01952ad8487..bd3372f2242 100644
--- a/source/blender/blenlib/BLI_chained_strings.hpp
+++ b/source/blender/blenlib/BLI_chained_strings.hpp
@@ -7,7 +7,7 @@
  *   - All string lengths are known in the beginning. */
 
 #include "BLI_string_ref.hpp"
-#include "BLI_small_vector.hpp"
+#include "BLI_vector.hpp"
 
 namespace BLI {
 
@@ -51,7 +51,7 @@ class ChainedStringsBuilder {
   }
 
  private:
-  SmallVector<char, 64> m_chars;
+  Vector<char, 64> m_chars;
 };
 
 };  // namespace BLI
diff --git a/source/blender/blenlib/BLI_map.hpp b/source/blender/blenlib/BLI_map.hpp
index e4341b6e73a..916bf955dd8 100644
--- a/source/blender/blenlib/BLI_map.hpp
+++ b/source/blender/blenlib/BLI_map.hpp
@@ -18,13 +18,13 @@
  * \ingroup bli
  *
  * An unordered map implementation with small object optimization.
- * Similar to Set, this builds on top of SmallVector
+ * Similar to Set, this builds on top of Vector
  * and ArrayLookup to reduce what this code has to deal with.
  */
 
 #pragma once
 
-#include "BLI_small_vector.hpp"
+#include "BLI_vector.hpp"
 #include 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list