File indexing completed on 2026-08-21 09:15:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _BRepMesh_OrientedEdge_HeaderFile
0015 #define _BRepMesh_OrientedEdge_HeaderFile
0016
0017 #include <Standard.hxx>
0018 #include <Standard_HashUtils.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020
0021
0022 class BRepMesh_OrientedEdge
0023 {
0024 public:
0025 DEFINE_STANDARD_ALLOC
0026
0027
0028 BRepMesh_OrientedEdge()
0029 : myFirstNode(-1),
0030 myLastNode(-1)
0031 {
0032 }
0033
0034
0035 BRepMesh_OrientedEdge(const Standard_Integer theFirstNode, const Standard_Integer theLastNode)
0036 : myFirstNode(theFirstNode),
0037 myLastNode(theLastNode)
0038 {
0039 }
0040
0041
0042 Standard_Integer FirstNode() const { return myFirstNode; }
0043
0044
0045 Standard_Integer LastNode() const { return myLastNode; }
0046
0047
0048
0049
0050 Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const
0051 {
0052 return (myFirstNode == theOther.myFirstNode && myLastNode == theOther.myLastNode);
0053 }
0054
0055
0056 Standard_Boolean operator==(const BRepMesh_OrientedEdge& Other) const { return IsEqual(Other); }
0057
0058 private:
0059 Standard_Integer myFirstNode;
0060 Standard_Integer myLastNode;
0061 };
0062
0063 namespace std
0064 {
0065 template <>
0066 struct hash<BRepMesh_OrientedEdge>
0067 {
0068 size_t operator()(const BRepMesh_OrientedEdge& theOrientedEdge) const noexcept
0069 {
0070 union Combination {
0071 unsigned short Arr[2];
0072 uint32_t Hash;
0073
0074 } aCombination;
0075
0076 aCombination.Arr[0] = static_cast<unsigned short>(theOrientedEdge.FirstNode());
0077 aCombination.Arr[1] = static_cast<unsigned short>(theOrientedEdge.LastNode());
0078 return static_cast<size_t>(aCombination.Hash);
0079 }
0080 };
0081 }
0082
0083 #endif