Contiki-NG
|
Header file for the ringbufindex libraryMore...
#include "contiki.h"
Go to the source code of this file.
Functions | |
void | ringbufindex_init (struct ringbufindex *r, uint8_t size) |
Initialize a ring buffer. More... | |
int | ringbufindex_put (struct ringbufindex *r) |
Put one element to the ring buffer. More... | |
int | ringbufindex_peek_put (const struct ringbufindex *r) |
Check if there is space to put an element. More... | |
int | ringbufindex_get (struct ringbufindex *r) |
Remove the first element and return its index. More... | |
int | ringbufindex_peek_get (const struct ringbufindex *r) |
Return the index of the first element which will be removed if calling ringbufindex_get. More... | |
int | ringbufindex_size (const struct ringbufindex *r) |
Return the ring buffer size. More... | |
int | ringbufindex_elements (const struct ringbufindex *r) |
Return the number of elements currently in the ring buffer. More... | |
int | ringbufindex_full (const struct ringbufindex *r) |
Is the ring buffer full? More... | |
int | ringbufindex_empty (const struct ringbufindex *r) |
Is the ring buffer empty? More... | |
Header file for the ringbufindex library
Definition in file ringbufindex.h.
int ringbufindex_elements | ( | const struct ringbufindex * | r | ) |
Return the number of elements currently in the ring buffer.
r | Pinter to ringbufindex |
Definition at line 134 of file ringbufindex.c.
Referenced by ringbufindex_empty().
int ringbufindex_empty | ( | const struct ringbufindex * | r | ) |
Is the ring buffer empty?
0 | Not empty |
1 | Empty |
Definition at line 146 of file ringbufindex.c.
References ringbufindex_elements().
int ringbufindex_full | ( | const struct ringbufindex * | r | ) |
Is the ring buffer full?
0 | Not full |
1 | Full |
Definition at line 140 of file ringbufindex.c.
int ringbufindex_get | ( | struct ringbufindex * | r | ) |
Remove the first element and return its index.
r | Pinter to ringbufindex |
>= | 0 The index of the first element |
-1 | No element in the ring buffer |
Definition at line 90 of file ringbufindex.c.
void ringbufindex_init | ( | struct ringbufindex * | r, |
uint8_t | size | ||
) |
Initialize a ring buffer.
The size must be a power of two
r | Pointer to ringbufindex |
size | Size of ring buffer |
Definition at line 50 of file ringbufindex.c.
int ringbufindex_peek_get | ( | const struct ringbufindex * | r | ) |
Return the index of the first element which will be removed if calling ringbufindex_get.
r | Pinter to ringbufindex |
>= | 0 The index of the first element |
-1 | No element in the ring buffer |
Definition at line 115 of file ringbufindex.c.
int ringbufindex_peek_put | ( | const struct ringbufindex * | r | ) |
Check if there is space to put an element.
r | Pinter to ringbufindex |
>= | 0 The index where the next element is to be added. |
-1 | Failure; the ring buffer is full |
Definition at line 78 of file ringbufindex.c.
int ringbufindex_put | ( | struct ringbufindex * | r | ) |
Put one element to the ring buffer.
r | Pointer to ringbufindex |
0 | Failure; the ring buffer is full |
1 | Success; an element is added |
Definition at line 58 of file ringbufindex.c.
int ringbufindex_size | ( | const struct ringbufindex * | r | ) |
Return the ring buffer size.
r | Pinter to ringbufindex |
Definition at line 128 of file ringbufindex.c.