cdcontainers
0.1.1
Library of data containers and collections for C programming language.
|
The cdc_circular_array is a struct and functions that provide a circular array. More...
#include <cdcontainers/common.h>
#include <cdcontainers/status.h>
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | cdc_circular_array |
The cdc_circular_array is service struct. More... | |
Functions | |
enum cdc_stat | cdc_circular_array_ctor (struct cdc_circular_array **d, struct cdc_data_info *info) |
Constructs an empty circular array. More... | |
enum cdc_stat | cdc_circular_array_ctorl (struct cdc_circular_array **d, struct cdc_data_info *info,...) |
Constructs a circular array, initialized by an variable number of pointers. The last pointer must be CDC_END. More... | |
enum cdc_stat | cdc_circular_array_ctorv (struct cdc_circular_array **d, struct cdc_data_info *info, va_list args) |
Constructs a circular array, initialized by args. The last pointer must be CDC_END. More... | |
void | cdc_circular_array_dtor (struct cdc_circular_array *d) |
Destroys the circular array. More... | |
static void * | cdc_circular_array_get (struct cdc_circular_array *d, size_t index) |
Returns an element at index position in the circular array. More... | |
enum cdc_stat | cdc_circular_array_at (struct cdc_circular_array *d, size_t index, void **elem) |
Writes to pointer an element from specified position in the circular array. Bounds checking is performed. More... | |
static void * | cdc_circular_array_front (struct cdc_circular_array *d) |
Returns a first element in the circular array. More... | |
static void * | cdc_circular_array_back (struct cdc_circular_array *d) |
Returns a last element in the circular array. More... | |
static bool | cdc_circular_array_empty (struct cdc_circular_array *d) |
Checks if the circular array has no elements. More... | |
static size_t | cdc_circular_array_size (struct cdc_circular_array *d) |
Returns the number of elements in the circular array. More... | |
static void | cdc_circular_array_set (struct cdc_circular_array *d, size_t index, void *value) |
Sets an element at index position to the value. The function is not called to free memory. More... | |
enum cdc_stat | cdc_circular_array_insert (struct cdc_circular_array *d, size_t index, void *value) |
Inserts value at |index| position in the circular array. If index is 0, the value is prepended to the circular array. If index is cdc_circular_array_size(), the value is appended to the circular array. More... | |
void | cdc_circular_array_erase (struct cdc_circular_array *d, size_t index) |
Removes an element at index position in the circular arrray. More... | |
void | cdc_circular_array_clear (struct cdc_circular_array *d) |
Removes all the elements from the circular array. More... | |
enum cdc_stat | cdc_circular_array_push_back (struct cdc_circular_array *d, void *value) |
Inserts an element at the end of the circular array. More... | |
void | cdc_circular_array_pop_back (struct cdc_circular_array *d) |
Removes a last element in the circular array. More... | |
enum cdc_stat | cdc_circular_array_push_front (struct cdc_circular_array *d, void *value) |
Inserts an element at the beginning of the circular array. More... | |
void | cdc_circular_array_pop_front (struct cdc_circular_array *d) |
Removes a first element in the circular array. More... | |
void | cdc_circular_array_swap (struct cdc_circular_array *a, struct cdc_circular_array *b) |
Swaps circular arrays a and b. This operation is very fast and never fails. More... | |
The cdc_circular_array is a struct and functions that provide a circular array.