Appearance
class flake::Stream
Byte-oriented read/write stream associated with an Object property. More...
#include <platform/flake/Object.h>
Public Functions
| Name | |
|---|---|
| Stream(const Stream & ) =deleted | |
| Stream & | operator=(const Stream & ) =deleted |
| Stream(Stream && ) =deleted | |
| Stream & | operator=(Stream && ) =deleted |
| virtual int | write(uint8_t data[], unsigned int len) =0 Write data into the stream. |
| virtual int | read(uint8_t * data, unsigned int * len, unsigned int max_len) =0 Read data from the stream. |
| virtual int | seek(unsigned int pos) =0 Seek to an absolute position in the stream. |
| virtual unsigned int | pos() =0 Current read/write position in the stream. |
| virtual int | close() =0 Close the stream and release associated resources. |
| virtual uint32_t | streamId() =0 Unique identifier of this stream. |
Protected Functions
| Name | |
|---|---|
| Stream() =default | |
| ~Stream() =default |
Public Attributes
| Name | |
|---|---|
| constexpr uint8_t | FLAG_LIVE Flag: the stream is live (data is pushed as it arrives). |
Detailed Description
cpp
class flake::Stream;Byte-oriented read/write stream associated with an Object property.
Note: Non-copyable, non-movable.
Open a stream via Object::openProperty() on a property whose tag type is TT_STRING_STREAM or TT_BIN_STREAM.
Public Functions Documentation
function Stream
cpp
Stream(
const Stream &
) =deletedfunction operator=
cpp
Stream & operator=(
const Stream &
) =deletedfunction Stream
cpp
Stream(
Stream &&
) =deletedfunction operator=
cpp
Stream & operator=(
Stream &&
) =deletedfunction write
cpp
virtual int write(
uint8_t data[],
unsigned int len
) =0Write data into the stream.
Parameters:
- data Buffer containing the bytes to write.
- len Number of bytes to write.
Return: E_OK on success, or a negative error code.
function read
cpp
virtual int read(
uint8_t * data,
unsigned int * len,
unsigned int max_len
) =0Read data from the stream.
Parameters:
- data Destination buffer.
- len Receives the number of bytes actually read.
- max_len Capacity of
datain bytes.
Return: E_OK on success, E_EOF at end of stream, or a negative error code.
function seek
cpp
virtual int seek(
unsigned int pos
) =0Seek to an absolute position in the stream.
Parameters:
- pos Target byte offset from the beginning of the stream.
Return: E_OK on success, or a negative error code.
function pos
cpp
virtual unsigned int pos() =0Current read/write position in the stream.
Return: Byte offset from the beginning.
function close
cpp
virtual int close() =0Close the stream and release associated resources.
Return: E_OK on success, or a negative error code.
function streamId
cpp
virtual uint32_t streamId() =0Unique identifier of this stream.
Return: The stream ID.
Protected Functions Documentation
function Stream
cpp
Stream() =defaultfunction ~Stream
cpp
~Stream() =defaultPublic Attributes Documentation
variable FLAG_LIVE
cpp
static constexpr uint8_t flake::Stream::FLAG_LIVEFlag: the stream is live (data is pushed as it arrives).