File indexing completed on 2025-01-18 10:04:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _Standard_GUID_HeaderFile
0018 #define _Standard_GUID_HeaderFile
0019
0020 #include <Standard_Handle.hxx>
0021
0022 #include <Standard_Integer.hxx>
0023 #include <Standard_CString.hxx>
0024 #include <Standard_UUID.hxx>
0025 #include <Standard_PCharacter.hxx>
0026 #include <Standard_PExtCharacter.hxx>
0027 #include <Standard_OStream.hxx>
0028
0029 #define Standard_GUID_SIZE 36
0030 #define Standard_GUID_SIZE_ALLOC Standard_GUID_SIZE+1
0031
0032 class Standard_GUID
0033 {
0034 public:
0035
0036 DEFINE_STANDARD_ALLOC
0037
0038
0039 Standard_EXPORT Standard_GUID();
0040
0041
0042
0043
0044
0045 Standard_EXPORT Standard_GUID(const Standard_CString aGuid);
0046
0047
0048
0049
0050
0051 Standard_EXPORT Standard_GUID(const Standard_ExtString aGuid);
0052
0053 Standard_EXPORT Standard_GUID(const Standard_Integer a32b, const Standard_ExtCharacter a16b1, const Standard_ExtCharacter a16b2, const Standard_ExtCharacter a16b3, const Standard_Byte a8b1, const Standard_Byte a8b2, const Standard_Byte a8b3, const Standard_Byte a8b4, const Standard_Byte a8b5, const Standard_Byte a8b6);
0054
0055 Standard_EXPORT Standard_GUID(const Standard_UUID& aGuid);
0056
0057 Standard_EXPORT Standard_GUID(const Standard_GUID& aGuid);
0058
0059 Standard_EXPORT Standard_UUID ToUUID() const;
0060
0061
0062
0063
0064
0065
0066 Standard_EXPORT void ToCString (const Standard_PCharacter aStrGuid) const;
0067
0068
0069
0070
0071
0072
0073 Standard_EXPORT void ToExtString (const Standard_PExtCharacter aStrGuid) const;
0074
0075 Standard_EXPORT Standard_Boolean IsSame (const Standard_GUID& uid) const;
0076 Standard_Boolean operator == (const Standard_GUID& uid) const
0077 {
0078 return IsSame(uid);
0079 }
0080
0081 Standard_EXPORT Standard_Boolean IsNotSame (const Standard_GUID& uid) const;
0082 Standard_Boolean operator != (const Standard_GUID& uid) const
0083 {
0084 return IsNotSame(uid);
0085 }
0086
0087 Standard_EXPORT void Assign (const Standard_GUID& uid);
0088 void operator = (const Standard_GUID& uid)
0089 {
0090 Assign(uid);
0091 }
0092
0093 Standard_EXPORT void Assign (const Standard_UUID& uid);
0094 void operator = (const Standard_UUID& uid)
0095 {
0096 Assign(uid);
0097 }
0098
0099
0100
0101
0102 Standard_EXPORT void ShallowDump (Standard_OStream& aStream) const;
0103
0104
0105
0106 Standard_EXPORT static Standard_Boolean CheckGUIDFormat (const Standard_CString aGuid);
0107
0108 template<class T>
0109 friend struct std::hash;
0110
0111 private:
0112
0113 Standard_Integer my32b;
0114 Standard_ExtCharacter my16b1;
0115 Standard_ExtCharacter my16b2;
0116 Standard_ExtCharacter my16b3;
0117 Standard_Byte my8b1;
0118 Standard_Byte my8b2;
0119 Standard_Byte my8b3;
0120 Standard_Byte my8b4;
0121 Standard_Byte my8b5;
0122 Standard_Byte my8b6;
0123 };
0124
0125
0126 namespace std
0127 {
0128 template <>
0129 struct hash<Standard_GUID>
0130 {
0131 size_t operator()(const Standard_GUID& theGUID) const noexcept
0132 {
0133 struct GUID
0134 {
0135 Standard_Integer my32b;
0136 Standard_ExtCharacter my16b1;
0137 Standard_ExtCharacter my16b2;
0138 Standard_ExtCharacter my16b3;
0139 Standard_Byte my8b1;
0140 Standard_Byte my8b2;
0141 Standard_Byte my8b3;
0142 Standard_Byte my8b4;
0143 Standard_Byte my8b5;
0144 Standard_Byte my8b6;
0145 };
0146 GUID aGUID{ theGUID.my32b, theGUID.my16b1,
0147 theGUID.my16b2, theGUID.my16b3,
0148 theGUID.my8b1, theGUID.my8b2,
0149 theGUID.my8b3, theGUID.my8b4,
0150 theGUID.my8b5, theGUID.my8b6 };
0151 return opencascade::hashBytes(&aGUID, sizeof(GUID));
0152 }
0153 };
0154 }
0155
0156
0157
0158
0159 #endif