File indexing completed on 2026-08-08 09:29:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TUUID
0013 #define ROOT_TUUID
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #ifdef WIN32
0031 #undef GetCurrentTime
0032 #endif
0033 #include "Rtypes.h"
0034
0035
0036 class TBuffer;
0037 class TFile;
0038 class TDirectory;
0039 class TInetAddress;
0040 class TDatime;
0041
0042 class TUUID {
0043
0044 protected:
0045 UInt_t fUUIDIndex;
0046 UInt_t fTimeLow;
0047 UShort_t fTimeMid;
0048 UShort_t fTimeHiAndVersion;
0049 UChar_t fClockSeqHiAndReserved;
0050 UChar_t fClockSeqLow;
0051 UChar_t fNode[6];
0052
0053 struct uuid_time_t {
0054 UInt_t high;
0055 UInt_t low;
0056 };
0057
0058 Int_t CmpTime(uuid_time_t *t1, uuid_time_t *t2);
0059 void Format(UShort_t clockseq, uuid_time_t ts);
0060 void GetNodeIdentifier();
0061 void GetCurrentTime(uuid_time_t *timestamp);
0062 void GetSystemTime(uuid_time_t *timestamp);
0063 void GetRandomInfo(UChar_t seed[16]);
0064 void SetFromString(const char *uuid_str);
0065
0066 struct TV4Marker {};
0067 explicit TUUID(TV4Marker);
0068
0069 public:
0070 TUUID();
0071 TUUID(const char *uuid_str);
0072 virtual ~TUUID();
0073
0074 static TUUID UUIDv4();
0075
0076 const char *AsString() const;
0077 Int_t Compare(const TUUID &u) const;
0078 UShort_t Hash() const;
0079 void Print() const;
0080 TInetAddress GetHostAddress() const;
0081 TDatime GetTime() const;
0082 void GetUUID(UChar_t uuid[16]) const;
0083 void SetUUID(const char *uuid_str);
0084 UInt_t GetUUIDNumber() const { return fUUIDIndex; }
0085 void SetUUIDNumber(UInt_t index) { fUUIDIndex = index; }
0086
0087 void StreamerV1(TBuffer &b);
0088 void FillBuffer(char *&buffer);
0089 void ReadBuffer(char *&buffer);
0090 Int_t Sizeof() const { return 18; }
0091
0092 ClassDef(TUUID,1)
0093 };
0094
0095
0096 inline TBuffer &operator>>(TBuffer &buf, TUUID &uuid)
0097 { uuid.Streamer(buf); return buf; }
0098
0099
0100 TBuffer &operator<<(TBuffer &buf, const TUUID &uuid);
0101
0102 inline Bool_t operator==(const TUUID &u1, const TUUID &u2)
0103 { return (!u1.Compare(u2)) ? kTRUE : kFALSE; }
0104
0105 inline Bool_t operator!=(const TUUID &u1, const TUUID &u2)
0106 { return !(u1 == u2); }
0107
0108 inline Bool_t operator<(const TUUID &u1, const TUUID &u2)
0109 {
0110 return u1.Compare(u2) == -1;
0111 }
0112
0113 #endif