[+] AuMemoryView::CopyInto

[+] AuMemoryView::CopyFrom
[+] AuMemoryViewStream::CopyStreamInto
[+] AuMemoryViewStream::CopyStreamFrom
This commit is contained in:
Reece Wilson 2024-08-27 20:33:00 +01:00
parent d99c1032da
commit aafb64e740

View File

@ -448,7 +448,7 @@ namespace Aurora::Memory
this->controlBlock.pPinner; this->controlBlock.pPinner;
} }
AuSPtr<MemoryView> TryPromoteToSharedView(AuSPtr<void> pParent = {}) AuSPtr<MemoryView> TryPromoteToSharedView(AuSPtr<void> pParent = {}) const
{ {
#if 0 #if 0
bool bHasControlBlock = this->HasControlBlock(); bool bHasControlBlock = this->HasControlBlock();
@ -490,7 +490,7 @@ namespace Aurora::Memory
#endif #endif
} }
AuSPtr<MemoryView> TryPromoteToSharedViewNoParentNesting(AuSPtr<void> pParent = {}) AuSPtr<MemoryView> TryPromoteToSharedViewNoParentNesting(AuSPtr<void> pParent = {}) const
{ {
if (this->HasControlBlock()) if (this->HasControlBlock())
{ {
@ -581,6 +581,21 @@ namespace Aurora::Memory
return {}; return {};
} }
AuUInt CopyInto(const MemoryView<false> &write) const
{
auto uLength = AuMin(this->uLength, write.uLength);
AuMemcpy(write.pBase, this->pBase, uLength);
return uLength;
}
template<bool bThat = Readonly_b, AU_TEMPLATE_ENABLE_WHEN(!bThat)>
AuUInt CopyFrom(const MemoryView<true> &read) const
{
auto uLength = AuMin(this->uLength, read.uLength);
AuMemcpy(this->pBase, read.pBase, uLength);
return uLength;
}
}; };
using MemoryViewRead = MemoryView<true>; using MemoryViewRead = MemoryView<true>;
@ -680,6 +695,21 @@ namespace Aurora::Memory
return HasMemory(); return HasMemory();
} }
void CopyStreamInto(const MemoryView<false> &write) const
{
auto uLength = AuMin(this->uLength, write.uLength);
AuMemcpy(write.pBase, this->pBase, uLength);
this->outVariable = uLength;
}
template<bool bThat = Readonly_b, AU_TEMPLATE_ENABLE_WHEN(!bThat)>
void CopyStreamFrom(const MemoryView<true> &read) const
{
auto uLength = AuMin(this->uLength, read.uLength);
AuMemcpy(this->pBase, read.pBase, uLength);
this->outVariable = uLength;
}
AuUInt &outVariable; AuUInt &outVariable;
private: private:
AuUInt unused; AuUInt unused;