[Bf-blender-cvs] [25e1a10de6f] functions: type extension base class

Jacques Lucke noreply at git.blender.org
Fri Mar 29 15:57:31 CET 2019


Commit: 25e1a10de6fa76ae8214ed77775c315c5b89d60f
Author: Jacques Lucke
Date:   Fri Mar 29 15:57:24 2019 +0100
Branches: functions
https://developer.blender.org/rB25e1a10de6fa76ae8214ed77775c315c5b89d60f

type extension base class

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

M	source/blender/functions/backends/llvm/llvm_types.hpp
M	source/blender/functions/backends/tuple_call/cpp_types.hpp
M	source/blender/functions/core/type.hpp

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

diff --git a/source/blender/functions/backends/llvm/llvm_types.hpp b/source/blender/functions/backends/llvm/llvm_types.hpp
index 0b1121a3b50..3298d354461 100644
--- a/source/blender/functions/backends/llvm/llvm_types.hpp
+++ b/source/blender/functions/backends/llvm/llvm_types.hpp
@@ -9,7 +9,7 @@
 
 namespace FN {
 
-	class LLVMTypeInfo {
+	class LLVMTypeInfo : public TypeExtension {
 	public:
 		BLI_COMPOSITION_DECLARATION(LLVMTypeInfo);
 
diff --git a/source/blender/functions/backends/tuple_call/cpp_types.hpp b/source/blender/functions/backends/tuple_call/cpp_types.hpp
index 8c91acc4ee8..5255c4a2678 100644
--- a/source/blender/functions/backends/tuple_call/cpp_types.hpp
+++ b/source/blender/functions/backends/tuple_call/cpp_types.hpp
@@ -4,7 +4,7 @@
 
 namespace FN {
 
-	class CPPTypeInfo {
+	class CPPTypeInfo : public TypeExtension {
 	public:
 		BLI_COMPOSITION_DECLARATION(CPPTypeInfo);
 
diff --git a/source/blender/functions/core/type.hpp b/source/blender/functions/core/type.hpp
index 89229dd8d1a..1521fe41779 100644
--- a/source/blender/functions/core/type.hpp
+++ b/source/blender/functions/core/type.hpp
@@ -8,6 +8,10 @@ namespace FN {
 
 	using namespace BLI;
 
+	class TypeExtension {
+
+	};
+
 	class Type final : public RefCountedBase {
 	public:
 		Type() = delete;
@@ -29,6 +33,7 @@ namespace FN {
 		void extend(T *extension)
 		{
 			BLI_assert(m_extensions.get<T>() == nullptr);
+			static_assert(std::is_base_of<TypeExtension, T>::value, "");
 			m_extensions.add(extension);
 		}



More information about the Bf-blender-cvs mailing list