Commit: 05365d1376760d70751243ae6360e2fd61f5a213
Author: Jacques Lucke
Date:   Wed Jul 8 17:04:09 2020 +0200
Branches: master
https://developer.blender.org/rB05365d1376760d70751243ae6360e2fd61f5a213

Functions: support hashing MFDataType and CPPType

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

M       source/blender/functions/FN_cpp_type.hh
M       source/blender/functions/FN_multi_function_data_type.hh

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

diff --git a/source/blender/functions/FN_cpp_type.hh 
b/source/blender/functions/FN_cpp_type.hh
index 686ecffb445..890530805d8 100644
--- a/source/blender/functions/FN_cpp_type.hh
+++ b/source/blender/functions/FN_cpp_type.hh
@@ -66,6 +66,7 @@
  *    pointers to virtual member functions.
  */
 
+#include "BLI_hash.hh"
 #include "BLI_index_mask.hh"
 #include "BLI_math_base.h"
 #include "BLI_string_ref.hh"
@@ -481,6 +482,11 @@ class CPPType {
     return default_value_;
   }
 
+  uint32_t hash() const
+  {
+    return DefaultHash<const CPPType *>{}(this);
+  }
+
   /**
    * Two types only compare equal when their pointer is equal. No two 
instances of CPPType for the
    * same C++ type should be created.
diff --git a/source/blender/functions/FN_multi_function_data_type.hh 
b/source/blender/functions/FN_multi_function_data_type.hh
index 78f0d96fb80..57aea046006 100644
--- a/source/blender/functions/FN_multi_function_data_type.hh
+++ b/source/blender/functions/FN_multi_function_data_type.hh
@@ -108,6 +108,11 @@ class MFDataType {
     BLI_assert(false);
     return "";
   }
+
+  uint hash() const
+  {
+    return DefaultHash<CPPType>{}(*type_) + (uint32_t)category_;
+  }
 };
 
 inline bool operator==(const MFDataType &a, const MFDataType &b)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to