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

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

#include <obstream.h>

Inheritance diagram for OBStream:

Public Member Functions

virtual OBStream & Write (const void *pSrc, int nSize)=0
 Move nSize bytes out of pSrc.
virtual OBStream & Reset ()=0
 Discard everything written so far.
virtual int Fail ()=0
 Test whether a transfer has failed.
virtual OBStream & WriteLE (const void *pSrc, int nSize)
 Move nSize bytes out of pSrc through the virtual Write().

Detailed Description

Output half of the byte stream interface.

Its RTTI descriptor is at 0x0086f5e8. 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. OBFileStream derives from this class alone, while IOBStream and IOBPreallocMemStream derive from IBStream at offset 0 and from this class at offset 4. The four slots below are the whole interface. Two independent measurements agree on the count: OBFileStream's table runs to slot 6 with its destructor at slot 5 and a new Tell() at slot 6, and the secondary tables of IOBMemStream and IOBPreallocMemStream both end after slot 4. There is therefore no virtual destructor on this side of a stream, and a bidirectional stream is destroyed through its IBStream subobject.

WriteLE() is the one slot with a shared base body. Both implementations of it retain the body, and it does nothing beyond dispatching Write(). The two entry points are therefore interchangeable on this target.

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

Member Function Documentation

◆ Write()

virtual OBStream & OBStream::Write ( const void * pSrc,
int nSize )
pure virtual

Move nSize bytes out of pSrc.

Vtable slot 1.

Parameters
pSrcThe source buffer.
nSizeThe number of bytes to move.
Returns
This stream.

Implemented in IOBMemStream, IOBPreallocMemStream, and OBFileStream.

◆ Reset()

virtual OBStream & OBStream::Reset ( )
pure virtual

Discard everything written so far.

Vtable slot 2. OBFileStream and IOBMemStream return the stream with no effect, and only IOBPreallocMemStream does work, where it zeroes both positions and both flags. The title is inferred from that one implementation. Flush() was rejected, because the file implementation would then be the one that does nothing while Rnd::FileStream::Flush() forwards to fflush.

Returns
This stream.

Implemented in IOBMemStream, IOBPreallocMemStream, and OBFileStream.

◆ Fail()

virtual int OBStream::Fail ( )
pure virtual

Test whether a transfer has failed.

Vtable slot 3.

Returns
Non-zero once a transfer has failed.

Implemented in IOBMemStream, IOBPreallocMemStream, and OBFileStream.

◆ WriteLE()

virtual OBStream & OBStream::WriteLE ( const void * pSrc,
int nSize )
virtual

Move nSize bytes out of pSrc through the virtual Write().

Vtable slot 4. One shared body serves both implementations and neither overrides it. The body does not swap bytes.

Parameters
pSrcThe source buffer.
nSizeThe number of bytes to move.
Returns
This stream.
Ghidra address:
NTSC-U/C: 0x004ed860
Ghidra address:
PAL: 0x0052c408

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