function lfds710_ringbuffer_write
Jump to navigation
Jump to search
Source Files
└───liblfds710 ├───inc │ └───liblfds710 │ lfds710_ringbuffer.h └───src └───lfds710_ringbuffer lfds710_ringbuffer_write.c
Opaque Structures
struct lfds710_ringbuffer_state;
Prototype
void lfds710_ringbuffer_write( struct lfds710_ringbuffer_state *rs, void *key, void *value, enum lfds710_liblfds_flag *overwrite_occurred_flag, void **overwritten_key, void **overwritten_value );
Parameters
struct lfds710_ringbuffer_state *rs
- A pointer to an initialized struct lfds710_ringbuffer_state.
void *key
- A void pointer which is written into the ringbuffer as the key. If the ringbuffer is full, the oldest unread element is overwritten.
void *value
- A void pointer which is written into the ringbuffer as the value. If the ringbuffer is full, the oldest unread element is overwritten.
enum lfds710_flag *overwrite_occurred_flag
- If this argument is non-NULL, then if the ringbuffer was full and the oldest unread element overwritten, '*overwrite_occurred_flag is set to LFDS710_RAISED' otherwise it is set to LFDS710_LOWERED'.
void **overwritten_key
- If this argument is non-NULL, and if the ringbuffer was full and so the oldest unread element was overwritten, '*overwritten_value is set to the key present in the overwritten element.
void **overwritten_value
- If this argument is non-NULL, and if the ringbuffer was full and so the oldest unread element was overwritten, '*overwritten_value is set to the value present in the overwritten element.
Notes
This function writes a key/value pair into the ringbuffer. If the ringbuffer is full, the oldest unread element is overwritten and, if they are provided (rather than being NULL), *overwrite_occurred_flag is set to LFDS710_RAISED and *overwritten_key and *overwritten_value are set to the key and value in the overwritten element.