![]() |
Gorgon Game Engine
|
This class represents a short globally unique identifier. More...
Classes | |
struct | CreateNewTag |
Tag to create a new GUID. | |
Public Member Functions | |
SGuid () | |
Constructor for an empty guid. More... | |
SGuid (const Byte data[8]) | |
Creates a new GUID from the given data. More... | |
SGuid (const CreateNewTag &) | |
Constructor to create a new guid. More... | |
SGuid (std::istream &in) | |
Reads a new GUID from the given stream. More... | |
SGuid (unsigned long long data) | |
Creates a new GUID from the given data. More... | |
SGuid (unsigned serial, unsigned random, unsigned time) | |
Creates a new GUID from the given data. More... | |
bool | IsEmpty () const |
Returns whether this GUID is empty. More... | |
void | Load (std::istream &Data) |
Loads the GUID from a given stream. More... | |
void | LoadLong (std::istream &file) |
Loads a full length 16bit GUID from the given file. Used for back compatibility. More... | |
void | New () |
Generates a new GUID and assign that GUID to this one. More... | |
operator bool () const | |
Checks if the GUID is set. More... | |
operator std::string () const | |
Converts the GUID to a string. More... | |
bool | operator!= (const SGuid &right) const |
Compares two GUIDs. More... | |
bool | operator< (const SGuid &g) const |
Compares two GUIDs. More... | |
bool | operator== (const SGuid &right) const |
Compares two GUIDs. More... | |
void | Save (std::ostream &file) const |
Saves this GUID to file. More... | |
void | Set (unsigned serial, unsigned random, unsigned time) |
Sets the GUID to the given components. More... | |
Public Attributes | |
union { | |
Byte Bytes [8] | |
Allows byte-by-byte addressing of the guid. More... | |
uint64_t Integer | |
Single integer value representing this guid. More... | |
}; | |
Static Public Attributes | |
static const struct Gorgon::SGuid::CreateNewTag | CreateNew |
static const SGuid | Empty |
Value for empty GUID. More... | |
This class represents a short globally unique identifier.
Unlike full guids, this is not guranteed to be really unique. However, its almost impossible to find a duplicate. This object is 8 bytes long.
SGuid | ( | ) |
Constructor for an empty guid.
|
explicit |
Constructor to create a new guid.
Use Gorgon::SGuid guid{Gorgon::SGuid::CreateNew}
to create a new guid
References SGuid::New().
Creates a new GUID from the given data.
References SGuid::Bytes, and SGuid::Integer.
SGuid | ( | unsigned long long | data | ) |
Creates a new GUID from the given data.
References SGuid::Integer.
SGuid | ( | unsigned | serial, |
unsigned | random, | ||
unsigned | time | ||
) |
Creates a new GUID from the given data.
References SGuid::Set().
|
explicit |
Reads a new GUID from the given stream.
References SGuid::Load().
bool IsEmpty | ( | ) | const |
Returns whether this GUID is empty.
References SGuid::Integer.
void Load | ( | std::istream & | Data | ) |
Loads the GUID from a given stream.
References SGuid::Bytes, and Gorgon::Resource::GID::Data.
void LoadLong | ( | std::istream & | file | ) |
Loads a full length 16bit GUID from the given file. Used for back compatibility.
References SGuid::Bytes.
void New | ( | ) |
Generates a new GUID and assign that GUID to this one.
References SGuid::Set().
operator bool | ( | ) | const |
Checks if the GUID is set.
References SGuid::IsEmpty().
operator std::string | ( | ) | const |
Converts the GUID to a string.
References SGuid::Bytes.
bool operator!= | ( | const SGuid & | right | ) | const |
Compares two GUIDs.
References SGuid::Integer.
bool operator< | ( | const SGuid & | g | ) | const |
Compares two GUIDs.
References SGuid::Integer.
bool operator== | ( | const SGuid & | right | ) | const |
Compares two GUIDs.
References SGuid::Integer.
void Save | ( | std::ostream & | file | ) | const |
Saves this GUID to file.
References SGuid::Bytes.
void Set | ( | unsigned | serial, |
unsigned | random, | ||
unsigned | time | ||
) |
Sets the GUID to the given components.
References SGuid::Bytes.
union { ... } |
Byte Bytes[8] |
Allows byte-by-byte addressing of the guid.
|
static |
uint64_t Integer |
Single integer value representing this guid.