[Bf-blender-cvs] [d0d6f387548] functions: rename SmallStack to Stack

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


Commit: d0d6f387548ea67d90397eb7b4313ad4dc36aebe
Author: Jacques Lucke
Date:   Mon Jul 22 17:05:37 2019 +0200
Branches: functions
https://developer.blender.org/rBd0d6f387548ea67d90397eb7b4313ad4dc36aebe

rename SmallStack to Stack

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

M	source/blender/blenlib/BLI_array_allocator.hpp
M	source/blender/blenlib/BLI_mempool.hpp
M	source/blender/blenlib/BLI_object_pool.hpp
R094	source/blender/blenlib/BLI_small_stack.hpp	source/blender/blenlib/BLI_stack.hpp
M	source/blender/blenlib/CMakeLists.txt
M	source/blender/blenlib/intern/BLI_lazy_init.cpp
M	source/blender/functions/backends/tuple_call/execution_context.hpp
M	source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
M	source/blender/simulations/bparticles/particles_container.hpp
R092	tests/gtests/blenlib/BLI_small_stack_test.cc	tests/gtests/blenlib/BLI_stack_cpp_test.cc
M	tests/gtests/blenlib/CMakeLists.txt

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

diff --git a/source/blender/blenlib/BLI_array_allocator.hpp b/source/blender/blenlib/BLI_array_allocator.hpp
index 736a217b1bc..a247bff53e8 100644
--- a/source/blender/blenlib/BLI_array_allocator.hpp
+++ b/source/blender/blenlib/BLI_array_allocator.hpp
@@ -6,7 +6,7 @@
  * size of a single element to identify the buffer length, which is a small number usually.
  */
 
-#include "BLI_small_stack.hpp"
+#include "BLI_stack.hpp"
 #include "BLI_vector_adaptor.hpp"
 
 namespace BLI {
@@ -14,7 +14,7 @@ namespace BLI {
 class ArrayAllocator {
  private:
   SmallVector<void *, 16> m_all_pointers;
-  SmallVector<SmallStack<void *>, 16> m_pointer_stacks;
+  SmallVector<Stack<void *>, 16> m_pointer_stacks;
   uint m_array_length;
 
  public:
@@ -48,7 +48,7 @@ class ArrayAllocator {
    */
   void *allocate(uint element_size)
   {
-    SmallStack<void *> &stack = this->stack_for_element_size(element_size);
+    Stack<void *> &stack = this->stack_for_element_size(element_size);
     if (stack.size() > 0) {
       return stack.pop();
     }
@@ -62,7 +62,7 @@ class ArrayAllocator {
    */
   void deallocate(void *ptr, uint element_size)
   {
-    SmallStack<void *> &stack = this->stack_for_element_size(element_size);
+    Stack<void *> &stack = this->stack_for_element_size(element_size);
     stack.push(ptr);
   }
 
@@ -201,7 +201,7 @@ class ArrayAllocator {
   };
 
  private:
-  SmallStack<void *> &stack_for_element_size(uint element_size)
+  Stack<void *> &stack_for_element_size(uint element_size)
   {
     BLI_assert(element_size > 0);
     uint index = element_size - 1;
diff --git a/source/blender/blenlib/BLI_mempool.hpp b/source/blender/blenlib/BLI_mempool.hpp
index a18b4db49f3..6481486efa4 100644
--- a/source/blender/blenlib/BLI_mempool.hpp
+++ b/source/blender/blenlib/BLI_mempool.hpp
@@ -19,14 +19,14 @@
  *
  */
 
-#include "BLI_small_stack.hpp"
+#include "BLI_stack.hpp"
 #include "BLI_set.hpp"
 
 namespace BLI {
 
 class MemPool {
  private:
-  SmallStack<void *> m_free_stack;
+  Stack<void *> m_free_stack;
   SmallVector<void *> m_start_pointers;
   uint m_element_size;
 
diff --git a/source/blender/blenlib/BLI_object_pool.hpp b/source/blender/blenlib/BLI_object_pool.hpp
index 014994c23c9..7dd4c8acae7 100644
--- a/source/blender/blenlib/BLI_object_pool.hpp
+++ b/source/blender/blenlib/BLI_object_pool.hpp
@@ -15,7 +15,7 @@
 
 #include <mutex>
 
-#include "BLI_small_stack.hpp"
+#include "BLI_stack.hpp"
 #include "BLI_set.hpp"
 
 namespace BLI {
@@ -23,7 +23,7 @@ namespace BLI {
 template<typename T> class ThreadSafeObjectPool {
  private:
   std::mutex m_mutex;
-  SmallStack<T *> m_free_objects;
+  Stack<T *> m_free_objects;
 
 #ifdef DEBUG
   Set<T *> m_all_objects;
diff --git a/source/blender/blenlib/BLI_small_stack.hpp b/source/blender/blenlib/BLI_stack.hpp
similarity index 94%
rename from source/blender/blenlib/BLI_small_stack.hpp
rename to source/blender/blenlib/BLI_stack.hpp
index fe6667e8bd5..7830f6016a0 100644
--- a/source/blender/blenlib/BLI_small_stack.hpp
+++ b/source/blender/blenlib/BLI_stack.hpp
@@ -27,18 +27,18 @@
 
 namespace BLI {
 
-template<typename T, uint N = 4> class SmallStack {
+template<typename T, uint N = 4> class Stack {
  private:
   SmallVector<T, N> m_elements;
 
  public:
-  SmallStack() = default;
+  Stack() = default;
 
   /**
    * Construct a stack from an array ref. The elements will be pushed in the same order they are in
    * the array.
    */
-  SmallStack(ArrayRef<T> values) : m_elements(values)
+  Stack(ArrayRef<T> values) : m_elements(values)
   {
   }
 
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 2c175564adc..31046946401 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -256,7 +256,7 @@ set(SRC
   BLI_small_multimap.hpp
   BLI_set.hpp
   BLI_set_vector.hpp
-  BLI_small_stack.hpp
+  BLI_stack.hpp
   BLI_string_map.hpp
   BLI_string_ref.hpp
   BLI_timeit.hpp
diff --git a/source/blender/blenlib/intern/BLI_lazy_init.cpp b/source/blender/blenlib/intern/BLI_lazy_init.cpp
index 66a72ff17e7..01b3b6138d1 100644
--- a/source/blender/blenlib/intern/BLI_lazy_init.cpp
+++ b/source/blender/blenlib/intern/BLI_lazy_init.cpp
@@ -1,14 +1,14 @@
 #include <mutex>
 
 #include "BLI_lazy_init.hpp"
-#include "BLI_small_stack.hpp"
+#include "BLI_stack.hpp"
 
 struct FreeFunc {
   std::function<void()> func;
   const char *name;
 };
 
-BLI::SmallStack<FreeFunc> free_functions;
+BLI::Stack<FreeFunc> free_functions;
 std::mutex store_free_func_mutex;
 
 void BLI_lazy_init_free_all()
diff --git a/source/blender/functions/backends/tuple_call/execution_context.hpp b/source/blender/functions/backends/tuple_call/execution_context.hpp
index b966364945e..391c9aae8ad 100644
--- a/source/blender/functions/backends/tuple_call/execution_context.hpp
+++ b/source/blender/functions/backends/tuple_call/execution_context.hpp
@@ -12,11 +12,11 @@
  */
 
 #include "FN_core.hpp"
-#include "BLI_small_stack.hpp"
+#include "BLI_stack.hpp"
 
 namespace FN {
 
-using BLI::SmallStack;
+using BLI::Stack;
 
 class StackFrame {
  public:
@@ -64,7 +64,7 @@ class TextStackFrame : public StackFrame {
 
 class ExecutionStack {
  private:
-  SmallStack<StackFrame *, 10> m_stack;
+  Stack<StackFrame *, 10> m_stack;
 
  public:
   ExecutionStack() = default;
diff --git a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
index 48c9d6a9d82..b3497aefabf 100644
--- a/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
+++ b/source/blender/functions/backends/tuple_call/fgraph_tuple_call.cpp
@@ -258,8 +258,8 @@ class ExecuteFGraph : public TupleCallBody {
                  true, \
                  false);
 
-  using SocketsToComputeStack = SmallStack<DFGraphSocket, 64>;
-  using LazyStatesStack = SmallStack<LazyStateOfNode>;
+  using SocketsToComputeStack = Stack<DFGraphSocket, 64>;
+  using LazyStatesStack = Stack<LazyStateOfNode>;
 
   void evaluate_graph_to_compute_outputs(SocketValueStorage &storage,
                                          Tuple &fn_out,
diff --git a/source/blender/simulations/bparticles/particles_container.hpp b/source/blender/simulations/bparticles/particles_container.hpp
index b4a59f5e94d..615b0c03724 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -3,7 +3,7 @@
 #include <mutex>
 
 #include "BLI_small_map.hpp"
-#include "BLI_small_stack.hpp"
+#include "BLI_stack.hpp"
 
 #include "attributes.hpp"
 
@@ -11,7 +11,7 @@ namespace BParticles {
 
 using BLI::Set;
 using BLI::SmallMap;
-using BLI::SmallStack;
+using BLI::Stack;
 
 class ParticlesContainer;
 class ParticlesBlock;
@@ -28,7 +28,7 @@ class ParticlesContainer {
  private:
   AttributesInfo m_attributes_info;
   SetVector<ParticlesBlock *> m_active_blocks;
-  SmallStack<ParticlesBlock *> m_cached_blocks;
+  Stack<ParticlesBlock *> m_cached_blocks;
   uint m_block_size;
   std::mutex m_blocks_mutex;
 
diff --git a/tests/gtests/blenlib/BLI_small_stack_test.cc b/tests/gtests/blenlib/BLI_stack_cpp_test.cc
similarity index 92%
rename from tests/gtests/blenlib/BLI_small_stack_test.cc
rename to tests/gtests/blenlib/BLI_stack_cpp_test.cc
index a50ed4a7af4..6de876f98d1 100644
--- a/tests/gtests/blenlib/BLI_small_stack_test.cc
+++ b/tests/gtests/blenlib/BLI_stack_cpp_test.cc
@@ -1,7 +1,7 @@
 #include "testing/testing.h"
-#include "BLI_small_stack.hpp"
+#include "BLI_stack.hpp"
 
-using IntStack = BLI::SmallStack<int>;
+using IntStack = BLI::Stack<int>;
 
 TEST(small_stack, DefaultConstructor)
 {
diff --git a/tests/gtests/blenlib/CMakeLists.txt b/tests/gtests/blenlib/CMakeLists.txt
index d6aa7d4feb1..21acf1083cc 100644
--- a/tests/gtests/blenlib/CMakeLists.txt
+++ b/tests/gtests/blenlib/CMakeLists.txt
@@ -67,7 +67,7 @@ BLENDER_TEST(BLI_shared "bf_blenlib")
 BLENDER_TEST(BLI_small_vector "bf_blenlib")
 BLENDER_TEST(BLI_set "bf_blenlib")
 BLENDER_TEST(BLI_set_vector "bf_blenlib")
-BLENDER_TEST(BLI_small_stack "bf_blenlib")
+BLENDER_TEST(BLI_stack_cpp "bf_blenlib")
 BLENDER_TEST(BLI_small_map "bf_blenlib")
 BLENDER_TEST(BLI_small_multimap "bf_blenlib")
 BLENDER_TEST(BLI_stack "bf_blenlib")



More information about the Bf-blender-cvs mailing list