From 8fd4ef0a719ab37f65729e27641627e38dab0c14 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Tue, 17 Oct 2023 10:03:15 +0100 Subject: [PATCH] [*] Allocless RNG devices --- Include/Aurora/RNG/IRandomDevice.hpp | 6 +++++- Source/RNG/AuRandomDevice.cpp | 12 ++++++++++++ Source/RNG/AuRandomDevice.hpp | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Include/Aurora/RNG/IRandomDevice.hpp b/Include/Aurora/RNG/IRandomDevice.hpp index f286df98..abf8bd86 100644 --- a/Include/Aurora/RNG/IRandomDevice.hpp +++ b/Include/Aurora/RNG/IRandomDevice.hpp @@ -9,6 +9,8 @@ namespace Aurora::RNG { + static const auto kSizeRNGDevice = 256; + struct IRandomDevice { virtual void Read(Memory::MemoryViewWrite view) = 0; @@ -94,5 +96,7 @@ namespace Aurora::RNG } }; - AUKN_SHARED_API(Random, IRandomDevice, const RandomDef &def); + AUKN_SHARED_SOO2(Random, IRandomDevice, kSizeRNGDevice, + ((const RandomDef &, def)), + const RandomDef &def); } \ No newline at end of file diff --git a/Source/RNG/AuRandomDevice.cpp b/Source/RNG/AuRandomDevice.cpp index f7e95902..6c946916 100644 --- a/Source/RNG/AuRandomDevice.cpp +++ b/Source/RNG/AuRandomDevice.cpp @@ -10,6 +10,16 @@ namespace Aurora::RNG { + RandomDevice::RandomDevice() + { + + } + + RandomDevice::RandomDevice(const RandomDef &def) + { + this->Init(def); + } + void RandomDevice::Init(const RandomDef &def) { this->def_ = def; @@ -172,4 +182,6 @@ namespace Aurora::RNG { AuSafeDelete(pDevice); } + + AUROXTL_INTERFACE_SOO_SRC(Random, RandomDevice, (const RandomDef &, def)) } \ No newline at end of file diff --git a/Source/RNG/AuRandomDevice.hpp b/Source/RNG/AuRandomDevice.hpp index e1d5d169..cc5237bb 100644 --- a/Source/RNG/AuRandomDevice.hpp +++ b/Source/RNG/AuRandomDevice.hpp @@ -13,6 +13,9 @@ namespace Aurora::RNG { struct RandomDevice : IRandomDevice { + RandomDevice(); + RandomDevice(const RandomDef & def); + void Read(Memory::MemoryViewWrite view) override; AuString NextString(AuUInt32 uLength, ERngStringCharacters type) override;