Depsgraph: Move class implementation from header to implementation files
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 3 Nov 2016 15:03:12 +0000 (16:03 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 7 Nov 2016 10:04:49 +0000 (11:04 +0100)
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.

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

index 16f1243b4335f8310bbee165198b977c075183bf..62062314b88d48ac6af5865e25bbcbf9006c2a90 100644 (file)
@@ -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 =
index 67b2e13d5f63dcd0ce8d46954a622444f14e2a2d..810c6eeb420c12511cb9006c216934e3ea05ccc4 100644 (file)
@@ -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;
index 9e7357be2b22424e6c1826d4d2dc33cf9ecbf047..9d2c6169e23294473df50b1c0318c919aea1e0e8 100644 (file)
@@ -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 =
index ec2674a7b1357ecb4d61e4c12536ff02a3badf62..969771a29c9371aa2198983d1f87a9abb0f8634c 100644 (file)
@@ -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 */