cdcontainers
0.1.1
Library of data containers and collections for C programming language.
|
The cdc_deque is a struct and functions that provide a double-ended queue. More...
#include <cdcontainers/common.h>
#include <cdcontainers/status.h>
#include <cdcontainers/tables/isequence.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_deque |
The cdc_deque struct. More... | |
Functions | |
enum cdc_stat | cdc_deque_ctor (const struct cdc_sequence_table *table, struct cdc_deque **d, struct cdc_data_info *info) |
Constructs an empty deque. More... | |
enum cdc_stat | cdc_deque_ctorl (const struct cdc_sequence_table *table, struct cdc_deque **d, struct cdc_data_info *info,...) |
Constructs a deque, initialized by an arbitrary number of pointers. The last item must be NULL. More... | |
enum cdc_stat | cdc_deque_ctorv (const struct cdc_sequence_table *table, struct cdc_deque **d, struct cdc_data_info *info, va_list args) |
Constructs a deque, initialized by args. The last item must be NULL. More... | |
void | cdc_deque_dtor (struct cdc_deque *d) |
Destroys the deque. More... | |
static void * | cdc_deque_get (struct cdc_deque *d, size_t index) |
Returns the item at index position index in the deque. Index must be a valid index position in the deque. More... | |
static void * | cdc_deque_front (struct cdc_deque *d) |
Returns a pointer to the first item in the deque. This function assumes that the deque isn't empty. More... | |
static void * | cdc_deque_back (struct cdc_deque *d) |
Returns a pointer to the last item in the deque. This function assumes that the deque isn't empty. More... | |
static bool | cdc_deque_empty (struct cdc_deque *d) |
Returns true if the deque has size 0; otherwise returns false. More... | |
static size_t | cdc_deque_size (struct cdc_deque *d) |
Returns the number of items in the deque. More... | |
static void | cdc_deque_set (struct cdc_deque *d, size_t index, void *value) |
Sets the deque at index position to the value. The function is not called to free memory. More... | |
static enum cdc_stat | cdc_deque_insert (struct cdc_deque *d, size_t index, void *value) |
Inserts value at index position in the deque. If index is 0, the value is prepended to the deque. If index is cdc_deque_size(), the value is appended to the deque. More... | |
static void | cdc_deque_erase (struct cdc_deque *d, size_t index) |
Removes the element at index position. Index must be a valid index position in the deque. More... | |
static void | cdc_deque_clear (struct cdc_deque *d) |
Removes all the elements from the deque. More... | |
static enum cdc_stat | cdc_deque_push_back (struct cdc_deque *d, void *value) |
Inserts value at the end of the deque. More... | |
static void | cdc_deque_pop_back (struct cdc_deque *d) |
Removes the last item in the deque. More... | |
static enum cdc_stat | cdc_deque_push_front (struct cdc_deque *d, void *value) |
Inserts value at the beginning of the deque. More... | |
static void | cdc_deque_pop_front (struct cdc_deque *d) |
Removes the first item in the deque. More... | |
void | cdc_deque_swap (struct cdc_deque *a, struct cdc_deque *b) |
Swaps deques a and b. This operation is very fast and never fails. More... | |
The cdc_deque is a struct and functions that provide a double-ended queue.