From 5620a09e0d5e929271c4faa2a763b647758072d8 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 9 Jun 2020 12:08:32 +0200 Subject: Cleanup: move hashing of OperationIDKey to member function --- .../depsgraph/intern/node/deg_node_component.cc | 11 +++++++++++ .../blender/depsgraph/intern/node/deg_node_component.h | 18 +----------------- 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'source/blender/depsgraph') diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc index f4d042fecf9..e75b5a96480 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.cc +++ b/source/blender/depsgraph/intern/node/deg_node_component.cc @@ -26,6 +26,8 @@ #include /* required for STREQ later on. */ #include +#include "BLI_ghash.h" +#include "BLI_hash.hh" #include "BLI_utildefines.h" #include "DNA_object_types.h" @@ -69,6 +71,15 @@ bool ComponentNode::OperationIDKey::operator==(const OperationIDKey &other) cons return (opcode == other.opcode) && (STREQ(name, other.name)) && (name_tag == other.name_tag); } +uint32_t ComponentNode::OperationIDKey::hash() const +{ + const int opcode_as_int = static_cast(opcode); + return BLI_ghashutil_combine_hash( + name_tag, + BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(opcode_as_int), + BLI_ghashutil_strhash_p(name))); +} + ComponentNode::ComponentNode() : entry_operation(nullptr), exit_operation(nullptr), affects_directly_visible(false) { diff --git a/source/blender/depsgraph/intern/node/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h index 2d13300d69f..727551127a5 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.h +++ b/source/blender/depsgraph/intern/node/deg_node_component.h @@ -26,8 +26,6 @@ #include "intern/node/deg_node.h" #include "intern/node/deg_node_operation.h" -#include "BLI_ghash.h" -#include "BLI_hash.hh" #include "BLI_string.h" #include "BLI_utildefines.h" @@ -55,6 +53,7 @@ struct ComponentNode : public Node { string identifier() const; bool operator==(const OperationIDKey &other) const; + uint32_t hash() const; }; /* Typedef for container of operations */ @@ -205,18 +204,3 @@ struct BoneComponentNode : public ComponentNode { void deg_register_component_depsnodes(); } // namespace DEG - -namespace blender { - -template<> struct DefaultHash { - uint32_t operator()(const DEG::ComponentNode::OperationIDKey &key) const - { - const int opcode_as_int = static_cast(key.opcode); - return BLI_ghashutil_combine_hash( - key.name_tag, - BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(opcode_as_int), - BLI_ghashutil_strhash_p(key.name))); - } -}; - -} // namespace blender -- cgit v1.2.3