NUGU SDK Linux  1.7.6
RingBuffer

RingBuffer manipulation functions. More...

+ Collaboration diagram for RingBuffer:

Typedefs

typedef struct _nugu_ring_buffer NuguRingBuffer
 RingBuffer object.
 

Functions

NUGU_API void nugu_ring_buffer_clear_items (NuguRingBuffer *buf)
 Clear the ringbuffer. More...
 
NUGU_API void nugu_ring_buffer_free (NuguRingBuffer *buf)
 Destroy the ringbuffer object. More...
 
NUGU_API int nugu_ring_buffer_get_count (NuguRingBuffer *buf)
 Get count. More...
 
NUGU_API int nugu_ring_buffer_get_item_size (NuguRingBuffer *buf)
 Get itemsize. More...
 
NUGU_API int nugu_ring_buffer_get_maxcount (NuguRingBuffer *buf)
 Get maxcount. More...
 
NUGU_API NuguRingBuffernugu_ring_buffer_new (int item_size, int max_items)
 Create new ringbuffer object. More...
 
NUGU_API int nugu_ring_buffer_push_data (NuguRingBuffer *buf, const char *data, int size)
 Push data to ringbuffer. More...
 
NUGU_API int nugu_ring_buffer_read_item (NuguRingBuffer *buf, char *item, int *size)
 Read item from ringbuffer. More...
 
NUGU_API int nugu_ring_buffer_resize (NuguRingBuffer *buf, int item_size, int max_items)
 Resize the ringbuffer. More...
 

Detailed Description

RingBuffer manipulation functions.

The ring buffer manages items by setting the size and number of items as a basic unit.

Function Documentation

◆ nugu_ring_buffer_new()

NUGU_API NuguRingBuffer* nugu_ring_buffer_new ( int  item_size,
int  max_items 
)

Create new ringbuffer object.

Parameters
[in]item_sizedefault item size
[in]max_itemscount of items
Returns
ringbuffer object

◆ nugu_ring_buffer_free()

NUGU_API void nugu_ring_buffer_free ( NuguRingBuffer buf)

Destroy the ringbuffer object.

Parameters
[in]bufringbuffer object

◆ nugu_ring_buffer_resize()

NUGU_API int nugu_ring_buffer_resize ( NuguRingBuffer buf,
int  item_size,
int  max_items 
)

Resize the ringbuffer.

Parameters
[in]bufringbuffer object
[in]item_sizedefault item size
[in]max_itemscount of items
Returns
result
Return values
0success
-1failure

◆ nugu_ring_buffer_push_data()

NUGU_API int nugu_ring_buffer_push_data ( NuguRingBuffer buf,
const char *  data,
int  size 
)

Push data to ringbuffer.

Parameters
[in]bufringbuffer object
[in]datadata
[in]sizesize of data
Returns
result
Return values
0success
-1failure

◆ nugu_ring_buffer_read_item()

NUGU_API int nugu_ring_buffer_read_item ( NuguRingBuffer buf,
char *  item,
int *  size 
)

Read item from ringbuffer.

Parameters
[in]bufringbuffer object
[out]itemitem
[out]sizesize of item
Returns
result
Return values
0success
-1failure

◆ nugu_ring_buffer_get_count()

NUGU_API int nugu_ring_buffer_get_count ( NuguRingBuffer buf)

Get count.

Parameters
[in]bufringbuffer object
Returns
result
Return values
>0success (count)
-1failure

◆ nugu_ring_buffer_get_item_size()

NUGU_API int nugu_ring_buffer_get_item_size ( NuguRingBuffer buf)

Get itemsize.

Parameters
[in]bufringbuffer object
Returns
result
Return values
>0success (itemsize)
-1failure

◆ nugu_ring_buffer_get_maxcount()

NUGU_API int nugu_ring_buffer_get_maxcount ( NuguRingBuffer buf)

Get maxcount.

Parameters
[in]bufringbuffer object
Returns
result
Return values
>0success (max count)
-1failure

◆ nugu_ring_buffer_clear_items()

NUGU_API void nugu_ring_buffer_clear_items ( NuguRingBuffer buf)

Clear the ringbuffer.

Parameters
[in]bufringbuffer object