0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / BRepMesh / BRepMesh_Edge.hxx
index 0eb80dd..c574123 100644 (file)
 #define _BRepMesh_Edge_HeaderFile
 
 #include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Macro.hxx>
 #include <BRepMesh_DegreeOfFreedom.hxx>
 #include <BRepMesh_OrientedEdge.hxx>
+#include <Standard_HashUtils.hxx>
 
 //! Light weighted structure representing link of the mesh.
 class BRepMesh_Edge : public BRepMesh_OrientedEdge
@@ -43,22 +42,22 @@ public:
   }
 
   //! Returns movability flag of the Link.
-  inline BRepMesh_DegreeOfFreedom Movability() const
+  BRepMesh_DegreeOfFreedom Movability() const
   {
     return myMovability;
   }
 
   //! Sets movability flag of the Link.
   //! @param theMovability flag to be set.
-  inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
+  void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
   {
     myMovability = theMovability;
   }
 
   //! Checks if the given edge and this one have the same orientation.
   //! @param theOther edge to be checked against this one.
-  //! \retrun TRUE if edges have the same orientation, FALSE if not.
-  inline Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
+  //! \return TRUE if edges have the same orientation, FALSE if not.
+  Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
   {
     return BRepMesh_OrientedEdge::IsEqual(theOther);
   }
@@ -66,7 +65,7 @@ public:
   //! Checks for equality with another edge.
   //! @param theOther edge to be checked against this one.
   //! @return TRUE if equal, FALSE if not.
-  inline Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
+  Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
   {
     if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
       return Standard_False;
@@ -86,10 +85,28 @@ private:
   BRepMesh_DegreeOfFreedom  myMovability;
 };
 
-inline Standard_Integer HashCode(const BRepMesh_Edge&   theEdge,
-                                 const Standard_Integer theUpper)
+namespace std
 {
-  return theEdge.HashCode(theUpper);
+  template <>
+  struct hash<BRepMesh_Edge>
+  {
+    size_t operator()(const BRepMesh_Edge& theEdge) const noexcept
+    {
+      union Combination
+      {
+        unsigned short Arr[2]; // Node can be represented as a short
+        uint32_t Hash;
+
+      } aCombination;
+      aCombination.Arr[0] = static_cast<unsigned short>(theEdge.FirstNode());
+      aCombination.Arr[1] = static_cast<unsigned short>(theEdge.LastNode());
+      if (aCombination.Arr[0] > aCombination.Arr[1])
+      {
+        std::swap(aCombination.Arr[0], aCombination.Arr[1]);
+      }
+      return static_cast<size_t>(aCombination.Hash);
+    }
+  };
 }
 
 #endif