3.12.2. Buffer stream

Stream based on vbuffer.

Functions

bool vbuffer_stream_init(struct vbuffer_stream * stream, void(*)(void *) userdata_cleanup)

Initialize a new stream.

void vbuffer_stream_clear(struct vbuffer_stream * stream)

Clear a stream.

bool vbuffer_stream_push(struct vbuffer_stream * stream, struct vbuffer * buffer, void * userdata, struct vbuffer_iterator * current)

Push some data in the stream. Fill the iterator current with the position right before the data just added.

void vbuffer_stream_finish(struct vbuffer_stream * stream)

Finish the stream and mark the end as the eof. It is not possible to push any more data after calling this function.

bool vbuffer_stream_isfinished(struct vbuffer_stream * stream)

Check if the stream has been finished.

bool vbuffer_stream_pop(struct vbuffer_stream * stream, struct vbuffer * buffer, void ** userdata)

Get some data out of the stream. The data are only extracted if no mark have been inserted in the buffer. Otherwise, the mark will need to be removed before calling this function again.

struct vbuffer * vbuffer_stream_data(struct vbuffer_stream * stream)

Get the buffer inside the stream.

class vbuffer_stream

Stream based on vbuffer. This object will create a view of the data as a continuous buffer thanks to vbuffer.

Private Members

struct lua_object lua_object

struct vbuffer data

struct list2 chunks

struct list2 read_chunks

void(* userdata_cleanup)(void *)

3.12.3. Sub buffer stream

Sub buffer stream.

Functions

bool vbuffer_sub_stream_init(struct vbuffer_sub_stream * stream)

Initialize a sub buffer stream.

bool vbuffer_sub_stream_push(struct vbuffer_sub_stream * stream, struct vbuffer_sub * buffer, struct vbuffer_iterator * current)

Push some data into the stream. The data are selected using vbuffer_select().

bool vbuffer_sub_stream_pop(struct vbuffer_sub_stream * stream, struct vbuffer_sub * sub)

Pop available data from the stream and automatically do a vbuffer_restore().

class vbuffer_sub_stream

Stream of sub buffer.

Private Members

struct vbuffer_stream stream