[Bf-blender-cvs] [e60d04b129c] functions: rename RefCounted to RefCountedPtr

Jacques Lucke noreply at git.blender.org
Thu Mar 7 12:57:51 CET 2019


Commit: e60d04b129c2764f9f435323588fd32689f129bb
Author: Jacques Lucke
Date:   Thu Mar 7 11:22:50 2019 +0100
Branches: functions
https://developer.blender.org/rBe60d04b129c2764f9f435323588fd32689f129bb

rename RefCounted to RefCountedPtr

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

M	source/blender/blenlib/BLI_shared.hpp
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/functions/c_wrapper.cpp
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 0da53585046..168642c42ad 100644
--- a/source/blender/blenlib/BLI_shared.hpp
+++ b/source/blender/blenlib/BLI_shared.hpp
@@ -36,32 +36,32 @@ namespace BLI {
 	};
 
 	template<typename T>
-	class RefCounted : public RefCountedBase {
+	class RefCountedPtr : public RefCountedBase {
 	private:
-		T *m_object;
+		T *m_ptr;
 
-		~RefCounted()
+		~RefCountedPtr()
 		{
-			delete m_object;
+			delete m_ptr;
 		}
 
 	public:
-		RefCounted(T *object)
-			: RefCountedBase(), m_object(object) {}
+		RefCountedPtr(T *object)
+			: RefCountedBase(), m_ptr(object) {}
 
 		T *ptr() const
 		{
-			return m_object;
+			return m_ptr;
 		}
 	};
 
 	template<typename T>
 	class Shared {
 	private:
-		RefCounted<T> *m_refcounter;
+		RefCountedPtr<T> *m_refcounter;
 
 		Shared() = delete;
-		Shared(RefCounted<T> *object)
+		Shared(RefCountedPtr<T> *object)
 			: m_refcounter(object) {}
 
 		inline void incref()
@@ -84,7 +84,7 @@ namespace BLI {
 
 		static Shared<T> FromPointer(T *ptr)
 		{
-			RefCounted<T> *refcounter = new RefCounted<T>(ptr);
+			RefCountedPtr<T> *refcounter = new RefCountedPtr<T>(ptr);
 			return Shared<T>(refcounter);
 		}
 
@@ -133,7 +133,7 @@ namespace BLI {
 			return m_refcounter->ptr();
 		}
 
-		RefCounted<T> *refcounter() const
+		RefCountedPtr<T> *refcounter() const
 		{
 			return m_refcounter;
 		}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 20769f4752d..6c8ba6a7625 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1554,7 +1554,7 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
 			build_id(dtar->id);
 
 			if (dvar->type == DVAR_TYPE_FUNCTION) {
-				auto fn = (BLI::RefCounted<FN::Function> *)get_driver_variable_function(dvar);
+				auto fn = (BLI::RefCountedPtr<FN::Function> *)get_driver_variable_function(dvar);
 				if (fn != NULL) {
 					FN::Dependencies dependencies;
 					fn->ptr()->body<FN::DependenciesBody>()->dependencies(dependencies);
diff --git a/source/blender/functions/c_wrapper.cpp b/source/blender/functions/c_wrapper.cpp
index 9f0e0bac057..057904d050d 100644
--- a/source/blender/functions/c_wrapper.cpp
+++ b/source/blender/functions/c_wrapper.cpp
@@ -16,8 +16,8 @@ using namespace FN::DataFlowNodes;
 	inline T2 wrap(T1 value) { return (T2)value; }
 
 
-WRAPPERS(RefCounted<Function> *, FnFunction);
-WRAPPERS(RefCounted<Type> *, FnType);
+WRAPPERS(RefCountedPtr<Function> *, FnFunction);
+WRAPPERS(RefCountedPtr<Type> *, FnType);
 WRAPPERS(Tuple *, FnTuple);
 WRAPPERS(const TupleCallBody *, FnTupleCallBody);
 
@@ -179,7 +179,7 @@ void FN_type_free(FnType type)
 
 static FnType get_type_with_increased_refcount(const SharedType &type)
 {
-	RefCounted<Type> *typeref = type.refcounter();
+	RefCountedPtr<Type> *typeref = type.refcounter();
 	typeref->incref();
 	return wrap(typeref);
 }
@@ -203,7 +203,7 @@ FnFunction FN_tree_to_function(bNodeTree *btree)
 		return nullptr;
 	}
 
-	RefCounted<Function> *fn_ref = fn_.value().refcounter();
+	RefCountedPtr<Function> *fn_ref = fn_.value().refcounter();
 	fn_ref->incref();
 	return wrap(fn_ref);
 }
@@ -232,7 +232,7 @@ void FN_function_update_dependencies(
 	FnFunction fn,
 	struct DepsNodeHandle *deps_node)
 {
-	RefCounted<Function> *fn_ref = unwrap(fn);
+	RefCountedPtr<Function> *fn_ref = unwrap(fn);
 	const DependenciesBody *body = fn_ref->ptr()->body<DependenciesBody>();
 	if (body) {
 		Dependencies dependencies;
diff --git a/tests/gtests/blenlib/BLI_shared_test.cc b/tests/gtests/blenlib/BLI_shared_test.cc
index 29387c92f0f..a59f9439760 100644
--- a/tests/gtests/blenlib/BLI_shared_test.cc
+++ b/tests/gtests/blenlib/BLI_shared_test.cc
@@ -31,7 +31,7 @@ public:
 using namespace BLI;
 
 using SharedClass = Shared<MyTestClass>;
-using RefCountedClass = RefCounted<MyTestClass>;
+using RefCountedClass = RefCountedPtr<MyTestClass>;
 
 TEST(shared, OneReferenceAfterConstruction)
 {



More information about the Bf-blender-cvs mailing list