File indexing completed on 2026-09-17 09:19:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef _BOPDS_Pair_HeaderFile
0016 #define _BOPDS_Pair_HeaderFile
0017
0018 #include <Standard.hxx>
0019 #include <Standard_DefineAlloc.hxx>
0020 #include <Standard_HashUtils.hxx>
0021
0022
0023
0024 class BOPDS_Pair
0025 {
0026 public:
0027 DEFINE_STANDARD_ALLOC
0028
0029 BOPDS_Pair()
0030 : myIndex1(-1),
0031 myIndex2(-1)
0032 {
0033 }
0034
0035
0036 BOPDS_Pair(const int theIndex1, const int theIndex2)
0037 : myIndex1(theIndex1),
0038 myIndex2(theIndex2)
0039 {
0040 }
0041
0042 ~BOPDS_Pair() = default;
0043
0044
0045
0046 void SetIndices(const int theIndex1, const int theIndex2)
0047 {
0048 myIndex1 = theIndex1;
0049 myIndex2 = theIndex2;
0050 }
0051
0052
0053
0054 void Indices(int& theIndex1, int& theIndex2) const
0055 {
0056 theIndex1 = myIndex1;
0057 theIndex2 = myIndex2;
0058 }
0059
0060
0061
0062 bool operator<(const BOPDS_Pair& theOther) const
0063 {
0064 return ((myIndex1 != theOther.myIndex1) ? (myIndex1 < theOther.myIndex1)
0065 : (myIndex2 < theOther.myIndex2));
0066 }
0067
0068
0069
0070 bool IsEqual(const BOPDS_Pair& theOther) const
0071 {
0072 return (myIndex1 == theOther.myIndex1 && myIndex2 == theOther.myIndex2)
0073 || (myIndex1 == theOther.myIndex2 && myIndex2 == theOther.myIndex1);
0074 }
0075
0076 bool operator==(const BOPDS_Pair& theOther) const { return IsEqual(theOther); }
0077
0078 protected:
0079 int myIndex1;
0080 int myIndex2;
0081 };
0082
0083 namespace std
0084 {
0085 template <>
0086 struct hash<BOPDS_Pair>
0087 {
0088 size_t operator()(const BOPDS_Pair& thePair) const noexcept
0089 {
0090
0091 int aCombination[2];
0092 thePair.Indices(aCombination[0], aCombination[1]);
0093 if (aCombination[0] > aCombination[1])
0094 {
0095 std::swap(aCombination[0], aCombination[1]);
0096 }
0097 return opencascade::hashBytes(aCombination, sizeof(aCombination));
0098 }
0099 };
0100 }
0101
0102 #endif