![]() |
#include <aerospike/as_bytes.h>
#include <aerospike/as_double.h>
#include <aerospike/as_integer.h>
#include <aerospike/as_list.h>
#include <aerospike/as_map.h>
#include <aerospike/as_std.h>
#include <aerospike/as_string.h>
#include <aerospike/as_val.h>
Go to the source code of this file.
Data Structures | |
struct | as_arraylist |
Enumerations | |
enum | as_arraylist_status { AS_ARRAYLIST_OK = 0 , AS_ARRAYLIST_ERR_ALLOC = 1 , AS_ARRAYLIST_ERR_MAX = 2 , AS_ARRAYLIST_ERR_INDEX = 3 } |
enum as_arraylist_status |
Status codes for various as_arraylist operations.
Enumerator | |
---|---|
AS_ARRAYLIST_OK | Normal operation. |
AS_ARRAYLIST_ERR_ALLOC | Unable to expand capacity, because cf_realloc() failed. |
AS_ARRAYLIST_ERR_MAX | Unable to expand capacity, because as_arraylist.block_size is 0. |
AS_ARRAYLIST_ERR_INDEX | Illegal array index. |
Definition at line 136 of file as_arraylist.h.
AS_EXTERN int as_arraylist_append | ( | as_arraylist * | list, |
as_val * | value ) |
Add the value to the end of the list.
list | The list. |
value | The value to prepend. |
|
inlinestatic |
Add an as_double to the end of the list.
list | The list. |
value | The value to prepend. |
Definition at line 862 of file as_arraylist.h.
|
inlinestatic |
Add an as_bytes to the end of the list.
list | The list. |
value | The value to prepend. |
Definition at line 892 of file as_arraylist.h.
AS_EXTERN int as_arraylist_append_double | ( | as_arraylist * | list, |
double | value ) |
Add a double to the end of the list.
list | The list. |
value | The value to prepend. |
AS_EXTERN int as_arraylist_append_int64 | ( | as_arraylist * | list, |
int64_t | value ) |
Add an int64_t to the end of the list.
list | The list. |
value | The value to prepend. |
|
inlinestatic |
Add an as_integer to the end of the list.
list | The list. |
value | The value to prepend. |
Definition at line 847 of file as_arraylist.h.
|
inlinestatic |
Add an as_list to the end of the list.
list | The list. |
value | The value to prepend. |
Definition at line 907 of file as_arraylist.h.
|
inlinestatic |
Add an as_map to the end of the list.
list | The list. |
value | The value to prepend. |
Definition at line 922 of file as_arraylist.h.
AS_EXTERN int as_arraylist_append_str | ( | as_arraylist * | list, |
const char * | value ) |
Add a NULL-terminated string to the end of the list.
list | The list. |
value | The value to prepend. |
|
inlinestatic |
Add an as_string to the end of the list.
list | The list. |
value | The value to prepend. |
Definition at line 877 of file as_arraylist.h.
AS_EXTERN int as_arraylist_concat | ( | as_arraylist * | list, |
const as_arraylist * | list2 ) |
Append all elements of list2, in order, to list. No new list object is created.
list | The list to append to. |
list2 | The list from which to append. |
AS_EXTERN void as_arraylist_destroy | ( | as_arraylist * | list | ) |
Destoy the list and release resources.
list | The list to destroy. |
AS_EXTERN as_arraylist * as_arraylist_drop | ( | const as_arraylist * | list, |
uint32_t | n ) |
Return a new list with the first n elements removed.
list | The list. |
n | The number of elements to remove. |
AS_EXTERN bool as_arraylist_foreach | ( | const as_arraylist * | list, |
as_list_foreach_callback | callback, | ||
void * | udata ) |
Call the callback function for each element in the list.
list | The list to iterate. |
callback | The function to call for each element in the list. |
udata | User-data to be sent to the callback. |
AS_EXTERN as_val * as_arraylist_get | ( | const as_arraylist * | list, |
uint32_t | index ) |
Return the value at the specified index.
list | The list. |
index | The index of the element. |
|
inlinestatic |
Return an as_double value at the specified index of the list.
list | The list. |
index | The index of the element. |
Definition at line 407 of file as_arraylist.h.
|
inlinestatic |
Return an as_bytes value at the specified index of the list.
list | The list. |
index | The index of the element. |
Definition at line 437 of file as_arraylist.h.
AS_EXTERN double as_arraylist_get_double | ( | const as_arraylist * | list, |
uint32_t | index ) |
Return a double value at the specified index of the list.
list | The list. |
index | The index of the element. |
AS_EXTERN int64_t as_arraylist_get_int64 | ( | const as_arraylist * | list, |
uint32_t | index ) |
Return an int64_t value at the specified index of the list.
list | The list. |
index | The index of the element. |
|
inlinestatic |
Return an as_integer value at the specified index of the list.
list | The list. |
index | The index of the element. |
Definition at line 392 of file as_arraylist.h.
|
inlinestatic |
Return an as_list value at the specified index of the list.
list | The list. |
index | The index of the element. |
Definition at line 452 of file as_arraylist.h.
|
inlinestatic |
Return an as_map value at the specified index of the list.
list | The list. |
index | The index of the element. |
Definition at line 467 of file as_arraylist.h.
AS_EXTERN char * as_arraylist_get_str | ( | const as_arraylist * | list, |
uint32_t | index ) |
Return a NULL-terminated value at the specified index of the list.
list | The list. |
index | The index of the element. |
|
inlinestatic |
Return an as_string value at the specified index of the list.
list | The list. |
index | The index of the element. |
Definition at line 422 of file as_arraylist.h.
AS_EXTERN uint32_t as_arraylist_hashcode | ( | const as_arraylist * | list | ) |
The hash value of the list.
list | The list. |
AS_EXTERN as_val * as_arraylist_head | ( | const as_arraylist * | list | ) |
Get the first element of the list.
list | The list to get the first element from. |
AS_EXTERN as_arraylist * as_arraylist_init | ( | as_arraylist * | list, |
uint32_t | capacity, | ||
uint32_t | block_size ) |
Initialize a stack allocated as_arraylist, with element storage on the heap.
This differs from as_arraylist_inita(), in that as_arraylist_inita() allocates element storage on the stack.
list | The as_list to initialize |
capacity | The number of elements to allocate to the list. |
block_size | The number of elements to grow the list by, when the capacity has been reached. |
AS_EXTERN int as_arraylist_insert | ( | as_arraylist * | list, |
uint32_t | index, | ||
as_val * | value ) |
Insert a value at the specified index of the list.
Any elements at and beyond specified index will be shifted so their indexes increase by 1. It's ok to insert beyond the current end of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
|
inlinestatic |
Insert an as_double value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
Definition at line 716 of file as_arraylist.h.
|
inlinestatic |
Insert an as_bytes value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
Definition at line 748 of file as_arraylist.h.
AS_EXTERN int as_arraylist_insert_double | ( | as_arraylist * | list, |
uint32_t | index, | ||
double | value ) |
Insert a double value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
AS_EXTERN int as_arraylist_insert_int64 | ( | as_arraylist * | list, |
uint32_t | index, | ||
int64_t | value ) |
Insert an int64_t value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
|
inlinestatic |
Insert an as_integer value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
Definition at line 700 of file as_arraylist.h.
|
inlinestatic |
Insert an as_list value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
Definition at line 764 of file as_arraylist.h.
|
inlinestatic |
Insert an as_map value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
Definition at line 780 of file as_arraylist.h.
AS_EXTERN int as_arraylist_insert_str | ( | as_arraylist * | list, |
uint32_t | index, | ||
const char * | value ) |
Insert a NULL-terminated string value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
|
inlinestatic |
Insert an as_string value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to insert at the given index. |
Definition at line 732 of file as_arraylist.h.
AS_EXTERN as_arraylist * as_arraylist_new | ( | uint32_t | capacity, |
uint32_t | block_size ) |
Create and initialize a heap allocated list as as_arraylist.
capacity | The number of elements to allocate to the list. |
block_size | The number of elements to grow the list by, when the capacity has been reached. |
AS_EXTERN int as_arraylist_prepend | ( | as_arraylist * | list, |
as_val * | value ) |
Add the value to the beginning of the list.
list | The list. |
value | The value to prepend. |
|
inlinestatic |
Add an as_double to the beginning of the list.
list | The list. |
value | The value to prepend. |
Definition at line 1004 of file as_arraylist.h.
|
inlinestatic |
Add an as_bytes to the beginning of the list.
list | The list. |
value | The value to prepend. |
Definition at line 1032 of file as_arraylist.h.
AS_EXTERN int as_arraylist_prepend_double | ( | as_arraylist * | list, |
double | value ) |
Add a double to the beginning of the list.
list | The list. |
value | The value to prepend. |
AS_EXTERN int as_arraylist_prepend_int64 | ( | as_arraylist * | list, |
int64_t | value ) |
Add an int64_t to the beginning of the list.
list | The list. |
value | The value to prepend. |
|
inlinestatic |
Add an as_integer to the beginning of the list.
list | The list. |
value | The value to prepend. |
Definition at line 989 of file as_arraylist.h.
|
inlinestatic |
Add an as_list to the beginning of the list.
list | The list. |
value | The value to prepend. |
Definition at line 1046 of file as_arraylist.h.
|
inlinestatic |
Add an as_map to the beginning of the list.
list | The list. |
value | The value to prepend. |
Definition at line 1060 of file as_arraylist.h.
AS_EXTERN int as_arraylist_prepend_str | ( | as_arraylist * | list, |
const char * | value ) |
Add a NULL-terminated string to the beginning of the list.
list | The list. |
value | The value to prepend. |
|
inlinestatic |
Add an as_string to the beginning of the list.
list | The list. |
value | The value to prepend. |
Definition at line 1018 of file as_arraylist.h.
AS_EXTERN int as_arraylist_remove | ( | as_arraylist * | list, |
uint32_t | index ) |
Remove element at specified index.
Any elements beyond specified index will be shifted so their indexes decrease by 1. The element at specified index will be destroyed.
list | The list. |
index | The index of the element to remove. |
AS_EXTERN int as_arraylist_set | ( | as_arraylist * | list, |
uint32_t | index, | ||
as_val * | value ) |
Set a value at the specified index of the list.
Notice that in order to maintain proper object/memory management, we just first destroy (as_val_destroy()) the old object at element position(i) before assigning the new element. Also note that the object at element position (i) is assumed to exist, so all element positions must be appropriately initialized to zero.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
|
inlinestatic |
Set an as_double value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
Definition at line 561 of file as_arraylist.h.
|
inlinestatic |
Set an as_bytes value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
Definition at line 593 of file as_arraylist.h.
AS_EXTERN int as_arraylist_set_double | ( | as_arraylist * | list, |
uint32_t | index, | ||
double | value ) |
Set a double value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
AS_EXTERN int as_arraylist_set_int64 | ( | as_arraylist * | list, |
uint32_t | index, | ||
int64_t | value ) |
Set an int64_t value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
|
inlinestatic |
Set an as_integer value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
Definition at line 545 of file as_arraylist.h.
|
inlinestatic |
Set an as_list value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
Definition at line 609 of file as_arraylist.h.
|
inlinestatic |
Set an as_map value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
Definition at line 625 of file as_arraylist.h.
AS_EXTERN int as_arraylist_set_str | ( | as_arraylist * | list, |
uint32_t | index, | ||
const char * | value ) |
Set a NULL-terminated string value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
|
inlinestatic |
Set an as_string value at the specified index of the list.
list | The list. |
index | Position in the list. |
value | The value to set at the given index. |
Definition at line 577 of file as_arraylist.h.
AS_EXTERN uint32_t as_arraylist_size | ( | const as_arraylist * | list | ) |
The number of elements in the list.
list | The list. |
AS_EXTERN as_arraylist * as_arraylist_tail | ( | const as_arraylist * | list | ) |
Returns a new list containing all elements other than the head
list | The list to get the elements from. |
AS_EXTERN as_arraylist * as_arraylist_take | ( | const as_arraylist * | list, |
uint32_t | n ) |
Return a new list containing the first n elements.
list | The list. |
n | The number of elements to take. |
AS_EXTERN int as_arraylist_trim | ( | as_arraylist * | list, |
uint32_t | index ) |
Delete (and destroy) all elements at and beyond specified index. Capacity is not reduced.
list | The list to trim. |
index | The index from which to trim. |