diff --git a/Include/Aurora/Memory/MemoryView.hpp b/Include/Aurora/Memory/MemoryView.hpp index 673e3919..f43ee46b 100644 --- a/Include/Aurora/Memory/MemoryView.hpp +++ b/Include/Aurora/Memory/MemoryView.hpp @@ -448,7 +448,7 @@ namespace Aurora::Memory this->controlBlock.pPinner; } - AuSPtr TryPromoteToSharedView(AuSPtr pParent = {}) + AuSPtr TryPromoteToSharedView(AuSPtr pParent = {}) const { #if 0 bool bHasControlBlock = this->HasControlBlock(); @@ -490,7 +490,7 @@ namespace Aurora::Memory #endif } - AuSPtr TryPromoteToSharedViewNoParentNesting(AuSPtr pParent = {}) + AuSPtr TryPromoteToSharedViewNoParentNesting(AuSPtr pParent = {}) const { if (this->HasControlBlock()) { @@ -581,6 +581,21 @@ namespace Aurora::Memory return {}; } + + AuUInt CopyInto(const MemoryView &write) const + { + auto uLength = AuMin(this->uLength, write.uLength); + AuMemcpy(write.pBase, this->pBase, uLength); + return uLength; + } + + template + AuUInt CopyFrom(const MemoryView &read) const + { + auto uLength = AuMin(this->uLength, read.uLength); + AuMemcpy(this->pBase, read.pBase, uLength); + return uLength; + } }; using MemoryViewRead = MemoryView; @@ -680,6 +695,21 @@ namespace Aurora::Memory return HasMemory(); } + void CopyStreamInto(const MemoryView &write) const + { + auto uLength = AuMin(this->uLength, write.uLength); + AuMemcpy(write.pBase, this->pBase, uLength); + this->outVariable = uLength; + } + + template + void CopyStreamFrom(const MemoryView &read) const + { + auto uLength = AuMin(this->uLength, read.uLength); + AuMemcpy(this->pBase, read.pBase, uLength); + this->outVariable = uLength; + } + AuUInt &outVariable; private: AuUInt unused;