XII Release 0.1.0
Loading...
Searching...
No Matches
xiiMemoryStreamContainerStorage< CONTAINER > Class Template Reference

Templated implementation of xiiMemoryStreamStorageInterface that adapts most standard XII containers to the interface. More...

#include <MemoryStream.h>

Inheritance diagram for xiiMemoryStreamContainerStorage< CONTAINER >:
[legend]

Public Member Functions

 xiiMemoryStreamContainerStorage (xiiUInt32 uiInitialCapacity=0, xiiAllocatorBase *pAllocator=xiiFoundation::GetDefaultAllocator())
 Creates the storage object for a memory stream. Use uiInitialCapacity to reserve some memory up front.
 
virtual xiiUInt64 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 xiiUInt64 GetHeapMemoryUsage () const override
 Returns the amount of bytes that are currently allocated on the heap.
 
virtual void Reserve (xiiUInt64 uiBytes) override
 Reserves N bytes of storage.
 
virtual xiiResult CopyToStream (xiiStreamWriter &ref_stream) const override
 Writes the entire content of the storage to the provided stream.
 
virtual xiiArrayPtr< const xiiUInt8 > GetContiguousMemoryRange (xiiUInt64 uiStartByte) const override
 Returns a read-only xiiArrayPtr that represents a contiguous area in memory which starts at the given first byte.
 
virtual xiiArrayPtr< xiiUInt8 > GetContiguousMemoryRange (xiiUInt64 uiStartByte) override
 Non-const overload of GetContiguousMemoryRange().
 
const xiiUInt8 * GetData () const
 The data is guaranteed to be contiguous.
 
- Public Member Functions inherited from xiiMemoryStreamStorageInterface
xiiUInt32 GetStorageSize32 () const
 Returns the number of bytes that are currently stored. Asserts that the stored amount is less than 4GB.
 
void ReadAll (xiiStreamReader &ref_stream, xiiUInt64 uiMaxBytes=xiiMath::MaxValue< xiiUInt64 >())
 Copies all data from the given stream into the storage.
 

Detailed Description

template<typename CONTAINER>
class xiiMemoryStreamContainerStorage< CONTAINER >

Templated implementation of xiiMemoryStreamStorageInterface that adapts most standard XII containers to the interface.

Note that xiiMemoryStreamContainerStorage assumes contiguous storage, so using a xiiDeque for storage will not work.

Member Function Documentation

◆ Clear()

template<typename CONTAINER>
virtual void xiiMemoryStreamContainerStorage< CONTAINER >::Clear ( )
inlineoverridevirtual

Clears the entire storage. All readers and writers must be reset to start from the beginning again.

Implements xiiMemoryStreamStorageInterface.

◆ Compact()

template<typename CONTAINER>
virtual void xiiMemoryStreamContainerStorage< CONTAINER >::Compact ( )
inlineoverridevirtual

Deallocates any allocated memory that's not needed to hold the currently stored data.

Implements xiiMemoryStreamStorageInterface.

◆ CopyToStream()

template<typename CONTAINER>
virtual xiiResult xiiMemoryStreamContainerStorage< CONTAINER >::CopyToStream ( xiiStreamWriter & ref_stream) const
inlineoverridevirtual

Writes the entire content of the storage to the provided stream.

Implements xiiMemoryStreamStorageInterface.

◆ GetContiguousMemoryRange() [1/2]

template<typename CONTAINER>
virtual xiiArrayPtr< const xiiUInt8 > xiiMemoryStreamContainerStorage< CONTAINER >::GetContiguousMemoryRange ( xiiUInt64 uiStartByte) const
inlineoverridevirtual

Returns a read-only xiiArrayPtr that represents a contiguous area in memory which starts at the given first byte.

This piece of memory can be read/copied/modified in one operation (memcpy etc). The next byte after this slice may be located somewhere entirely different in memory. Call GetContiguousMemoryRange() again with the next byte after this range, to get access to the next memory area.

Chunks may differ in size.

Implements xiiMemoryStreamStorageInterface.

◆ GetContiguousMemoryRange() [2/2]

template<typename CONTAINER>
virtual xiiArrayPtr< xiiUInt8 > xiiMemoryStreamContainerStorage< CONTAINER >::GetContiguousMemoryRange ( xiiUInt64 uiStartByte)
inlineoverridevirtual

Non-const overload of GetContiguousMemoryRange().

Implements xiiMemoryStreamStorageInterface.

◆ GetHeapMemoryUsage()

template<typename CONTAINER>
virtual xiiUInt64 xiiMemoryStreamContainerStorage< CONTAINER >::GetHeapMemoryUsage ( ) const
inlineoverridevirtual

Returns the amount of bytes that are currently allocated on the heap.

Implements xiiMemoryStreamStorageInterface.

◆ GetStorageSize64()

template<typename CONTAINER>
virtual xiiUInt64 xiiMemoryStreamContainerStorage< CONTAINER >::GetStorageSize64 ( ) const
inlineoverridevirtual

Returns the number of bytes that are currently stored.

Implements xiiMemoryStreamStorageInterface.

◆ Reserve()

template<typename CONTAINER>
virtual void xiiMemoryStreamContainerStorage< CONTAINER >::Reserve ( xiiUInt64 uiBytes)
inlineoverridevirtual

Reserves N bytes of storage.

Implements xiiMemoryStreamStorageInterface.

◆ SetInternalSize()

template<typename CONTAINER>
virtual void xiiMemoryStreamContainerStorage< CONTAINER >::SetInternalSize ( xiiUInt64 uiSize)
inlineoverrideprivatevirtual

The documentation for this class was generated from the following file: