function lfds711_ringbuffer_write
Jump to navigation
Jump to search
Source Files
└───liblfds711 ├───inc │ └───liblfds711 │ lfds711_ringbuffer.h └───src └───lfds711_ringbuffer lfds711_ringbuffer_write.c
Opaque Structures
struct lfds711_ringbuffer_state;
Prototype
void lfds711_ringbuffer_write( struct lfds711_ringbuffer_state *rs, void *key, void *value, enum lfds711_liblfds_flag *overwrite_occurred_flag, void **overwritten_key, void **overwritten_value );
Parameters
struct lfds711_ringbuffer_state *rs
- A pointer to an initialized struct lfds711_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 lfds711_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 LFDS711_RAISED' otherwise it is set to LFDS711_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 LFDS711_RAISED and *overwritten_key and *overwritten_value are set to the key and value in the overwritten element.