Salome HOME
added smIdHasher for SMESH module
authorViktor UZLOV <vuzlov@debian10-01.nnov.opencascade.com>
Wed, 10 Feb 2021 14:01:33 +0000 (17:01 +0300)
committerViktor UZLOV <vuzlov@debian10-01.nnov.opencascade.com>
Tue, 16 Feb 2021 11:36:50 +0000 (14:36 +0300)
src/Basics/smIdType.hxx.in

index 75315a5da8e9cf19b453a0454e1dca00bd4b6290..28b184a3705480b1170d6023cc5f2fc375fe83d2 100644 (file)
@@ -26,6 +26,8 @@
 #cmakedefine SALOME_USE_64BIT_IDS
 
 #include <cinttypes>
+#include <limits>
+#include <NCollection_DataMap.hxx>
 
 #ifndef SALOME_USE_64BIT_IDS
 typedef std::int32_t smIdType;
@@ -33,6 +35,19 @@ typedef std::int32_t smIdType;
 typedef std::int64_t smIdType;
 #endif
 
+struct smIdHasher
+{
+  static Standard_Integer HashCode(const smIdType theValue,  const Standard_Integer theUpperBound)
+  {
+    return IntegerHashCode(static_cast<Standard_Integer> (theValue), std::numeric_limits<smIdType>::max(), theUpperBound);
+  }
+
+  static Standard_Boolean IsEqual( const smIdType& id1, const smIdType& id2 )
+  {
+    return id1 == id2;
+  }
+};
+
 template <class T> inline smIdType ToIdType(T val)
 {
   return static_cast<smIdType>(val);