[Bf-blender-cvs] [109be7e] master: Depsgraph: Move class implementation from header to implementation files

Sergey Sharybin noreply at git.blender.org
Mon Nov 7 11:44:08 CET 2016


Commit: 109be7ed397f7ee537b4dbc346d4af95e5c1f7ab
Author: Sergey Sharybin
Date:   Thu Nov 3 16:03:12 2016 +0100
Branches: master
https://developer.blender.org/rB109be7ed397f7ee537b4dbc346d4af95e5c1f7ab

Depsgraph: Move class implementation from header to implementation files

This is more proper way to go:

- Avoids re-compilation of all dependent files when implementation changes
  without changed API,

- Linker should have much simpler time now de-duplicating and getting rid
  of redundant implementations.

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

M	source/blender/depsgraph/intern/nodes/deg_node.cc
M	source/blender/depsgraph/intern/nodes/deg_node.h
M	source/blender/depsgraph/intern/nodes/deg_node_component.cc
M	source/blender/depsgraph/intern/nodes/deg_node_component.h

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

diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc
index 16f1243..6206231 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node.cc
@@ -141,6 +141,18 @@ static DepsNodeFactoryImpl<TimeSourceDepsNode> DNTI_TIMESOURCE;
 
 /* ID Node ================================================ */
 
+IDDepsNode::ComponentIDKey::ComponentIDKey(eDepsNode_Type type,
+                                           const char *name)
+        : type(type), name(name)
+{
+}
+
+bool IDDepsNode::ComponentIDKey::operator== (const ComponentIDKey &other) const
+{
+    return type == other.type &&
+           STREQ(name, other.name);
+}
+
 static unsigned int id_deps_node_hash_key(const void *key_v)
 {
 	const IDDepsNode::ComponentIDKey *key =
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.h b/source/blender/depsgraph/intern/nodes/deg_node.h
index 67b2e13..810c6ee 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node.h
@@ -145,14 +145,8 @@ struct RootDepsNode : public DepsNode {
 /* ID-Block Reference */
 struct IDDepsNode : public DepsNode {
 	struct ComponentIDKey {
-		ComponentIDKey(eDepsNode_Type type, const char *name = "")
-		    : type(type), name(name) {}
-
-		bool operator== (const ComponentIDKey &other) const
-		{
-			return type == other.type &&
-			       STREQ(name, other.name);
-		}
+		ComponentIDKey(eDepsNode_Type type, const char *name = "");
+		bool operator==(const ComponentIDKey &other) const;
 
 		eDepsNode_Type type;
 		const char *name;
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
index 9e7357b..9d2c616 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
@@ -52,6 +52,44 @@ namespace DEG {
 
 /* Standard Component Methods ============================= */
 
+ComponentDepsNode::OperationIDKey::OperationIDKey()
+        : opcode(DEG_OPCODE_OPERATION),
+          name(""),
+          name_tag(-1)
+{
+}
+
+ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode)
+        : opcode(opcode),
+          name(""),
+          name_tag(-1)
+{
+}
+
+ComponentDepsNode::OperationIDKey::OperationIDKey(eDepsOperation_Code opcode,
+                                                 const char *name,
+                                                 int name_tag)
+        : opcode(opcode),
+          name(name),
+          name_tag(name_tag)
+{
+}
+
+string ComponentDepsNode::OperationIDKey::identifier() const
+{
+	char codebuf[5];
+	BLI_snprintf(codebuf, sizeof(codebuf), "%d", opcode);
+	return string("OperationIDKey(") + codebuf + ", " + name + ")";
+}
+
+bool ComponentDepsNode::OperationIDKey::operator==(
+        const OperationIDKey &other) const
+{
+	return (opcode == other.opcode) &&
+		(STREQ(name, other.name)) &&
+		(name_tag == other.name_tag);
+}
+
 static unsigned int comp_node_hash_key(const void *key_v)
 {
 	const ComponentDepsNode::OperationIDKey *key =
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h
index ec2674a..969771a 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h
@@ -56,38 +56,14 @@ struct ComponentDepsNode : public DepsNode {
 		const char *name;
 		int name_tag;
 
-		OperationIDKey()
-		        : opcode(DEG_OPCODE_OPERATION),
-		          name(""),
-		          name_tag(-1)
-		{}
-		OperationIDKey(eDepsOperation_Code opcode)
-		        : opcode(opcode),
-		          name(""),
-		          name_tag(-1)
-		{}
+		OperationIDKey();
+		OperationIDKey(eDepsOperation_Code opcode);
 		OperationIDKey(eDepsOperation_Code opcode,
 		               const char *name,
-		               int name_tag)
-		       : opcode(opcode),
-		         name(name),
-		         name_tag(name_tag)
-		{}
-
-		string identifier() const
-		{
-			char codebuf[5];
-			BLI_snprintf(codebuf, sizeof(codebuf), "%d", opcode);
-
-			return string("OperationIDKey(") + codebuf + ", " + name + ")";
-		}
-
-		bool operator==(const OperationIDKey &other) const
-		{
-			return (opcode == other.opcode) &&
-			       (STREQ(name, other.name)) &&
-			       (name_tag == other.name_tag);
-		}
+		               int name_tag);
+
+		string identifier() const;
+		bool operator==(const OperationIDKey &other) const;
 	};
 
 	/* Typedef for container of operations */




More information about the Bf-blender-cvs mailing list