|
resonance 1.0.1
|
Output half of the byte stream interface. More...
#include <obstream.h>

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(). | |
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.
|
pure virtual |
Move nSize bytes out of pSrc.
Vtable slot 1.
| pSrc | The source buffer. |
| nSize | The number of bytes to move. |
Implemented in IOBMemStream, IOBPreallocMemStream, and OBFileStream.
|
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.
Implemented in IOBMemStream, IOBPreallocMemStream, and OBFileStream.
|
pure virtual |
Test whether a transfer has failed.
Vtable slot 3.
Implemented in IOBMemStream, IOBPreallocMemStream, and OBFileStream.
|
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.
| pSrc | The source buffer. |
| nSize | The number of bytes to move. |