Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef UID_INCLUDE_ONCE
00033 #define UID_INCLUDE_ONCE
00034
00035 #include <vlCore/checks.hpp>
00036 #include <string>
00037 #include <string.h>
00038
00039 namespace vl
00040 {
00041 class Random;
00042
00044 class VLCORE_EXPORT UUID
00045 {
00046 public:
00048 UUID();
00049
00051 void generateVersion4(const Random& random);
00052
00054 bool fromString(const char* guid_str);
00055
00059 void fillString(char* guid_str, bool zero_terminate = true) const;
00060
00062 void toStdString(std::string& guid_str) const;
00063
00065 std::string toStdString() const;
00066
00067 bool operator==(const UUID& other) const
00068 {
00069 return memcmp(this, &other, sizeof(*this)) == 0;
00070 }
00071
00072 bool operator!=(const UUID& other) const
00073 {
00074 return memcmp(this, &other, sizeof(*this)) != 0;
00075 }
00076
00077 bool operator<(const UUID& other) const
00078 {
00079 return memcmp(this, &other, sizeof(*this)) < 0;
00080 }
00081
00082 public:
00083 unsigned int mTimeLow;
00084 unsigned short mTimeMid;
00085 unsigned short mTimeHiAndVersion;
00086 unsigned char mClockSeqHiAndReserved;
00087 unsigned char mClockSeqLow;
00088 unsigned char mNode[6];
00089 };
00090
00091 VL_COMPILE_TIME_CHECK(sizeof(UUID) == 16)
00092
00093 }
00094
00095
00096
00097 #endif