From c51a61c0f0de65a3e64f589816a56f21ed4e8528 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Sun, 15 Aug 2021 17:14:06 -0700 Subject: Initial work on data streams --- core/src/Utils/IO/UuidIntegration.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 core/src/Utils/IO/UuidIntegration.hpp (limited to 'core/src/Utils/IO/UuidIntegration.hpp') diff --git a/core/src/Utils/IO/UuidIntegration.hpp b/core/src/Utils/IO/UuidIntegration.hpp new file mode 100644 index 0000000..202e021 --- /dev/null +++ b/core/src/Utils/IO/UuidIntegration.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include "Utils/IO/DataStream.hpp" + +#include +#include +#include +#include + +void ReadFromDataStream(DataStream& s, uuids::uuid& uuid) +{ + uint8_t buffer[16]; + s.ReadBytes(16, buffer); + + uuid = uuids::uuid(gsl::span{ buffer }); +} + +void WriteToDataStream(DataStream& s, const uuids::uuid& uuid) +{ + auto gslSpan = uuid.as_bytes(); + s.WriteBytes(gslSpan.size(), gslSpan.data()); +} -- cgit v1.2.3-70-g09d2