00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _DECAF_UTIL_UUID_H_
00019 #define _DECAF_UTIL_UUID_H_
00020
00021 #include <decaf/util/Config.h>
00022 #include <decaf/lang/Comparable.h>
00023 #include <string>
00024 #include <vector>
00025
00026 namespace decaf {
00027 namespace util {
00028
00029 class UUIDImpl;
00030
00066 class DECAF_API UUID : public lang::Comparable<UUID> {
00067 private:
00068
00069 UUIDImpl* uuid;
00070
00071 public:
00072
00080 static UUID randomUUID();
00081
00091 static UUID nameUUIDFromBytes(const std::vector<char>& name);
00092
00104 static UUID nameUUIDFromBytes(const char* name, int size);
00105
00117 static UUID fromString(const std::string& name);
00118
00119 public:
00120
00129 UUID(long long mostSigBits, long long leastSigBits);
00130
00137 UUID(const UUID& source);
00138
00147 UUID& operator= (const UUID& source);
00148
00149 virtual ~UUID();
00150
00155 virtual int compareTo(const UUID& value) const;
00156
00165 virtual bool equals(const UUID& value) const;
00166
00172 int hashCode() const;
00173
00179 virtual bool operator==(const UUID& value) const;
00180
00187 virtual bool operator<(const UUID& value) const;
00188
00211 std::string toString() const;
00212
00216 long long getLeastSignificantBits() const;
00217
00221 long long getMostSignificantBits() const;
00222
00238 long long node();
00239
00255 long long timestamp();
00256
00272 int clockSequence();
00273
00287 int variant();
00288
00302 int version();
00303
00304 };
00305
00306 }}
00307
00308 #endif