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

Go to the source code of this file.

Data Structures

struct  as_vector
 

Macros

#define as_vector_inita(__vector, __item_size, __capacity)
 

Functions

static void as_vector_append (as_vector *vector, void *value)
 
AS_EXTERN bool as_vector_append_unique (as_vector *vector, void *value)
 
static void as_vector_clear (as_vector *vector)
 
AS_EXTERN as_vectoras_vector_create (uint32_t item_size, uint32_t capacity)
 
AS_EXTERN void as_vector_destroy (as_vector *vector)
 
static void * as_vector_get (as_vector *vector, uint32_t index)
 
static void * as_vector_get_ptr (as_vector *vector, uint32_t index)
 
AS_EXTERN void as_vector_increase_capacity (as_vector *vector)
 
AS_EXTERN void as_vector_init (as_vector *vector, uint32_t item_size, uint32_t capacity)
 
AS_EXTERN bool as_vector_remove (as_vector *vector, uint32_t index)
 
static void * as_vector_reserve (as_vector *vector)
 
static void as_vector_set (as_vector *vector, uint32_t index, void *value)
 
AS_EXTERN void * as_vector_to_array (as_vector *vector, uint32_t *size)
 

Macro Definition Documentation

◆ as_vector_inita

#define as_vector_inita ( __vector,
__item_size,
__capacity )
Value:
(__vector)->list = alloca((__capacity) * (__item_size));\
(__vector)->capacity = __capacity;\
(__vector)->item_size = __item_size;\
(__vector)->size = 0;\
(__vector)->flags = 0;

Initialize a stack allocated as_vector, with item storage on the stack. as_vector_inita() will transfer stack memory to the heap if a resize is required.

Definition at line 70 of file as_vector.h.

Function Documentation

◆ as_vector_append()

static void as_vector_append ( as_vector * vector,
void * value )
inlinestatic

Append item to vector.

Definition at line 145 of file as_vector.h.

References as_vector_increase_capacity(), as_vector::capacity, as_vector::item_size, as_vector::list, and as_vector::size.

◆ as_vector_append_unique()

AS_EXTERN bool as_vector_append_unique ( as_vector * vector,
void * value )

Append item to vector if it doesn't already exist.

◆ as_vector_clear()

static void as_vector_clear ( as_vector * vector)
inlinestatic

Empty vector without altering data.

Definition at line 103 of file as_vector.h.

References as_vector::size.

◆ as_vector_create()

AS_EXTERN as_vector * as_vector_create ( uint32_t item_size,
uint32_t capacity )

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

◆ as_vector_destroy()

AS_EXTERN void as_vector_destroy ( as_vector * vector)

Free vector.

◆ as_vector_get()

static void * as_vector_get ( as_vector * vector,
uint32_t index )
inlinestatic

Get pointer to item given index.

Definition at line 112 of file as_vector.h.

References as_vector::item_size, and as_vector::list.

◆ as_vector_get_ptr()

static void * as_vector_get_ptr ( as_vector * vector,
uint32_t index )
inlinestatic

Get pointer to item pointer given index.

Definition at line 121 of file as_vector.h.

References as_vector::item_size, and as_vector::list.

◆ as_vector_increase_capacity()

AS_EXTERN void as_vector_increase_capacity ( as_vector * vector)

Double vector capacity.

◆ as_vector_init()

AS_EXTERN void as_vector_init ( as_vector * vector,
uint32_t item_size,
uint32_t capacity )

Initialize a stack allocated as_vector, with item storage on the heap.

◆ as_vector_remove()

AS_EXTERN bool as_vector_remove ( as_vector * vector,
uint32_t index )

Remove item from vector.

◆ as_vector_reserve()

static void * as_vector_reserve ( as_vector * vector)
inlinestatic

Reserve a new slot in the vector. Increase capacity if necessary. Return reference to item. The item is initialized to zeroes.

Definition at line 171 of file as_vector.h.

References as_vector_increase_capacity(), as_vector::capacity, as_vector::item_size, as_vector::list, and as_vector::size.

◆ as_vector_set()

static void as_vector_set ( as_vector * vector,
uint32_t index,
void * value )
inlinestatic

Set item in vector.

Definition at line 136 of file as_vector.h.

References as_vector::item_size, and as_vector::list.

◆ as_vector_to_array()

AS_EXTERN void * as_vector_to_array ( as_vector * vector,
uint32_t * size )

Return shallow heap copy of vector.