All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
_bin.h File Reference
#include <aerospike/as_bin.h>
#include <aerospike/as_integer.h>
#include <aerospike/as_string.h>
#include <aerospike/as_bytes.h>
#include <aerospike/as_list.h>
#include <aerospike/as_map.h>
#include <aerospike/as_val.h>
+ Include dependency graph for _bin.h:

Go to the source code of this file.

Macros

#define as_bins_inita(__bins, __capacity)
 

Functions

void as_bin_destroy (as_bin *bin)
 
as_binas_bin_init (as_bin *bin, const as_bin_name name, as_bin_value *value)
 
as_binas_bin_init_int64 (as_bin *bin, const as_bin_name name, int64_t value)
 
as_binas_bin_init_nil (as_bin *bin, const as_bin_name name)
 
as_binas_bin_init_raw (as_bin *bin, const as_bin_name name, const uint8_t *value, uint32_t size, bool free)
 
as_binas_bin_init_str (as_bin *bin, const as_bin_name name, const char *value, bool free)
 
bool as_bins_append (as_bins *bins, as_bin_name name, as_bin_value *value)
 
void as_bins_destroy (as_bins *bins)
 
as_binsas_bins_init (as_bins *bins, uint16_t capacity)
 

Macro Definition Documentation

#define as_bins_inita (   __bins,
  __capacity 
)
Value:
(__bins)->_free = false;\
(__bins)->capacity = __capacity;\
(__bins)->size = 0;\
(__bins)->entries = (as_bin *) alloca(sizeof(as_bin) * __capacity);

Initializes a stack allocated as_bins (__bins) and allocates __capacity number of entries on the stack.

as_bins bins;
as_bins_init(&bins, 2);
as_bins_append(&bins, "bin1", as_integer_new(123));
as_bins_append(&bins, "bin2", as_integer_new(456));
Parameters
__binsThe as_bins * to initialize.
__capacityThe number of as_bins.entries to allocate on the stack.

Definition at line 52 of file _bin.h.

Function Documentation

void as_bin_destroy ( as_bin bin)

Destroy the given as_bin and associated resources.

Parameters
binThe as_bin to destroy.
as_bin* as_bin_init ( as_bin bin,
const as_bin_name  name,
as_bin_value value 
)

Intializes an as_bin with the given name and value.

as_bin bin;
as_bin_init(&bin, "bin1", as_integer_new(123));

Use as_bin_destroy() to free the resources allocated by this function.

Parameters
binThe as_bin to initialize.
nameThe name of the bin.
valueThe value of the bin.
Returns
The initialized as_bin on success. Otherwsie NULL.
as_bin* as_bin_init_int64 ( as_bin bin,
const as_bin_name  name,
int64_t  value 
)

Initialize a stack allocated as_bin to a int64_t value.

as_bin bin;
as_bin_init_int64(&key, "abc", 123);

Use as_bin_destroy() to release resources allocated to as_bin.

Parameters
nameThe name of the bin.
valueThe value of the value.
Returns
The initialized as_bin on success. Otherwise NULL.
as_bin* as_bin_init_nil ( as_bin bin,
const as_bin_name  name 
)

Initialize a stack allocated as_key to a an as_key_value.

as_bin bin;

Use as_bin_destroy() to release resources allocated to as_bin.

Parameters
nameThe name of the bin.
valueThe value of the value.
Returns
The initialized as_bin on success. Otherwise NULL.
as_bin* as_bin_init_raw ( as_bin bin,
const as_bin_name  name,
const uint8_t *  value,
uint32_t  size,
bool  free 
)

Initialize a stack allocated as_key to a raw bytes value.

uint8_t rgb[3] = {254,254,120};
as_bin bin;
as_bin_init_raw(&key, "abc", rgb, 3, false);

Use as_bin_destroy() to release resources allocated to as_bin.

Parameters
nameThe name of the bin.
valueThe value of the value.
freeIf true, then the value is freed when the bin is destroyed.
Returns
The initialized as_bin on success. Otherwise NULL.
as_bin* as_bin_init_str ( as_bin bin,
const as_bin_name  name,
const char *  value,
bool  free 
)

Initialize a stack allocated as_bin to a NULL-terminated string value.

as_bin bin;
as_bin_init_str(&key, "abc", "def", false);

Use as_bin_destroy() to release resources allocated to as_bin.

Parameters
nameThe name of the bin.
valueThe value of the value.
freeIf true, then the value is freed when the bin is destroyed.
Returns
The initialized as_bin on success. Otherwise NULL.
bool as_bins_append ( as_bins bins,
as_bin_name  name,
as_bin_value value 
)

Append a bin to the sequence of bins.

Parameters
binsThe as_bins to append the bin to.
nameThe name of the bin to append.
valueThe value of the bin to append.
Returns
true on success. Otherswise an error occurred.
void as_bins_destroy ( as_bins bins)

Destroy the as_bins and associated resources.

Parameters
binsThe as_bins to destroy.
as_bins* as_bins_init ( as_bins bins,
uint16_t  capacity 
)

Intializes a stack allocated as_bins. The capacity specifies the number of as_bins.entries to allocate on the heap.

as_bins bins;
as_bins_init(&bins, 2);
as_bins_append(&bins, "bin1", as_integer_new(123));
as_bins_append(&bins, "bin2", as_integer_new(456));

Use as_bins_destroy() to free the resources allocated by this function.

Parameters
binsThe as_bins to initialize.
capacityThe number of as_bins.entries to allocate on the heap.
Returns
The initialized as_bins on success. Otherwsie NULL.