File indexing completed on 2025-01-18 10:03:14
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
0026 DEFINE_STANDARD_ALLOC
0027
0028
0029 BRepMesh_OrientedEdge()
0030 : myFirstNode(-1),
0031 myLastNode(-1)
0032 {
0033 }
0034
0035
0036 BRepMesh_OrientedEdge(
0037 const Standard_Integer theFirstNode,
0038 const Standard_Integer theLastNode)
0039 : myFirstNode(theFirstNode),
0040 myLastNode(theLastNode)
0041 {
0042 }
0043
0044
0045 Standard_Integer FirstNode() const
0046 {
0047 return myFirstNode;
0048 }
0049
0050
0051 Standard_Integer LastNode() const
0052 {
0053 return myLastNode;
0054 }
0055
0056
0057
0058
0059 Standard_Boolean IsEqual(const BRepMesh_OrientedEdge& theOther) const
0060 {
0061 return (myFirstNode == theOther.myFirstNode && myLastNode == theOther.myLastNode);
0062 }
0063
0064
0065 Standard_Boolean operator ==(const BRepMesh_OrientedEdge& Other) const
0066 {
0067 return IsEqual(Other);
0068 }
0069
0070 private:
0071
0072 Standard_Integer myFirstNode;
0073 Standard_Integer myLastNode;
0074 };
0075
0076 namespace std
0077 {
0078 template <>
0079 struct hash<BRepMesh_OrientedEdge>
0080 {
0081 size_t operator()(const BRepMesh_OrientedEdge& theOrientedEdge) const noexcept
0082 {
0083 union Combination
0084 {
0085 unsigned short Arr[2];
0086 uint32_t Hash;
0087
0088 } aCombination;
0089 aCombination.Arr[0] = static_cast<unsigned short>(theOrientedEdge.FirstNode());
0090 aCombination.Arr[1] = static_cast<unsigned short>(theOrientedEdge.LastNode());
0091 return static_cast<size_t>(aCombination.Hash);
0092 }
0093 };
0094 }
0095
0096 #endif