|
truck-code
|
#include <buffer.h>
Public Member Functions | |
| void | init (int max_data, int item_size) |
| int | get_circular_index () |
| int | empty () |
| void | add (void *new_msg) |
| void * | read_first () |
| void * | pop_first () |
| int | get_count () |
Circular buffer type used with data item saving.
Data from last "data_size" samples can be saved in this structure.
| void CircularBuffer::add | ( | void * | new_msg | ) |
Add a new message to the message buffer.
| new_mg | the new message that should be added to the buffer |
| int CircularBuffer::empty | ( | ) |
Remove all elements from the circular buffer.
Used to throw out buffered input when a receiver first connects to the driver.
| int CircularBuffer::get_circular_index | ( | ) |
Return the index of the most recent element to be added the buffer.
This method also increments the value of data_start in the buffer. This is used to get the index of insertion into the circular buffer's data array.
| int CircularBuffer::get_count | ( | ) |
Return the number of elements in the buffer.
| void CircularBuffer::init | ( | int | max_data, |
| int | item_size | ||
| ) |
Initialize the circular buffer.
This method is used to set up buffer of items of a type defined by call program. sizeof(the_type_name) is used for the item_size parameter. The most recent max_data items will be saved.
| max_data | maximum number of elements that can be stored in the buffer |
| item_size | size of a single element in data_array |
| void * CircularBuffer::pop_first | ( | ) |
Pop the first element from the the message buffer.
| void * CircularBuffer::read_first | ( | ) |
Read the first element from the the message buffer.
1.8.13