Loading...
Searching...
No Matches
Data Structures | Macros | Functions
as_queue.h File Reference
#include <aerospike/as_std.h>
#include <string.h>
+ Include dependency graph for as_queue.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  as_queue
 

Macros

#define as_queue_inita(__q, __item_size, __capacity)
 

Functions

AS_EXTERN as_queueas_queue_create (uint32_t item_size, uint32_t capacity)
 
static void as_queue_decr_total (as_queue *queue)
 
AS_EXTERN void as_queue_destroy (as_queue *queue)
 
static bool as_queue_empty (as_queue *queue)
 
static void * as_queue_get (as_queue *queue, uint32_t index)
 
static bool as_queue_incr_total (as_queue *queue)
 
AS_EXTERN bool as_queue_init (as_queue *queue, uint32_t item_size, uint32_t capacity)
 
static bool as_queue_pop (as_queue *queue, void *ptr)
 
static bool as_queue_pop_tail (as_queue *queue, void *ptr)
 
AS_EXTERN bool as_queue_push (as_queue *queue, const void *ptr)
 
AS_EXTERN bool as_queue_push_head (as_queue *queue, const void *ptr)
 
AS_EXTERN bool as_queue_push_head_limit (as_queue *queue, const void *ptr)
 
AS_EXTERN bool as_queue_push_limit (as_queue *queue, const void *ptr)
 
static uint32_t as_queue_size (as_queue *queue)
 

Macro Definition Documentation

◆ as_queue_inita

#define as_queue_inita ( __q,
__item_size,
__capacity )
Value:
(__q)->data = alloca((__capacity) * (__item_size));\
(__q)->capacity = __capacity;\
(__q)->head = (__q)->tail = 0;\
(__q)->item_size = __item_size;\
(__q)->total = 0;\
(__q)->flags = 0;
uint8_t data[0]
Definition as_proto.h:3

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 80 of file as_queue.h.

Function Documentation

◆ as_queue_create()

AS_EXTERN as_queue * as_queue_create ( uint32_t item_size,
uint32_t capacity )

Create a heap allocated as_queue, with item storage on the heap.

◆ as_queue_decr_total()

static void as_queue_decr_total ( as_queue * queue)
inlinestatic

Decrement total counter.

Definition at line 217 of file as_queue.h.

References as_queue::total.

◆ as_queue_destroy()

AS_EXTERN void as_queue_destroy ( as_queue * queue)

Release queue memory.

◆ as_queue_empty()

static bool as_queue_empty ( as_queue * queue)
inlinestatic

Is queue empty?

Definition at line 123 of file as_queue.h.

References as_queue::head, and as_queue::tail.

◆ as_queue_get()

static void * as_queue_get ( as_queue * queue,
uint32_t index )
inlinestatic

Get item at virtual index. For internal use only.

Definition at line 156 of file as_queue.h.

References as_queue::capacity, as_queue::data, and as_queue::item_size.

◆ as_queue_incr_total()

static bool as_queue_incr_total ( as_queue * queue)
inlinestatic

Increment total counter if within capacity.

Definition at line 204 of file as_queue.h.

References as_queue::capacity, and as_queue::total.

◆ as_queue_init()

AS_EXTERN 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.

◆ as_queue_pop()

static bool as_queue_pop ( as_queue * queue,
void * ptr )
inlinestatic

Pop item from the head of the queue.

Definition at line 165 of file as_queue.h.

References as_queue_empty(), as_queue_get(), as_queue::head, as_queue::item_size, and as_queue::tail.

◆ as_queue_pop_tail()

static bool as_queue_pop_tail ( as_queue * queue,
void * ptr )
inlinestatic

Pop item from the tail of the queue.

Definition at line 185 of file as_queue.h.

References as_queue_empty(), as_queue_get(), as_queue::head, as_queue::item_size, and as_queue::tail.

◆ as_queue_push()

AS_EXTERN bool as_queue_push ( as_queue * queue,
const void * ptr )

Push item to the tail of the queue.

◆ as_queue_push_head()

AS_EXTERN bool as_queue_push_head ( as_queue * queue,
const void * ptr )

Push item to the head of the queue.

◆ as_queue_push_head_limit()

AS_EXTERN bool as_queue_push_head_limit ( as_queue * queue,
const void * ptr )

Push item to the head of the queue only if size < capacity.

◆ as_queue_push_limit()

AS_EXTERN bool as_queue_push_limit ( as_queue * queue,
const void * ptr )

Push item to the tail of the queue only if size < capacity.

◆ as_queue_size()

static uint32_t as_queue_size ( as_queue * queue)
inlinestatic

Get the number of items currently in the queue.

Definition at line 114 of file as_queue.h.

References as_queue::head, and as_queue::tail.