55 #if !defined(__AMXC_RBUFFER_H__)
56 #define __AMXC_RBUFFER_H__
257 const char*
const buf,
Ambiorix array API header file.
size_t amxc_rbuffer_size(const amxc_rbuffer_t *const rb)
Get the size of the data stored in the ring buffer.
int amxc_rbuffer_shrink(amxc_rbuffer_t *const rb, const size_t size)
Shrinks the ring buffer.
void amxc_rbuffer_clean(amxc_rbuffer_t *const rb)
Frees the buffer and sets all pointers of the ring buffer structure to NULL.
struct _amxc_rbuffer amxc_rbuffer_t
The ring buffer structure.
ssize_t amxc_rbuffer_write(amxc_rbuffer_t *const rb, const char *const buf, const size_t count)
Writes a number of bytes to the ring buffer.
int amxc_rbuffer_new(amxc_rbuffer_t **rb, const size_t size)
Allocates a ring buffer.
int amxc_rbuffer_grow(amxc_rbuffer_t *const rb, const size_t size)
Grows the ring buffer.
AMXC_INLINE size_t amxc_rbuffer_capacity(const amxc_rbuffer_t *const rb)
Get the capacity of the ring buffer.
void amxc_rbuffer_delete(amxc_rbuffer_t **rb)
Frees the previously allocated ring buffer.
AMXC_INLINE bool amxc_rbuffer_is_empty(const amxc_rbuffer_t *const rb)
Checks that the ring buffer is empty.
int amxc_rbuffer_init(amxc_rbuffer_t *const rb, const size_t size)
Initializes a ring buffer.
ssize_t amxc_rbuffer_read(amxc_rbuffer_t *const rb, char *const buf, size_t count)
Reads a number of bytes from the ring buffer.
The ring buffer structure.