tuningfork:: ByteStream
#include <protobuf_nano_util.h>
A view on the bytes provided in vec
.
Summary
Write
will call realloc
if more bytes are needed and it is up to the caller to free the data allocated.
It is valid to set vec=nullptr
and size=0
, in which case vec
will be allocated using malloc
.
Public attributes |
|
---|---|
it
|
size_t
The current position in the stream while decoding or encoding.
|
size
|
size_t
The size of the bytes that are pointed by
vec . |
vec
|
uint8_t *
Pointer to the bytes represented by the stream.
|
Public static functions |
|
---|---|
Read(pb_istream_t *stream, uint8_t *buf, size_t count)
|
bool
Read
count bytes from the stream to the given buffer. |
Write(pb_ostream_t *stream, const uint8_t *buf, size_t count)
|
bool
Write
count bytes from the given buffer to the stream. |
Public attributes
it
size_t tuningfork::ByteStream::it
The current position in the stream while decoding or encoding.
size
size_t tuningfork::ByteStream::size
The size of the bytes that are pointed by vec
.
vec
uint8_t * tuningfork::ByteStream::vec
Pointer to the bytes represented by the stream.
Public static functions
Read
bool tuningfork::ByteStream::Read( pb_istream_t *stream, uint8_t *buf, size_t count )
Read count
bytes from the stream to the given buffer.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
true if successful, false on a read error.
|
Write
bool tuningfork::ByteStream::Write( pb_ostream_t *stream, const uint8_t *buf, size_t count )
Write count
bytes from the given buffer to the stream.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Returns |
true if successful, false on a write error.
|