resonance 1.0.1
Loading...
Searching...
No Matches
IBStream Class Referenceabstract

Input half of the byte stream interface. More...

#include <ibstream.h>

Inheritance diagram for IBStream:

Public Member Functions

virtual IBStream & Read (void *pDest, int nSize)=0
 Move nSize bytes into pDest.
virtual IBStream & Seek (int nOffset, int nWhence)=0
 Move the read position.
virtual int Tell ()=0
 Report the read position.
virtual int Eof ()=0
 Test whether the read position has arrived at the end of the data.
virtual int Fail ()=0
 Test whether a transfer has failed.
virtual IBStream & ReadLE (void *pDest, int nSize)
 Move nSize bytes into pDest through the virtual Read().
virtual IBStream & Flush ()=0
 Service the underlying transport.
virtual ~IBStream ()
 Close the stream.

Detailed Description

Input half of the byte stream interface.

Its RTTI descriptor is at 0x0086f5e0. It has no base. The class has no data member. The object is four bytes of vtable pointer, and every field belongs to a subclass. The descriptor does not emit a standalone accessor, because each derived accessor builds it inline before its own.

Three implementations are attested. IBFileStream derives from this class alone, while IOBStream and IOBPreallocMemStream derive from this class at offset 0 and from OBStream at offset 4. Every vtable in the family places these eight slots first, in the declaration order below, so the recovery is complete rather than partial. IBFileStream's table ends at slot 8, which is what fixes the count.

ReadLE() is the one slot with a shared base body. All three implementations retain it, and it does nothing beyond dispatching Read(). The two entry points are therefore interchangeable on this target.

Fail() is declared with the same signature on OBStream. A class deriving from both therefore overrides the two with one body, which is what IOBPreallocMemStream and IOBStream do.

Constructor & Destructor Documentation

◆ ~IBStream()

virtual IBStream::~IBStream ( )
inlinevirtual

Close the stream.

Vtable slot 8, which is the last of the interface rather than the first, because the destructor is declared after the transfer virtuals. Every implementation supplies a body and none calls a base body, so the body here is empty and was inlined.

Member Function Documentation

◆ Read()

virtual IBStream & IBStream::Read ( void * pDest,
int nSize )
pure virtual

Move nSize bytes into pDest.

Vtable slot 1. A short transfer is clamped rather than reported through the return value.

Parameters
pDestThe destination buffer.
nSizeThe number of bytes to move.
Returns
This stream.

Implemented in IBFileStream, IOBMemStream, and IOBPreallocMemStream.

◆ Seek()

virtual IBStream & IBStream::Seek ( int nOffset,
int nWhence )
pure virtual

Move the read position.

Vtable slot 2. An origin outside 0 to 2 returns with no change.

Parameters
nOffsetThe signed distance to move.
nWhenceThe origin, one of the StreamSeekOrigin values.
Returns
This stream.

Implemented in IBFileStream, IOBMemStream, and IOBPreallocMemStream.

◆ Tell()

virtual int IBStream::Tell ( )
pure virtual

Report the read position.

Vtable slot 3.

Returns
The position in bytes from the start.

Implemented in IBFileStream, IOBMemStream, and IOBPreallocMemStream.

◆ Eof()

virtual int IBStream::Eof ( )
pure virtual

Test whether the read position has arrived at the end of the data.

Vtable slot 4.

Returns
Non-zero at the end.

Implemented in IBFileStream, IOBMemStream, and IOBPreallocMemStream.

◆ Fail()

virtual int IBStream::Fail ( )
pure virtual

Test whether a transfer has failed.

Vtable slot 5.

Returns
Non-zero once a transfer has failed.

Implemented in IBFileStream, IOBMemStream, and IOBPreallocMemStream.

◆ ReadLE()

virtual IBStream & IBStream::ReadLE ( void * pDest,
int nSize )
virtual

Move nSize bytes into pDest through the virtual Read().

Vtable slot 6. One shared body serves all three implementations and none overrides it. The body does not swap bytes.

Parameters
pDestThe destination buffer.
nSizeThe number of bytes to move.
Returns
This stream.
Ghidra address:
NTSC-U/C: 0x004ed838
Ghidra address:
PAL: 0x0052c3e0

◆ Flush()

virtual IBStream & IBStream::Flush ( )
pure virtual

Service the underlying transport.

Vtable slot 7. Every implementation returns the stream with no effect, and each supplies its own trivial body rather than sharing one, which is why the slot is pure here. The title is inferred from the position and from the shape. OBStream declares a separate slot with the same shape, and the two cannot share a title, because the return types differ.

Returns
This stream.

Implemented in IBFileStream, IOBMemStream, and IOBPreallocMemStream.


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