qbarray.h - Online Linux Manual PageSection : 3
Updated : 11 May 2016
Source : Version 0.17.1
Note : libqb
NAMEqbarray.h − This is a dynamic array (it can grow, but without moving memory).
SYNOPSIS
#include <stdint.h>
#include <unistd.h>
#include <qb/qbdefs.h>
Typedefstypedef struct qb_array qb_array_t
This is an opaque data type representing an instance of an array. typedef void(* qb_array_new_bin_cb_fn )(qb_array_t *a, uint32_t bin)
Functionsqb_array_t * qb_array_create (size_t max_elements, size_t element_size)
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_out)
Get an element at a particular index. int32_t qb_array_grow (qb_array_t *a, size_t max_elements)
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. int32_t qb_array_new_bin_cb_set (qb_array_t *a, qb_array_new_bin_cb_fn fn)
Get a callback when a new bin is allocated. void qb_array_free (qb_array_t *a)
Free all the memory used by the array.
Detailed DescriptionThis 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 valid.
Typedef Documentation
typedef void(* qb_array_new_bin_cb_fn)(qb_array_t *a, uint32_t bin)
typedef struct qb_array qb_array_tThis is an opaque data type representing an instance of an array.
Function Documentation
qb_array_t* qb_array_create (size_t max_elements, size_t element_size)Create an array with fixed sized elements. Parameters: max_elements initial max elements.
element_size size of each element. Returns: array instance.
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. Parameters: max_elements initial max elements.
element_size size of each element.
autogrow_elements the number of elements to grow automatically by. Returns: 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)Free all the memory used by the array. Parameters: a array instance.
int32_t qb_array_grow (qb_array_t * a, size_t max_elements)Grow the array. Parameters: a array instance.
max_elements the new maximum size of the array. Returns: (0 == success, else -errno)
int32_t qb_array_index (qb_array_t * a, int32_t idx, void ** element_out)Get an element at a particular index. Parameters: a array instance.
idx the index
element_out the pointer to the element data. Returns: (0 == success, else -errno)
int32_t qb_array_new_bin_cb_set (qb_array_t * a, qb_array_new_bin_cb_fn fn)Get a callback when a new bin is allocated.
size_t qb_array_num_bins_get (qb_array_t * a)Get the number of bins used or the array.
AuthorGenerated automatically by Doxygen for libqb from the source code. 0
Johanes Gumabo
Data Size : 20,681 byte
man-qbarray.h.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 5 / 174,449
Visitor ID : :
Visitor IP : 3.15.225.164 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.