00001 //---------------------------------------------------------------------------- 00004 // 00005 // (C) 2003-2006 Celartem Technology Inc. All rights reserved. 00006 //---------------------------------------------------------------------------- 00007 00008 #ifndef _cel_guid_h_ 00009 #define _cel_guid_h_ 00010 00011 #include "cel_types.h" 00012 #include "cel_datatraits.h" 00013 #include "cel_string.h" 00014 00015 namespace Celartem 00016 { 00017 class Stream; 00018 00022 typedef u8 guid_t[16]; 00023 00027 struct Guid 00028 { 00032 guid_t guid; 00033 00040 Guid(bool inGenerateNewGuid = false); 00041 00049 Guid(const char *inString); 00050 00058 Guid(const String& inString); 00059 00065 Guid(const Guid& inGuid); 00066 00074 Guid& operator=(const char * inString); 00075 00083 Guid& operator=(const String& inString); 00084 00090 Guid& operator=(const Guid& inGuid); 00091 00099 bool operator==(const Guid& inGuid) const; 00100 00108 bool operator!=(const Guid& inGuid) const; 00109 00118 bool operator<(const Guid& inGuid) const; 00119 00128 bool operator>(const Guid& inGuid) const; 00129 00138 bool operator<=(const Guid& inGuid) const; 00139 00148 bool operator>=(const Guid& inGuid) const; 00149 00155 bool isValid() const; 00156 00163 String toString() const; 00164 00172 void fromString(const char *inString); 00173 00181 void fromString(const String& inString); 00182 00186 void generateNew(); 00187 00191 void zeroClear(); 00192 00198 void duplicate(const Guid& inGuid); 00199 00205 static const Guid& getNullGuid(); 00206 00213 void serialize( 00214 Stream *inStream, 00215 size_t inLevel, 00216 Endian inEndian) const; 00217 00224 void deserialize( 00225 Stream *inStream, 00226 size_t inLevel, 00227 Endian inEndian); 00228 00229 }; 00230 00231 /* 00233 typedef Guid GUID; 00234 */ 00235 00236 CEL_DEFINE_DATATRAITS(Guid, byMemcpy, byCopyBytes); 00237 00238 } // namespace Celartem 00239 00240 #endif // _cel_guid_h_