File indexing completed on 2026-09-28 09:19:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _BRepGraph_VersionStamp_HeaderFile
0015 #define _BRepGraph_VersionStamp_HeaderFile
0016
0017 #include <BRepGraph_ItemUID.hxx>
0018 #include <BRepGraph_RefUID.hxx>
0019 #include <BRepGraph_UID.hxx>
0020 #include <Standard_GUID.hxx>
0021
0022 #include <cstdint>
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 struct BRepGraph_VersionStamp
0039 {
0040
0041 enum class Domain : uint8_t
0042 {
0043 None = 0,
0044 Node = 1,
0045 Reference = 2
0046 };
0047
0048 BRepGraph_UID myNodeUID;
0049 BRepGraph_RefUID myRefUID;
0050 uint32_t myMutationGen;
0051 uint32_t myGeneration;
0052 Domain myDomain;
0053
0054
0055 BRepGraph_VersionStamp()
0056 : myMutationGen(0),
0057 myGeneration(0),
0058 myDomain(Domain::None)
0059 {
0060 }
0061
0062
0063
0064
0065
0066 BRepGraph_VersionStamp(const BRepGraph_UID& theUID,
0067 const uint32_t theMutationGen,
0068 const uint32_t theGeneration)
0069 : myNodeUID(theUID),
0070 myMutationGen(theMutationGen),
0071 myGeneration(theGeneration),
0072 myDomain(Domain::Node)
0073 {
0074 }
0075
0076
0077
0078
0079
0080 BRepGraph_VersionStamp(const BRepGraph_RefUID& theRefUID,
0081 const uint32_t theMutationGen,
0082 const uint32_t theGeneration)
0083 : myRefUID(theRefUID),
0084 myMutationGen(theMutationGen),
0085 myGeneration(theGeneration),
0086 myDomain(Domain::Reference)
0087 {
0088 }
0089
0090
0091 [[nodiscard]] bool IsValid() const
0092 {
0093 if (myDomain == Domain::Node)
0094 {
0095 return myNodeUID.IsValid();
0096 }
0097 if (myDomain == Domain::Reference)
0098 {
0099 return myRefUID.IsValid();
0100 }
0101 return myNodeUID.IsValid() || myRefUID.IsValid();
0102 }
0103
0104
0105 [[nodiscard]] bool IsNodeStamp() const
0106 {
0107 if (myDomain == Domain::Node)
0108 {
0109 return myNodeUID.IsValid();
0110 }
0111 return myDomain == Domain::None && myNodeUID.IsValid() && !myRefUID.IsValid();
0112 }
0113
0114
0115 [[nodiscard]] bool IsRefStamp() const
0116 {
0117 if (myDomain == Domain::Reference)
0118 {
0119 return myRefUID.IsValid();
0120 }
0121 return myDomain == Domain::None && myRefUID.IsValid() && !myNodeUID.IsValid();
0122 }
0123
0124
0125 [[nodiscard]] BRepGraph_ItemUID ItemUID() const
0126 {
0127 if (myDomain == Domain::Node)
0128 {
0129 return BRepGraph_ItemUID::Node(myNodeUID.Kind, myNodeUID.Counter);
0130 }
0131 if (myDomain == Domain::Reference)
0132 {
0133 return BRepGraph_ItemUID::Reference(myRefUID.Kind, myRefUID.Counter);
0134 }
0135 return BRepGraph_ItemUID();
0136 }
0137
0138
0139
0140 Standard_EXPORT bool operator==(const BRepGraph_VersionStamp& theOther) const;
0141
0142 bool operator!=(const BRepGraph_VersionStamp& theOther) const { return !(*this == theOther); }
0143
0144
0145
0146
0147
0148 [[nodiscard]] Standard_EXPORT bool IsSameItem(const BRepGraph_VersionStamp& theOther) const;
0149
0150
0151
0152
0153
0154
0155
0156 [[nodiscard]] Standard_EXPORT Standard_GUID ToGUID(const Standard_GUID& theGraphGUID) const;
0157
0158
0159
0160 [[nodiscard]] Standard_EXPORT size_t HashValue() const;
0161 };
0162
0163
0164 template <>
0165 struct std::hash<BRepGraph_VersionStamp>
0166 {
0167 size_t operator()(const BRepGraph_VersionStamp& theStamp) const noexcept
0168 {
0169 return theStamp.HashValue();
0170 }
0171 };
0172
0173 #endif