[Bf-blender-cvs] [1a282bdca10] functions: Signature.has_interface

Jacques Lucke noreply at git.blender.org
Mon Feb 18 18:19:19 CET 2019


Commit: 1a282bdca1053709605878800821a16952320636
Author: Jacques Lucke
Date:   Mon Feb 18 17:21:09 2019 +0100
Branches: functions
https://developer.blender.org/rB1a282bdca1053709605878800821a16952320636

Signature.has_interface

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

M	source/blender/functions/CMakeLists.txt
A	source/blender/functions/core/core.cpp
M	source/blender/functions/core/core.hpp

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

diff --git a/source/blender/functions/CMakeLists.txt b/source/blender/functions/CMakeLists.txt
index e8955e3f77f..193678a00ef 100644
--- a/source/blender/functions/CMakeLists.txt
+++ b/source/blender/functions/CMakeLists.txt
@@ -15,6 +15,7 @@ set(SRC
 	c_wrapper.cpp
 
 	core/core.hpp
+	core/core.cpp
 	core/cpu.hpp
 	core/cpu.cpp
 	core/data_flow_graph.hpp
diff --git a/source/blender/functions/core/core.cpp b/source/blender/functions/core/core.cpp
new file mode 100644
index 00000000000..5d86cfa1aed
--- /dev/null
+++ b/source/blender/functions/core/core.cpp
@@ -0,0 +1,32 @@
+#include "core.hpp"
+
+namespace FN {
+
+	SmallTypeVector Signature::input_types() const
+	{
+		SmallTypeVector types;
+		for (const InputParameter &param : this->inputs()) {
+			types.append(param.type());
+		}
+		return types;
+	}
+
+	SmallTypeVector Signature::output_types() const
+	{
+		SmallTypeVector types;
+		for (const OutputParameter &param : this->outputs()) {
+			types.append(param.type());
+		}
+		return types;
+	}
+
+	bool Signature::has_interface(
+		const SmallTypeVector &inputs,
+		const SmallTypeVector &outputs) const
+	{
+		return (true
+			&& SmallTypeVector::all_equal(this->input_types(), inputs)
+			&& SmallTypeVector::all_equal(this->output_types(), outputs));
+	}
+
+} /* namespace FN */
\ No newline at end of file
diff --git a/source/blender/functions/core/core.hpp b/source/blender/functions/core/core.hpp
index 4c44f8d9694..0c8cde14605 100644
--- a/source/blender/functions/core/core.hpp
+++ b/source/blender/functions/core/core.hpp
@@ -102,23 +102,12 @@ namespace FN {
 			return m_outputs;
 		}
 
-		SmallTypeVector input_types() const
-		{
-			SmallTypeVector types;
-			for (const InputParameter &param : this->inputs()) {
-				types.append(param.type());
-			}
-			return types;
-		}
+		SmallTypeVector input_types() const;
+		SmallTypeVector output_types() const;
 
-		SmallTypeVector output_types() const
-		{
-			SmallTypeVector types;
-			for (const OutputParameter &param : this->outputs()) {
-				types.append(param.type());
-			}
-			return types;
-		}
+		bool has_interface(
+			const SmallTypeVector &inputs,
+			const SmallTypeVector &outputs) const;
 
 	private:
 		const InputParameters m_inputs;



More information about the Bf-blender-cvs mailing list