Plasma Engine  2.0
Loading...
Searching...
No Matches
plMemoryStreamWriter Class Reference

A writer which can access a memory stream. More...

#include <MemoryStream.h>

Inheritance diagram for plMemoryStreamWriter:

Public Member Functions

 plMemoryStreamWriter (plMemoryStreamStorageInterface *pStreamStorage=nullptr)
 Pass the memory storage object to which to write to.
 
void SetStorage (plMemoryStreamStorageInterface *pStreamStorage)
 Sets the storage object upon which to operate. Resets the write position to the end of the storage stream. Pass nullptr if you want to detach from any previous storage stream, for example to ensure its reference count gets properly reduced.
 
virtual plResult WriteBytes (const void *pWriteBuffer, plUInt64 uiBytesToWrite) override
 Copies uiBytesToWrite from pWriteBuffer into the memory stream.
 
void SetWritePosition (plUInt64 uiWritePosition)
 Sets the write position to be used.
 
plUInt64 GetWritePosition () const
 Returns the current write position.
 
plUInt32 GetByteCount32 () const
 Returns the total stored bytes in the memory stream.
 
plUInt64 GetByteCount64 () const
 
- Public Member Functions inherited from plStreamWriter
 plStreamWriter ()
 Constructor.
 
virtual ~plStreamWriter ()
 Virtual destructor to ensure correct cleanup.
 
virtual plResult Flush ()
 Flushes the stream, may be implemented (not necessary to implement the interface correctly) so that user code can ensure that content is written.
 
template<typename T >
plResult WriteWordValue (const T *pWordValue)
 Helper method to write a word value correctly (copes with potentially different endianess)
 
template<typename T >
plResult WriteDWordValue (const T *pDWordValue)
 Helper method to write a dword value correctly (copes with potentially different endianess)
 
template<typename T >
plResult WriteQWordValue (const T *pQWordValue)
 Helper method to write a qword value correctly (copes with potentially different endianess)
 
PL_ALWAYS_INLINE void WriteVersion (plTypeVersion version)
 Writes a type version to the stream.
 
template<typename ArrayType , typename ValueType >
plResult WriteArray (const plArrayBase< ValueType, ArrayType > &array)
 Writes an array of elements to the stream.
 
template<typename ValueType , plUInt16 uiSize>
plResult WriteArray (const plSmallArrayBase< ValueType, uiSize > &array)
 Writes a small array of elements to the stream.
 
template<typename ValueType , plUInt32 uiSize>
plResult WriteArray (const ValueType(&array)[uiSize])
 Writes a C style fixed array.
 
template<typename KeyType , typename Comparer >
plResult WriteSet (const plSetBase< KeyType, Comparer > &set)
 Writes a set.
 
template<typename KeyType , typename ValueType , typename Comparer >
plResult WriteMap (const plMapBase< KeyType, ValueType, Comparer > &map)
 Writes a map.
 
template<typename KeyType , typename ValueType , typename Hasher >
plResult WriteHashTable (const plHashTableBase< KeyType, ValueType, Hasher > &hashTable)
 Writes a hash table (note that the entry order might change on read)
 
plResult WriteString (const plStringView sStringView)
 Writes a string.
 

Detailed Description

A writer which can access a memory stream.

Please note that the functions exposed by this object are not thread safe!

Member Function Documentation

◆ WriteBytes()

plResult plMemoryStreamWriter::WriteBytes ( const void * pWriteBuffer,
plUInt64 uiBytesToWrite )
overridevirtual

Copies uiBytesToWrite from pWriteBuffer into the memory stream.

pWriteBuffer must be a valid buffer and must hold that much data.

Implements plStreamWriter.


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