Plasma Engine  2.0
Loading...
Searching...
No Matches
UuidGenerator_Posix.h
1#include <Foundation/FoundationInternal.h>
2PL_FOUNDATION_INTERNAL_HEADER
3
4#include <Foundation/Types/Uuid.h>
5
6#if __has_include(<uuid/uuid.h>)
7# include <uuid/uuid.h>
8# define HAS_UUID 1
9#else
10// # error "uuid.h does not exist on this distro."
11# define HAS_UUID 0
12#endif
13
14#if HAS_UUID
15
16static_assert(sizeof(plUInt64) * 2 == sizeof(uuid_t));
17
19{
20 uuid_t uuid;
21 uuid_generate(uuid);
22
23 plUInt64* uiUuidData = reinterpret_cast<plUInt64*>(uuid);
24
25 return plUuid(uiUuidData[1], uiUuidData[0]);
26}
27
28#else
29
31{
32 PL_REPORT_FAILURE("This distro doesn't have support for UUID generation.");
33 return plUuid();
34}
35
36#endif
This data type is the abstraction for 128-bit Uuid (also known as GUID) instances.
Definition Uuid.h:11
PL_ALWAYS_INLINE plUuid()=default
Default constructor. Constructed Uuid will be invalid.
static plUuid MakeUuid()
Returns a new Uuid.
Definition UuidGenerator_Posix.h:30