[Bf-blender-cvs] [f9caf48eab9] functions: Rename SmallSet to just Set

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


Commit: f9caf48eab9085df2531c03a47cb050b5ecb13e7
Author: Jacques Lucke
Date:   Mon Jul 22 16:57:59 2019 +0200
Branches: functions
https://developer.blender.org/rBf9caf48eab9085df2531c03a47cb050b5ecb13e7

Rename SmallSet to just Set

The fact that the data structure has small object optimization
is not important enough to justify a more complex name.
Following commits will rename other data structures.

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

M	source/blender/blenlib/BLI_mempool.hpp
M	source/blender/blenlib/BLI_object_pool.hpp
R091	source/blender/blenlib/BLI_small_set.hpp	source/blender/blenlib/BLI_set.hpp
M	source/blender/blenlib/BLI_small_map.hpp
M	source/blender/blenlib/BLI_small_set_vector.hpp
M	source/blender/blenlib/CMakeLists.txt
M	source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
M	source/blender/functions/core/data_flow_graph_builder.hpp
M	source/blender/functions/core/function_graph.cpp
M	source/blender/functions/core/function_graph.hpp
M	source/blender/simulations/bparticles/inserters.cpp
M	source/blender/simulations/bparticles/particles_container.hpp
R098	tests/gtests/blenlib/BLI_small_set_test.cc	tests/gtests/blenlib/BLI_set_test.cc
M	tests/gtests/blenlib/BLI_small_map_test.cc
M	tests/gtests/blenlib/CMakeLists.txt

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

diff --git a/source/blender/blenlib/BLI_mempool.hpp b/source/blender/blenlib/BLI_mempool.hpp
index 9455acf32a6..a18b4db49f3 100644
--- a/source/blender/blenlib/BLI_mempool.hpp
+++ b/source/blender/blenlib/BLI_mempool.hpp
@@ -20,7 +20,7 @@
  */
 
 #include "BLI_small_stack.hpp"
-#include "BLI_small_set.hpp"
+#include "BLI_set.hpp"
 
 namespace BLI {
 
@@ -31,7 +31,7 @@ class MemPool {
   uint m_element_size;
 
 #ifdef DEBUG
-  SmallSet<void *> m_allocated_pointers;
+  Set<void *> m_allocated_pointers;
 #endif
 
  public:
diff --git a/source/blender/blenlib/BLI_object_pool.hpp b/source/blender/blenlib/BLI_object_pool.hpp
index fe50bb77fec..014994c23c9 100644
--- a/source/blender/blenlib/BLI_object_pool.hpp
+++ b/source/blender/blenlib/BLI_object_pool.hpp
@@ -16,7 +16,7 @@
 #include <mutex>
 
 #include "BLI_small_stack.hpp"
-#include "BLI_small_set.hpp"
+#include "BLI_set.hpp"
 
 namespace BLI {
 
@@ -26,7 +26,7 @@ template<typename T> class ThreadSafeObjectPool {
   SmallStack<T *> m_free_objects;
 
 #ifdef DEBUG
-  SmallSet<T *> m_all_objects;
+  Set<T *> m_all_objects;
 #else
   SmallVector<T *> m_all_objects;
 #endif
diff --git a/source/blender/blenlib/BLI_small_set.hpp b/source/blender/blenlib/BLI_set.hpp
similarity index 91%
rename from source/blender/blenlib/BLI_small_set.hpp
rename to source/blender/blenlib/BLI_set.hpp
index d9c650e85c5..b0413a4c7c0 100644
--- a/source/blender/blenlib/BLI_small_set.hpp
+++ b/source/blender/blenlib/BLI_set.hpp
@@ -31,7 +31,7 @@
 
 namespace BLI {
 
-template<typename T, uint N = 4> class SmallSet {
+template<typename T, uint N = 4> class Set {
  protected:
   SmallVector<T, N> m_elements;
   ArrayLookup<T, N> m_lookup;
@@ -40,22 +40,22 @@ template<typename T, uint N = 4> class SmallSet {
   /**
    * Create an empty set.
    */
-  SmallSet() = default;
+  Set() = default;
 
   /**
    * Create a set that contains any of the given values at least once.
    * The size of the set might be small than the original array.
    */
-  SmallSet(ArrayRef<T> values)
+  Set(ArrayRef<T> values)
   {
     this->add_multiple(values);
   }
 
-  SmallSet(const SmallVector<T> &values) : SmallSet(ArrayRef<T>(values))
+  Set(const SmallVector<T> &values) : Set(ArrayRef<T>(values))
   {
   }
 
-  SmallSet(const std::initializer_list<T> &values) : SmallSet(ArrayRef<T>(values))
+  Set(const std::initializer_list<T> &values) : Set(ArrayRef<T>(values))
   {
   }
 
@@ -178,15 +178,15 @@ template<typename T, uint N = 4> class SmallSet {
   /**
    * Return true when there is no value that exists in both sets, otherwise false.
    */
-  static bool Disjoint(const SmallSet &a, const SmallSet &b)
+  static bool Disjoint(const Set &a, const Set &b)
   {
-    return !SmallSet::Intersects(a, b);
+    return !Set::Intersects(a, b);
   }
 
   /**
    * Return true when there is at least one value that exists in both sets, otherwise false.
    */
-  static bool Intersects(const SmallSet &a, const SmallSet &b)
+  static bool Intersects(const Set &a, const Set &b)
   {
     for (const T &value : a) {
       if (b.contains(value)) {
diff --git a/source/blender/blenlib/BLI_small_map.hpp b/source/blender/blenlib/BLI_small_map.hpp
index d7fe1b7306c..e9abc133b2d 100644
--- a/source/blender/blenlib/BLI_small_map.hpp
+++ b/source/blender/blenlib/BLI_small_map.hpp
@@ -18,7 +18,7 @@
  * \ingroup bli
  *
  * An unordered map implementation with small object optimization.
- * Similar to SmallSet, this builds on top of SmallVector
+ * Similar to Set, this builds on top of SmallVector
  * and ArrayLookup to reduce what this code has to deal with.
  */
 
diff --git a/source/blender/blenlib/BLI_small_set_vector.hpp b/source/blender/blenlib/BLI_small_set_vector.hpp
index ffd45490aee..a1e491d17a4 100644
--- a/source/blender/blenlib/BLI_small_set_vector.hpp
+++ b/source/blender/blenlib/BLI_small_set_vector.hpp
@@ -18,27 +18,27 @@
  * \ingroup bli
  *
  * A set with small object optimization that keeps track
- * of insertion order. Internally, it is the same as SmallSet
+ * of insertion order. Internally, it is the same as Set
  * but that could potentially change in the future.
  */
 
 #pragma once
 
-#include "BLI_small_set.hpp"
+#include "BLI_set.hpp"
 
 namespace BLI {
 
-template<typename T> class SmallSetVector : public SmallSet<T> {
+template<typename T> class SmallSetVector : public Set<T> {
  public:
-  SmallSetVector() : SmallSet<T>()
+  SmallSetVector() : Set<T>()
   {
   }
 
-  SmallSetVector(const std::initializer_list<T> &values) : SmallSet<T>(values)
+  SmallSetVector(const std::initializer_list<T> &values) : Set<T>(values)
   {
   }
 
-  SmallSetVector(const SmallVector<T> &values) : SmallSet<T>(values)
+  SmallSetVector(const SmallVector<T> &values) : Set<T>(values)
   {
   }
 
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index e809cadf952..56ee74c8eb0 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -254,7 +254,7 @@ set(SRC
   BLI_small_vector.hpp
   BLI_small_map.hpp
   BLI_small_multimap.hpp
-  BLI_small_set.hpp
+  BLI_set.hpp
   BLI_small_set_vector.hpp
   BLI_small_stack.hpp
   BLI_string_map.hpp
diff --git a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
index 6830060009a..b379b33d36e 100644
--- a/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
+++ b/source/blender/functions/backends/llvm/fgraph_ir_generation.cpp
@@ -8,10 +8,10 @@ class BuildGraphIR : public LLVMBuildIRBody {
  private:
   FunctionGraph m_fgraph;
   DataFlowGraph *m_graph;
-  SmallSet<DFGraphSocket> m_required_sockets;
+  Set<DFGraphSocket> m_required_sockets;
 
   using SocketValueMap = SmallMap<DFGraphSocket, llvm::Value *>;
-  using FunctionDFGB_SocketSet = SmallSet<DFGraphSocket>;
+  using FunctionDFGB_SocketSet = Set<DFGraphSocket>;
 
  public:
   BuildGraphIR(FunctionGraph &fgraph) : m_fgraph(fgraph), m_graph(fgraph.graph().ptr())
diff --git a/source/blender/functions/core/data_flow_graph_builder.hpp b/source/blender/functions/core/data_flow_graph_builder.hpp
index 86224018acf..61e990644f1 100644
--- a/source/blender/functions/core/data_flow_graph_builder.hpp
+++ b/source/blender/functions/core/data_flow_graph_builder.hpp
@@ -22,7 +22,7 @@ class DFGB_Node;
 class DataFlowGraphBuilder;
 class DataFlowGraph;
 
-using DFGB_SocketSet = SmallSet<DFGB_Socket>;
+using DFGB_SocketSet = Set<DFGB_Socket>;
 using DFGB_SocketVector = SmallVector<DFGB_Socket>;
 using DFGB_SocketSetVector = SmallSetVector<DFGB_Socket>;
 
@@ -188,7 +188,7 @@ class DataFlowGraphBuilder {
   void to_dot__clipboard();
 
  private:
-  SmallSet<DFGB_Node *> m_nodes;
+  Set<DFGB_Node *> m_nodes;
   SmallMap<DFGB_Socket, DFGB_Socket> m_input_origins;
   SmallMultiMap<DFGB_Socket, DFGB_Socket> m_output_targets;
   MonotonicAllocator<sizeof(DFGB_Node) * 4> m_node_allocator;
diff --git a/source/blender/functions/core/function_graph.cpp b/source/blender/functions/core/function_graph.cpp
index e5256fbe623..595156f4e3a 100644
--- a/source/blender/functions/core/function_graph.cpp
+++ b/source/blender/functions/core/function_graph.cpp
@@ -16,12 +16,12 @@ SharedFunction FunctionGraph::new_function(StringRef name) const
   return builder.build(name);
 }
 
-SmallSet<DFGraphSocket> FunctionGraph::find_used_sockets(bool include_inputs,
-                                                         bool include_outputs) const
+Set<DFGraphSocket> FunctionGraph::find_used_sockets(bool include_inputs,
+                                                    bool include_outputs) const
 {
-  SmallSet<DFGraphSocket> found;
+  Set<DFGraphSocket> found;
 
-  SmallSet<DFGraphSocket> to_be_checked;
+  Set<DFGraphSocket> to_be_checked;
   for (DFGraphSocket socket : m_outputs) {
     to_be_checked.add_new(socket);
   }
diff --git a/source/blender/functions/core/function_graph.hpp b/source/blender/functions/core/function_graph.hpp
index cbc963b3818..a95d763633b 100644
--- a/source/blender/functions/core/function_graph.hpp
+++ b/source/blender/functions/core/function_graph.hpp
@@ -56,7 +56,7 @@ class FunctionGraph {
    * Get a subset of all sockets in the graph that can influence the function execution (under the
    * assumption, that functions do not have side effects).
    */
-  SmallSet<DFGraphSocket> find_used_sockets(bool include_inputs, bool include_outputs) const;
+  Set<DFGraphSocket> find_used_sockets(bool include_inputs, bool include_outputs) const;
 };
 
 }  // namespace FN
diff --git a/source/blender/simulations/bparticles/inserters.cpp b/source/blender/simulations/bparticles/inserters.cpp
index 6000e944d12..ba3f06c183f 100644
--- a/source/blender/simulations/bparticles/inserters.cpp
+++ b/source/blender/simulations/bparticles/inserters.cpp
@@ -31,8 +31,8 @@ static SmallVector<FN::DFGraphSocket> insert_inputs(FN::FunctionBuilder &fn_buil
                                                     BTreeDataGraph &data_graph,
                                                     ArrayRef<VirtualSocket *> output_vsockets)
 {
-  SmallSet<VirtualSocket *> to_be_checked = output_vsockets;
-  SmallSet<VirtualSocket *> found_inputs;
+  Set<VirtualSocket *> to_be_checked = output_vsockets;
+  Set<VirtualSocket *> found_inputs;
   SmallVector<FN::DFGraphSocket> inputs;
 
   while (to_be_checked.size() > 0) {
diff --git a/source/blender/simulations/bparticles/particles_container.hpp b/source/blender/simulations/bparticles/particles_container.hpp
index 072f8e1952a..f77b20feb96 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -9,8 +9,8 @@
 
 namespace BParticles {
 
+using BLI::Set;
 using BLI::SmallMap;
-using BLI::SmallSet;
 using BLI::SmallStack;
 
 class ParticlesContainer;
diff --git a/tests/gtests/blenlib/BLI_small_set_test.cc b/tests/gtests/blenlib/BLI_set_test.cc
similarity index 98%
rename from tests/gtests/blenlib/BLI_small_set_test.cc
rename to tests/gtests/blenlib/BLI_set_test.cc
index 07c249ee786..7b7bc7afa60 100644
--- a/tests/gtests/blenlib/BLI_small_set_test.cc
+++ b/tests/gtests/blenlib/BLI_set_test.cc
@@ -1,7 +1,7 @@
 #include "testing/testing.

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list