|
VLink
2.0.0
A high-performance communication middleware
|
Value-typed RFC 4122 UUID and project random-bytes primitive. More...
#include <algorithm>#include <array>#include <cstddef>#include <cstdint>#include <functional>#include <iterator>#include <optional>#include <ostream>#include <random>#include <string>#include <string_view>#include <type_traits>#include <vector>#include "./macros.h"Go to the source code of this file.
Classes | |
| class | vlink::Uuid |
| Value-typed RFC 4122 UUID. More... | |
| struct | std::hash< vlink::Uuid > |
std::hash specialisation so vlink::Uuid can be used inside unordered containers. More... | |
Namespaces | |
| vlink | |
Functions | |
| bool | vlink::operator== (const Uuid &lhs, const Uuid &rhs) noexcept |
| bool | vlink::operator!= (const Uuid &lhs, const Uuid &rhs) noexcept |
| bool | vlink::operator< (const Uuid &lhs, const Uuid &rhs) noexcept |
Value-typed RFC 4122 UUID and project random-bytes primitive.
vlink::Uuid stores 16 bytes in big-endian (network) order matching RFC 4122 section 4.1. The class is trivially comparable, parses and emits both the canonical 36-character hyphenated form and the 32-character compact form, and ships with a thread-local v4 generator backed by std::mt19937.
UUID variant and version reference:
| Field | Enumerator | RFC 4122 meaning |
|---|---|---|
| Variant | kNcs | NCS backward compatibility (0xxx) |
| Variant | kRfc | RFC 4122 / DCE 1.1 (10xx) |
| Variant | kMicrosoft | Microsoft GUID (110x) |
| Variant | kReserved | Reserved (111x) |
| Version | kNone | Nil UUID or invalid version nibble |
| Version | kTimeBased | v1 — gregorian time + node |
| Version | kDceSecurity | v2 — DCE Security |
| Version | kNameBasedMd5 | v3 — Name + MD5 |
| Version | kRandomBased | v4 — Random / pseudo-random (this generator) |
| Version | kNameBasedSha1 | v5 — Name + SHA-1 |
Random v4 generation pipeline:
* std::random_device x8 ---> std::seed_seq ---> std::mt19937 ---> uniform_int(uint32_t) * | * v * byte extraction via shifts * | * v * set variant (octet 8 = 10xxxxxx) + version (octet 6 = 0100xxxx) *
uuid.cc; only constexpr operations remain inline so Uuid stays a literal type for compile-time use.