diff --git a/Include/Aurora/Memory/ByteBuffer.hpp b/Include/Aurora/Memory/ByteBuffer.hpp index ee3f25cb..6f1f783d 100644 --- a/Include/Aurora/Memory/ByteBuffer.hpp +++ b/Include/Aurora/Memory/ByteBuffer.hpp @@ -635,4 +635,50 @@ namespace Aurora::Memory this->memory = pRAIIParentOwner; } }; + + struct SharableByteBuffer : ByteBuffer, + AuEnableSharedFromThis + { + SharableByteBuffer() : ByteBuffer() + { + + } + + SharableByteBuffer(AuUInt uLength, bool circular = false, bool expandable = false) : ByteBuffer(uLength, circular, expandable) + { + + } + + SharableByteBuffer(AuUInt uLength, AuUInt uAlignment, bool circular = false, bool expandable = false) : ByteBuffer(uLength, uAlignment, circular, expandable) + { + + } + + private: + MemoryViewRead readView; + MemoryViewWrite writeView; + + public: + inline AuSPtr ToSharedWriteView() + { + this->writeView = *this; + return { this->SharedFromThis(), &this->writeView }; + } + + inline AuSPtr ToSharedReadView() + { + this->readView = *this; + return { this->SharedFromThis(), &this->readView }; + } + + inline operator AuSPtr() + { + return this->ToSharedWriteView(); + } + + inline operator AuSPtr() + { + return this->ToSharedReadView(); + } + }; } \ No newline at end of file