resonance 1.0.1
Loading...
Searching...
No Matches
IOBMemStream Class Reference

Bidirectional stream over a growing byte buffer. More...

#include <iobmemstream.h>

Inheritance diagram for IOBMemStream:
Collaboration diagram for IOBMemStream:

Public Member Functions

 IOBMemStream ()
 Open an empty stream.
 IOBMemStream (const void *pData, int nSize)
 Open a stream and write an initial block into it.
virtual ~IOBMemStream ()
 Close the stream and release the buffer.
virtual IBStream & Read (void *pDest, int nSize)
virtual IBStream & Seek (int nOffset, int nWhence)
virtual int Tell ()
virtual int Eof ()
virtual int Fail ()
 Test whether a transfer has failed.
virtual IBStream & Flush ()
virtual void Fill (const void *pSrc, int nSize)
 Grow the buffer by nSize bytes and write nSize bytes at the cursor.
virtual void Resize (int nSize)
 Resize the buffer and rewind the cursor.
virtual char * Buffer ()
 Report the buffer.
void Compact ()
 Drop the bytes already read from the front of the buffer and rewind the cursor.
virtual OBStream & Write (const void *pSrc, int nSize)
virtual OBStream & Reset ()
Public Member Functions inherited from IBStream
virtual IBStream & ReadLE (void *pDest, int nSize)
 Move nSize bytes into pDest through the virtual Read().
virtual ~IBStream ()
 Close the stream.
Public Member Functions inherited from OBStream
virtual OBStream & WriteLE (const void *pSrc, int nSize)
 Move nSize bytes out of pSrc through the virtual Write().

Detailed Description

Bidirectional stream over a growing byte buffer.

Its RTTI descriptor is at 0x008f00d0. It has single inheritance from IOBStream at offset 0. The type function is at 0x004ed780 and builds IOBStream's descriptor inline first.

The object is 0x20 bytes. Two vtable pointers occupy +0x00 and +0x04, addressing 0x008241a0 for the IBStream subobject and 0x00824170 for the OBStream subobject, whose entries adjust this by -0x04. The end flag, the failure flag, and the cursor follow at +0x08, +0x0c, and +0x10, and the buffer is a std::vector<char> whose three pointers occupy +0x14, +0x18, and +0x1c.

One cursor serves both halves, so a write advances the position a read then continues from. That is the difference from IOBPreallocMemStream, which has two positions and a fixed buffer.

SetSize() through Buffer() are the three slots the primary vtable adds beyond IBStream's eight. They are declared here rather than on IOBStream, and iobstream.h records why that split cannot be settled.

Constructor & Destructor Documentation

◆ IOBMemStream() [1/2]

IOBMemStream::IOBMemStream ( )

Open an empty stream.

The buffer reserves one growth step up front.

Ghidra address:
NTSC-U/C: 0x004ecca8
Ghidra address:
PAL: 0x0052b850

◆ IOBMemStream() [2/2]

IOBMemStream::IOBMemStream ( const void * pData,
int nSize )

Open a stream and write an initial block into it.

The cursor is left after the block, so a reader has to seek back to the start. No call site remains in the image.

Parameters
pDataThe bytes to write.
nSizeThe number of bytes to write.
Ghidra address:
NTSC-U/C: 0x004ece70
Ghidra address:
PAL: 0x0052ba18

◆ ~IOBMemStream()

virtual IOBMemStream::~IOBMemStream ( )
virtual

Close the stream and release the buffer.

IBStream vtable slot 8.

Ghidra address:
NTSC-U/C: 0x004ed978
Ghidra address:
PAL: 0x0052c520

Member Function Documentation

◆ Read()

virtual IBStream & IOBMemStream::Read ( void * pDest,
int nSize )
virtual
Ghidra address:
NTSC-U/C: 0x004ee0e8
Ghidra address:
PAL: 0x0052cc90

Implements IBStream.

◆ Seek()

virtual IBStream & IOBMemStream::Seek ( int nOffset,
int nWhence )
virtual
Ghidra address:
NTSC-U/C: 0x004ee168
Ghidra address:
PAL: 0x0052cd10

Implements IBStream.

◆ Tell()

virtual int IOBMemStream::Tell ( )
virtual
Ghidra address:
NTSC-U/C: 0x004eda38
Ghidra address:
PAL: 0x0052c5e0

Implements IBStream.

◆ Eof()

virtual int IOBMemStream::Eof ( )
virtual
Ghidra address:
NTSC-U/C: 0x004eda40
Ghidra address:
PAL: 0x0052c5e8

Implements IBStream.

◆ Fail()

virtual int IOBMemStream::Fail ( )
virtual

Test whether a transfer has failed.

One body serves IBStream vtable slot 5 and OBStream vtable slot 3.

Returns
Non-zero once a transfer has failed.
Ghidra address:
NTSC-U/C: 0x004eda48
Ghidra address:
PAL: 0x0052c5f0

Implements IBStream.

◆ Flush()

virtual IBStream & IOBMemStream::Flush ( )
virtual
Ghidra address:
NTSC-U/C: 0x004eda50
Ghidra address:
PAL: 0x0052c5f8

Implements IBStream.

◆ Fill()

virtual void IOBMemStream::Fill ( const void * pSrc,
int nSize )
virtual

Grow the buffer by nSize bytes and write nSize bytes at the cursor.

IBStream vtable slot 9. The cursor is not advanced.

Parameters
pSrcThe bytes to write.
nSizeThe number of bytes to write.
Ghidra address:
NTSC-U/C: 0x004ee018
Ghidra address:
PAL: 0x0052cbc0

◆ Resize()

virtual void IOBMemStream::Resize ( int nSize)
virtual

Resize the buffer and rewind the cursor.

IBStream vtable slot 10. Growth is zero filled. The title is inferred from the shape, and no call site remains in the image.

Parameters
nSizeThe new buffer size in bytes.
Ghidra address:
NTSC-U/C: 0x004ee260
Ghidra address:
PAL: 0x0052ce08

◆ Buffer()

virtual char * IOBMemStream::Buffer ( )
virtual

Report the buffer.

IBStream vtable slot 11. The pointer is null while the buffer has never been allocated.

Returns
The first byte of the buffer.
Ghidra address:
NTSC-U/C: 0x004eda58
Ghidra address:
PAL: 0x0052c600

◆ Compact()

void IOBMemStream::Compact ( )

Drop the bytes already read from the front of the buffer and rewind the cursor.

The unread tail moves to the start of the buffer, and the buffer shrinks by the old cursor position. The routine is absent from the vtable, and no call site survives in the shipped program.

Ghidra address:
NTSC-U/C: 0x004ee1f0
Ghidra address:
PAL: 0x0052cd98

◆ Write()

virtual OBStream & IOBMemStream::Write ( const void * pSrc,
int nSize )
virtual
Ghidra address:
NTSC-U/C: 0x004ed068
Ghidra address:
PAL: 0x0052bc10

Implements OBStream.

◆ Reset()

virtual OBStream & IOBMemStream::Reset ( )
virtual
Ghidra address:
NTSC-U/C: 0x004eda30
Ghidra address:
PAL: 0x0052c5d8

Implements OBStream.


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