SourceMod SDK  1.7
SourceMod::IDataPack Class Referenceabstract

Specifies a data pack that can only be written. More...

#include <public/IDataPack.h>

Inheritance diagram for SourceMod::IDataPack:
SourceMod::IDataReader

Public Member Functions

virtual void ResetSize ()=0
 Resets the used size of the stream back to zero.
 
virtual void PackCell (cell_t cell)=0
 Packs one cell into the data stream. More...
 
virtual void PackFloat (float val)=0
 Packs one float into the data stream. More...
 
virtual void PackString (const char *string)=0
 Packs one string into the data stream. The length is recorded as well for buffer overrun protection. More...
 
virtual size_t CreateMemory (size_t size, void **addr)=0
 Creates a generic block of memory in the stream. More...
 
virtual void PackFunction (cell_t function)=0
 Packs one function pointer into the data stream. More...
 
- Public Member Functions inherited from SourceMod::IDataReader
virtual void Reset () const =0
 Resets the position in the data stream to the beginning.
 
virtual size_t GetPosition () const =0
 Retrieves the current stream position. More...
 
virtual bool SetPosition (size_t pos) const =0
 Sets the current stream position. More...
 
virtual cell_t ReadCell () const =0
 Reads one cell from the data stream. More...
 
virtual float ReadFloat () const =0
 Reads one float from the data stream. More...
 
virtual bool IsReadable (size_t bytes) const =0
 Returns whether or not a specified number of bytes from the current stream position to the end can be read. More...
 
virtual const char * ReadString (size_t *len) const =0
 Reads a string from the data stream. More...
 
virtual void * GetMemory () const =0
 Reads the current position as a generic address. More...
 
virtual void * ReadMemory (size_t *size) const =0
 Reads the current position as a generic data type. More...
 
virtual cell_t ReadFunction () const =0
 Reads a function pointer from the data stream. More...
 

Detailed Description

Specifies a data pack that can only be written.

Member Function Documentation

virtual size_t SourceMod::IDataPack::CreateMemory ( size_t  size,
void **  addr 
)
pure virtual

Creates a generic block of memory in the stream.

Note that the pointer it returns can be invalidated on further writing, since the stream size may grow. You may need to double back and fetch the pointer again.

Parameters
sizeSize of the memory to create in the stream.
addrOptional pointer to store the relocated memory address.
Returns
Current position of the stream beforehand.
virtual void SourceMod::IDataPack::PackCell ( cell_t  cell)
pure virtual

Packs one cell into the data stream.

Parameters
cellCell value to write.
virtual void SourceMod::IDataPack::PackFloat ( float  val)
pure virtual

Packs one float into the data stream.

Parameters
valFloat value to write.
virtual void SourceMod::IDataPack::PackFunction ( cell_t  function)
pure virtual

Packs one function pointer into the data stream.

Parameters
functionThe function pointer to write.
virtual void SourceMod::IDataPack::PackString ( const char *  string)
pure virtual

Packs one string into the data stream. The length is recorded as well for buffer overrun protection.

Parameters
stringString to write.

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