![]() |
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | as_queue |
Macros | |
#define | as_queue_inita(__q, __item_size, __capacity) |
Functions | |
as_queue * | as_queue_create (uint32_t item_size, uint32_t capacity) |
void | as_queue_destroy (as_queue *queue) |
static bool | as_queue_empty (as_queue *queue) |
bool | as_queue_init (as_queue *queue, uint32_t item_size, uint32_t capacity) |
bool | as_queue_pop (as_queue *queue, void *ptr) |
bool | as_queue_push (as_queue *queue, const void *ptr) |
bool | as_queue_push_head (as_queue *queue, const void *ptr) |
bool | as_queue_push_limit (as_queue *queue, const void *ptr) |
static uint32_t | as_queue_size (as_queue *queue) |
#define as_queue_inita | ( | __q, | |
__item_size, | |||
__capacity | |||
) |
Initialize a stack allocated as_queue, with item storage on the stack. as_queue_inita() will transfer stack memory to the heap if a resize is required.
Definition at line 76 of file as_queue.h.
as_queue* as_queue_create | ( | uint32_t | item_size, |
uint32_t | capacity | ||
) |
Create a heap allocated as_queue, with item storage on the heap.
void as_queue_destroy | ( | as_queue * | queue | ) |
Release queue memory.
|
inlinestatic |
Is queue empty?
Definition at line 118 of file as_queue.h.
References as_queue::head, and as_queue::tail.
bool as_queue_init | ( | as_queue * | queue, |
uint32_t | item_size, | ||
uint32_t | capacity | ||
) |
Initialize a stack allocated as_queue, with item storage on the heap.
bool as_queue_pop | ( | as_queue * | queue, |
void * | ptr | ||
) |
Pop from the head of the queue.
bool as_queue_push | ( | as_queue * | queue, |
const void * | ptr | ||
) |
Push to the tail of the queue.
bool as_queue_push_head | ( | as_queue * | queue, |
const void * | ptr | ||
) |
Push to the front of the queue.
bool as_queue_push_limit | ( | as_queue * | queue, |
const void * | ptr | ||
) |
Push element on the queue only if size < capacity.
|
inlinestatic |
Get the number of elements currently in the queue.
Definition at line 109 of file as_queue.h.
References as_queue::head, and as_queue::tail.