Go to the source code of this file.
Functions | |
cyclic_buffer | create_cyclic_buffer (unsigned long size) |
Create a new cyclic buffer. | |
void | destroy_cyclic_buffer (cyclic_buffer buffer) |
Destroy a cyclic buffer (free all allocated memory). | |
void * | cyclic_buffer_add_element (cyclic_buffer buffer, void *element, unsigned element_size) |
Add a new element to the cyclic buffer. | |
void | rewind_cyclic_buffer (cyclic_buffer buffer) |
Reset the current buffer's pointer (used to extract element from the buffer). | |
void * | cyclic_buffer_get_element (cyclic_buffer buffer) |
Returns the current element of the cyclic buffer. | |
unsigned long | cyclic_buffer_get_start (cyclic_buffer buffer) |
Return the index of the first element in the buffer. | |
unsigned long | cyclic_buffer_get_stop (cyclic_buffer buffer) |
Return the index of the last element in the buffer. | |
unsigned long | cyclic_buffer_get_current_size (cyclic_buffer buffer) |
Return the number of elements in the cyclic buffer. |
Definition in file cyclic_buffer.c.
|
Create a new cyclic buffer.
Definition at line 15 of file cyclic_buffer.c. References s_cyclic_buffer::buffer, s_cyclic_buffer::current, s_cyclic_buffer::current_size, s_cyclic_buffer::n, s_cyclic_buffer::size, s_cyclic_buffer::start, and s_cyclic_buffer::stop. |
|
Add a new element to the cyclic buffer.
Definition at line 87 of file cyclic_buffer.c. References s_cyclic_buffer::buffer, s_cyclic_buffer::current_size, s_cyclic_buffer::size, s_cyclic_buffer::start, and s_cyclic_buffer::stop. |
|
Return the number of elements in the cyclic buffer.
Definition at line 201 of file cyclic_buffer.c. References s_cyclic_buffer::current_size. |
|
Returns the current element of the cyclic buffer.
Definition at line 157 of file cyclic_buffer.c. References s_cyclic_buffer::buffer, s_cyclic_buffer::current, s_cyclic_buffer::current_size, s_cyclic_buffer::n, and s_cyclic_buffer::size. |
|
Return the index of the first element in the buffer.
Definition at line 179 of file cyclic_buffer.c. References s_cyclic_buffer::start. |
|
Return the index of the last element in the buffer.
Definition at line 190 of file cyclic_buffer.c. References s_cyclic_buffer::stop. |
|
Destroy a cyclic buffer (free all allocated memory).
Definition at line 57 of file cyclic_buffer.c. References s_cyclic_buffer::buffer, and s_cyclic_buffer::size. |
|
Reset the current buffer's pointer (used to extract element from the buffer).
Definition at line 140 of file cyclic_buffer.c. References s_cyclic_buffer::current, s_cyclic_buffer::n, and s_cyclic_buffer::start. |