stream_helper
stream_helper is a helper object that grants the mwx::stream
interface. It creates a helper object that references a data class and performs data input/output via the helper object.
The following creates a helper object bs
from an array b
of smplbufs and inputs data using the mwx::stream::operator <<()
operator.
Overview
stream_helper behaves as if the data array were a stream.
Internally, it holds read/write positions in the data array. It behaves as follows.
After the last data is read or written, it moves to the next read/write position.
After the last data is read or data is appended to the end, the read/write position becomes the end.
If the read/write position is the end of the line, then
available()
becomesfalse
.Read cannot be performed.
Writing is appended if it is within the writable range.
generating stream_helper
stream_helper is a data class (smplbuf, EEPROM) member functions.
methods
rewind()
Moves the read/write position to the beginning.
seek()
Set the read/write position.
whence | Set the location |
---|---|
| set from the leading position. If |
| Move by |
| end position. Setting |
tell()
Returns the read/write position. Returns -1
for the end position.
available()
Returns 0
if the read/write position is the end. If it is not the end, it returns any other value.
最終更新