Circular buffer object for storing and retrieving samples in a first-in/first-out (FIFO) manner using a minimal amount of memory
Public Functions
cbuffercf | cbuffercf_create( |
cbuffercf | cbuffercf_create_max( |
cbuffercf | cbuffercf_copy( |
int | cbuffercf_destroy( |
int | cbuffercf_print( |
int | cbuffercf_reset( |
unsigned int | cbuffercf_size( |
unsigned int | cbuffercf_max_size( |
unsigned int | cbuffercf_max_read( |
unsigned int | cbuffercf_space_available( |
int | cbuffercf_is_empty( |
int | cbuffercf_is_full( |
int | cbuffercf_push( |
int | cbuffercf_write( |
int | cbuffercf_pop( |
int | cbuffercf_read( |
int | cbuffercf_release( |
Interfaces
cbuffercf cbuffercf_create(
Create circular buffer object of a particular maximum storage length
- _max_size : maximum buffer size, 0 < _max_size
cbuffercf cbuffercf_create_max(
Create circular buffer object of a particular maximum storage size and specify the maximum number of elements that can be read at any any given time
- _max_size : maximum buffer size, 0 < _max_size
- _max_read : maximum size that will be read from buffer
cbuffercf cbuffercf_copy(
Copy object including all internal objects and state
int cbuffercf_destroy(
Destroy cbuffer object, freeing all internal memory
int cbuffercf_print(
Print cbuffer object properties to stdout
int cbuffercf_reset(
Clear internal buffer
unsigned int cbuffercf_size(
Get the number of elements currently in the buffer
unsigned int cbuffercf_max_size(
Get the maximum number of elements the buffer can hold
unsigned int cbuffercf_max_read(
Get the maximum number of elements you may read at once
unsigned int cbuffercf_space_available(
Get the number of available slots (max_size - size)
int cbuffercf_is_empty(
Return flag indicating if the buffer is empty or not
int cbuffercf_is_full(
Return flag indicating if the buffer is full or not
int cbuffercf_push(
Write a single sample into the buffer
- _q : circular buffer object
- _v : input sample
int cbuffercf_write(
Write a block of samples to the buffer
- _q : circular buffer object
- _v : array of samples to write to buffer
- _n : number of samples to write
int cbuffercf_pop(
Remove and return a single element from the buffer by setting the value of the output sample pointed to by _v
- _q : circular buffer object
- _v : pointer to sample output
int cbuffercf_read(
Read buffer contents by returning a pointer to the linearized array; note that the returned pointer is only valid until another operation is performed on the circular buffer object
- _q : circular buffer object
- _num_requested : number of elements requested
- _v : output pointer
- _num_read : number of elements referenced by _v
int cbuffercf_release(
Release _n samples from the buffer
- _q : circular buffer object
- _n : number of elements to release