![]() |
ezEngine
Release 25.03
|
#include <MemoryStream.h>
Public Member Functions | |
ezContiguousMemoryStreamStorage (ezUInt32 uiInitialCapacity=0, ezAllocator *pAllocator=ezFoundation::GetDefaultAllocator()) | |
![]() | |
ezMemoryStreamContainerStorage (ezUInt32 uiInitialCapacity=0, ezAllocator *pAllocator=ezFoundation::GetDefaultAllocator()) | |
Creates the storage object for a memory stream. Use uiInitialCapacity to reserve some memory up front. | |
virtual ezUInt64 | GetStorageSize64 () const override |
Returns the number of bytes that are currently stored. | |
virtual void | Clear () override |
Clears the entire storage. All readers and writers must be reset to start from the beginning again. | |
virtual void | Compact () override |
Deallocates any allocated memory that's not needed to hold the currently stored data. | |
virtual ezUInt64 | GetHeapMemoryUsage () const override |
Returns the amount of bytes that are currently allocated on the heap. | |
virtual void | Reserve (ezUInt64 uiBytes) override |
Reserves N bytes of storage. | |
virtual ezResult | CopyToStream (ezStreamWriter &inout_stream) const override |
Writes the entire content of the storage to the provided stream. | |
virtual ezArrayPtr< const ezUInt8 > | GetContiguousMemoryRange (ezUInt64 uiStartByte) const override |
Returns a read-only ezArrayPtr that represents a contiguous area in memory which starts at the given first byte. More... | |
virtual ezArrayPtr< ezUInt8 > | GetContiguousMemoryRange (ezUInt64 uiStartByte) override |
Non-const overload of GetContiguousMemoryRange(). | |
const ezUInt8 * | GetData () const |
The data is guaranteed to be contiguous. | |
![]() | |
ezUInt32 | GetStorageSize32 () const |
Returns the number of bytes that are currently stored. Asserts that the stored amount is less than 4GB. | |
virtual ezUInt64 | GetStorageSize64 () const =0 |
Returns the number of bytes that are currently stored. | |
virtual ezUInt64 | GetHeapMemoryUsage () const =0 |
Returns the amount of bytes that are currently allocated on the heap. | |
void | ReadAll (ezStreamReader &inout_stream, ezUInt64 uiMaxBytes=ezMath::MaxValue< ezUInt64 >()) |
Copies all data from the given stream into the storage. | |
ezContiguousMemoryStreamStorage holds internally an ezHybridArray<ezUInt8, 256>, to prevent allocations when only small temporary memory streams are needed. That means it will have a memory overhead of that size. Also it reallocates memory on demand, and the data is guaranteed to be contiguous. This may be desirable, but can have a high performance overhead when data grows very large.