![]() |
Plasma Engine
2.0
|
Maps a raw chunk of memory to the plStreamReader interface. More...
#include <MemoryStream.h>
Public Member Functions | |
plRawMemoryStreamReader (const void *pData, plUInt64 uiDataSize) | |
Initialize the raw memory reader with the chunk of memory that is the data storage. | |
template<typename CONTAINER > | |
plRawMemoryStreamReader (const CONTAINER &container) | |
Initialize the raw memory reader with the chunk of memory from a standard pl container. | |
void | Reset (const void *pData, plUInt64 uiDataSize) |
template<typename CONTAINER > | |
void | Reset (const CONTAINER &container) |
virtual plUInt64 | ReadBytes (void *pReadBuffer, plUInt64 uiBytesToRead) override |
Reads either uiBytesToRead or the amount of remaining bytes in the stream into pReadBuffer. | |
virtual plUInt64 | SkipBytes (plUInt64 uiBytesToSkip) override |
Skips bytes in the stream (e.g. for skipping objects which can't be serialized due to missing information etc.) | |
void | SetReadPosition (plUInt64 uiReadPosition) |
Sets the read position to be used. | |
plUInt64 | GetReadPosition () const |
Returns the current read position in the raw memory block. | |
plUInt64 | GetByteCount () const |
Returns the total available bytes in the memory stream. | |
void | SetDebugSourceInformation (plStringView sDebugSourceInformation) |
Allows to set a string as the source of information in the memory stream for debug purposes. | |
![]() | |
plStreamReader () | |
Constructor. | |
virtual | ~plStreamReader () |
Virtual destructor to ensure correct cleanup. | |
template<typename T > | |
plResult | ReadWordValue (T *pWordValue) |
Helper method to read a word value correctly (copes with potentially different endianess) | |
template<typename T > | |
plResult | ReadDWordValue (T *pDWordValue) |
Helper method to read a dword value correctly (copes with potentially different endianess) | |
template<typename T > | |
plResult | ReadQWordValue (T *pQWordValue) |
Helper method to read a qword value correctly (copes with potentially different endianess) | |
template<typename ArrayType , typename ValueType > | |
plResult | ReadArray (plArrayBase< ValueType, ArrayType > &inout_array) |
Reads an array of elements from the stream. | |
template<typename ValueType , plUInt16 uiSize, typename AllocatorWrapper > | |
plResult | ReadArray (plSmallArray< ValueType, uiSize, AllocatorWrapper > &ref_array) |
Reads a small array of elements from the stream. | |
template<typename ValueType , plUInt32 uiSize> | |
plResult | ReadArray (ValueType(&array)[uiSize]) |
Writes a C style fixed array. | |
template<typename KeyType , typename Comparer > | |
plResult | ReadSet (plSetBase< KeyType, Comparer > &inout_set) |
Reads a set. | |
template<typename KeyType , typename ValueType , typename Comparer > | |
plResult | ReadMap (plMapBase< KeyType, ValueType, Comparer > &inout_map) |
Reads a map. | |
template<typename KeyType , typename ValueType , typename Hasher > | |
plResult | ReadHashTable (plHashTableBase< KeyType, ValueType, Hasher > &inout_hashTable) |
Read a hash table (note that the entry order is not stable) | |
plResult | ReadString (plStringBuilder &ref_sBuilder) |
Reads a string into an plStringBuilder. | |
plResult | ReadString (plString &ref_sString) |
Reads a string into an plString. | |
PL_ALWAYS_INLINE plTypeVersion | ReadVersion (plTypeVersion expectedMaxVersion) |
Maps a raw chunk of memory to the plStreamReader interface.
|
inline |
Initialize the raw memory reader with the chunk of memory from a standard pl container.
|
overridevirtual |
Reads either uiBytesToRead or the amount of remaining bytes in the stream into pReadBuffer.
It is valid to pass nullptr for pReadBuffer, in this case the memory stream position is only advanced by the given number of bytes.
Implements plStreamReader.
|
overridevirtual |
Skips bytes in the stream (e.g. for skipping objects which can't be serialized due to missing information etc.)
Reimplemented from plStreamReader.