qbarray.h.3   qbarray.h.3 
qbarray.h(3) libqb qbarray .h(3) qbarray.h(3) libqb qbarray .h(3)
NAME NAME
qbarray.h - qbarray.h -
This is a dynamic array (it can grow, but without moving memory). This is a dynamic array (it can grow, but without moving memory)'.
SYNOPSIS SYNOPSIS
#include <stdint.h> #include <stdint.h>
#include <unistd.h> #include <unistd.h>
#include <qb/qbdefs.h> #include <qb/qbdefs.h>
Typedefs Typedefs
typedef struct qb_array qb_array_t typedef struct qb_array qb_array_t
This is an opaque data type representing an instance of an array . This is an opaque data type representing an instance of an array '.
Functions Functions
qb_array_t * qb_array_create (size_t max_elements, size_t element_si ze) qb_array_t * qb_array_create (size_t max_elements, size_t element_si ze)
Create an array with fixed sized elements. Create an array with fixed sized elements'.
qb_array_t * qb_array_create_2 (size_t max_elements, size_t element_
size, size_t autogrow_elements)
Create an array with fixed sized elements'.
int32_t qb_array_index (qb_array_t *a, int32_t idx, void **element_o ut) int32_t qb_array_index (qb_array_t *a, int32_t idx, void **element_o ut)
Get an element at a particular index. Get an element at a particular index'.
int32_t qb_array_grow (qb_array_t *a, size_t max_elements) int32_t qb_array_grow (qb_array_t *a, size_t max_elements)
Grow the array. Grow the array'.
size_t qb_array_num_bins_get (qb_array_t *a)
Get the number of bins used or the array'.
size_t qb_array_elems_per_bin_get (qb_array_t *a)
Get the number of elements per bin'.
void qb_array_free (qb_array_t *a) void qb_array_free (qb_array_t *a)
Free all the memory used by the array. Free all the memory used by the array'.
Detailed Description Detailed Description
This is a dynamic array (it can grow, but without moving memory). This is a dynamic array (it can grow, but without moving memory)'.
arr = qb_array_create_2(64, sizeof(struct my_struct), 256);
...
res = qb_array_index(arr, idx, (void**)&my_ptr);
if (res < 0) {
return res;
}
// use my_ptr, now even if there is a grow, this pointer will be va
lid.
Typedef Documentation Typedef Documentation
typedef struct qb_array qb_array_t typedef struct qb_array qb_array_t
This is an opaque data type representing an instance of an array. This is an opaque data type representing an instance of an array'.
Function Documentation Function Documentation
qb_array_t* qb_array_create (size_t max_elements, size_t element_size) qb_array_t* qb_array_create (size_tmax_elements, size_telement_size)
Create an array with fixed sized elements. Parameters: Create an array with fixed sized elements'. Parameters:
max_elements initial max elements. max_elements initial max elements'.
element_size size of each element. element_size size of each element'.
Returns:
array instance'.
qb_array_t* qb_array_create_2 (size_tmax_elements, size_telement_size, s
ize_tautogrow_elements)
Create an array with fixed sized elements'. Parameters:
max_elements initial max elements'.
element_size size of each element'.
autogrow_elements the number of elements to grow automatically b
y'.
Returns: Returns:
array instance. array instance'.
size_t qb_array_elems_per_bin_get (qb_array_t *a)
Get the number of elements per bin'.
void qb_array_free (qb_array_t * a) void qb_array_free (qb_array_t *a)
Free all the memory used by the array. Parameters: Free all the memory used by the array'. Parameters:
a array instance. a array instance'.
int32_t qb_array_grow (qb_array_t * a, size_t max_elements) int32_t qb_array_grow (qb_array_t *a, size_tmax_elements)
Grow the array. Parameters: Grow the array'. Parameters:
a array instance. a array instance'.
max_elements the new maximum size of the array. max_elements the new maximum size of the array'.
Returns: Returns:
(0 == success, else -errno) (0 == success, else -errno)
int32_t qb_array_index (qb_array_t * a, int32_t idx, void ** element_out int32_t qb_array_index (qb_array_t *a, int32_tidx, void **element_out)
) Get an element at a particular index'. Parameters:
Get an element at a particular index. Parameters: a array instance'.
a array instance.
idx the index idx the index
element_out the pointer to the element data. element_out the pointer to the element data'.
Returns: Returns:
(0 == success, else -errno) (0 == success, else -errno)
size_t qb_array_num_bins_get (qb_array_t *a)
Get the number of bins used or the array'.
Author Author
Generated automatically by Doxygen for libqb from the source code. Generated automatically by Doxygen for libqb from the source code'.
Version 0.4.1 Mon Jan 31 2011 qbarray .h(3) Version 0.8.1 Thu Jan 5 2012 qbarray .h(3)
 End of changes. 16 change blocks. 
27 lines changed or deleted 59 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/