[Bf-blender-cvs] [468f4f79853] functions: Rename "Shared" to "AutoRefCount"

Jacques Lucke noreply at git.blender.org
Fri Mar 8 15:15:26 CET 2019


Commit: 468f4f79853728ad93f416b52138b973d071eaf5
Author: Jacques Lucke
Date:   Fri Mar 8 14:09:29 2019 +0100
Branches: functions
https://developer.blender.org/rB468f4f79853728ad93f416b52138b973d071eaf5

Rename "Shared" to "AutoRefCount"

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

M	source/blender/blenlib/BLI_shared.hpp
M	source/blender/blenlib/BLI_shared_immutable.hpp
M	source/blender/functions/backends/tuple_call/tuple.hpp
M	source/blender/functions/core/data_flow_graph.hpp
M	source/blender/functions/core/function.hpp
M	source/blender/functions/core/type.hpp
M	source/blender/functions/types/lists.hpp
M	tests/gtests/blenlib/BLI_shared_test.cc

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

diff --git a/source/blender/blenlib/BLI_shared.hpp b/source/blender/blenlib/BLI_shared.hpp
index f9e9aa64f53..059fe77d7f3 100644
--- a/source/blender/blenlib/BLI_shared.hpp
+++ b/source/blender/blenlib/BLI_shared.hpp
@@ -38,12 +38,12 @@ namespace BLI {
 	};
 
 	template<typename T>
-	class Shared {
+	class AutoRefCount {
 	private:
 		T *m_object;
 
-		Shared() = delete;
-		Shared(T *object)
+		AutoRefCount() = delete;
+		AutoRefCount(T *object)
 			: m_object(object) {}
 
 		inline void incref()
@@ -58,30 +58,30 @@ namespace BLI {
 
 	public:
 		template<typename ...Args>
-		static Shared<T> New(Args&&... args)
+		static AutoRefCount<T> New(Args&&... args)
 		{
 			T *object = new T(std::forward<Args>(args)...);
-			return Shared<T>(object);
+			return AutoRefCount<T>(object);
 		}
 
-		static Shared<T> FromPointer(T *object)
+		static AutoRefCount<T> FromPointer(T *object)
 		{
-			return Shared<T>(object);
+			return AutoRefCount<T>(object);
 		}
 
-		Shared(const Shared &other)
+		AutoRefCount(const AutoRefCount &other)
 		{
 			m_object = other.m_object;
 			this->incref();
 		}
 
-		Shared(Shared &&other)
+		AutoRefCount(AutoRefCount &&other)
 		{
 			m_object = other.m_object;
 			other.m_object = nullptr;
 		}
 
-		~Shared()
+		~AutoRefCount()
 		{
 			/* Can be nullptr when previously moved. */
 			if (m_object != nullptr) {
@@ -89,7 +89,7 @@ namespace BLI {
 			}
 		}
 
-		Shared &operator=(const Shared &other)
+		AutoRefCount &operator=(const AutoRefCount &other)
 		{
 			if (m_object == other.m_object) {
 				return *this;
@@ -101,7 +101,7 @@ namespace BLI {
 			return *this;
 		}
 
-		Shared &operator=(Shared &&other)
+		AutoRefCount &operator=(AutoRefCount &&other)
 		{
 			this->decref();
 			m_object = other.m_object;
@@ -119,12 +119,12 @@ namespace BLI {
 			return this->ptr();
 		}
 
-		friend bool operator==(const Shared &a, const Shared &b)
+		friend bool operator==(const AutoRefCount &a, const AutoRefCount &b)
 		{
 			return a.m_object == b.m_object;
 		}
 
-		friend bool operator!=(const Shared &a, const Shared &b)
+		friend bool operator!=(const AutoRefCount &a, const AutoRefCount &b)
 		{
 			return !(a == b);
 		}
diff --git a/source/blender/blenlib/BLI_shared_immutable.hpp b/source/blender/blenlib/BLI_shared_immutable.hpp
index 10246e6cf20..ed7e3947d33 100644
--- a/source/blender/blenlib/BLI_shared_immutable.hpp
+++ b/source/blender/blenlib/BLI_shared_immutable.hpp
@@ -8,7 +8,7 @@ namespace BLI {
 	private:
 		SharedImmutable(SharedImmutable &other) = delete;
 
-		template<typename> friend class Shared;
+		template<typename> friend class AutoRefCount;
 
 	public:
 		SharedImmutable()
diff --git a/source/blender/functions/backends/tuple_call/tuple.hpp b/source/blender/functions/backends/tuple_call/tuple.hpp
index 28f17191b4b..44d1d0b71de 100644
--- a/source/blender/functions/backends/tuple_call/tuple.hpp
+++ b/source/blender/functions/backends/tuple_call/tuple.hpp
@@ -56,7 +56,7 @@ namespace FN {
 		}
 	};
 
-	using SharedTupleMeta = Shared<TupleMeta>;
+	using SharedTupleMeta = AutoRefCount<TupleMeta>;
 
 	class Tuple {
 	public:
diff --git a/source/blender/functions/core/data_flow_graph.hpp b/source/blender/functions/core/data_flow_graph.hpp
index 8d7a0fb72f5..a49cf52c770 100644
--- a/source/blender/functions/core/data_flow_graph.hpp
+++ b/source/blender/functions/core/data_flow_graph.hpp
@@ -272,7 +272,7 @@ namespace FN {
 		friend Socket;
 	};
 
-	using SharedDataFlowGraph = Shared<DataFlowGraph>;
+	using SharedDataFlowGraph = AutoRefCount<DataFlowGraph>;
 
 	class FunctionGraph {
 	public:
diff --git a/source/blender/functions/core/function.hpp b/source/blender/functions/core/function.hpp
index dda39182143..7f0f9cf6544 100644
--- a/source/blender/functions/core/function.hpp
+++ b/source/blender/functions/core/function.hpp
@@ -84,6 +84,6 @@ namespace FN {
 		Composition m_bodies;
 	};
 
-	using SharedFunction = Shared<Function>;
+	using SharedFunction = AutoRefCount<Function>;
 
 } /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/type.hpp b/source/blender/functions/core/type.hpp
index ca9c04c72de..89229dd8d1a 100644
--- a/source/blender/functions/core/type.hpp
+++ b/source/blender/functions/core/type.hpp
@@ -37,7 +37,7 @@ namespace FN {
 		Composition m_extensions;
 	};
 
-	using SharedType = Shared<Type>;
+	using SharedType = AutoRefCount<Type>;
 	using SmallTypeVector = SmallVector<SharedType>;
 
 } /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/types/lists.hpp b/source/blender/functions/types/lists.hpp
index 38925ea2683..451bcf18733 100644
--- a/source/blender/functions/types/lists.hpp
+++ b/source/blender/functions/types/lists.hpp
@@ -74,6 +74,6 @@ namespace FN { namespace Types {
 	};
 
 	template<typename T>
-	using SharedList = Shared<List<T>>;
+	using SharedList = AutoRefCount<List<T>>;
 
 } } /* namespace FN::Types */
\ No newline at end of file
diff --git a/tests/gtests/blenlib/BLI_shared_test.cc b/tests/gtests/blenlib/BLI_shared_test.cc
index 282b5475ebd..c525421d665 100644
--- a/tests/gtests/blenlib/BLI_shared_test.cc
+++ b/tests/gtests/blenlib/BLI_shared_test.cc
@@ -30,7 +30,7 @@ public:
 
 using namespace BLI;
 
-using SharedClass = Shared<MyTestClass>;
+using SharedClass = AutoRefCount<MyTestClass>;
 
 TEST(shared, OneReferenceAfterConstruction)
 {



More information about the Bf-blender-cvs mailing list