Files | |
file | ub_esarray.h |
Allocated memory array which is expanded or shrinked automatically. | |
Functions | |
ub_esarray_cstd_t * | ub_esarray_init (int esunit, int elesize, int maxeles) |
initialize ub_esarray object. More... | |
void | ub_esarray_close (ub_esarray_cstd_t *eah) |
close ub_esarray More... | |
int | ub_esarray_add_ele (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed) |
add one element More... | |
int | ub_esarray_pop_ele (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed) |
pop in fifo mode(get from index=0, and delete index=0) More... | |
int | ub_esarray_pop_last_ele (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed) |
pop in stack mode(get from the last index, and delete it) More... | |
int | ub_esarray_del_ele (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed) |
delete one element *ed More... | |
int | ub_esarray_data_lock (ub_esarray_cstd_t *eah) |
lock data to preserve checked out data by ub_esarray_get_newele or ub_esarray_get_ele More... | |
int | ub_esarray_data_unlock (ub_esarray_cstd_t *eah) |
unlock data to return to the default status More... | |
int | ub_esarray_ele_nums (ub_esarray_cstd_t *eah) |
returns the number of elements More... | |
ub_esarray_element_t * | ub_esarray_get_newele (ub_esarray_cstd_t *eah) |
get a new element from the ub_esarray_array More... | |
ub_esarray_element_t * | ub_esarray_get_ele (ub_esarray_cstd_t *eah, int index) |
get the indexed element from the ub_esarray_array More... | |
int | ub_esarray_del_pointer (ub_esarray_cstd_t *eah, ub_esarray_element_t *ed) |
delete one element with element pointer More... | |
int | ub_esarray_del_index (ub_esarray_cstd_t *eah, int index) |
delete one element with index More... | |
Typedefs | |
typedef struct ub_esarray_cstd | ub_esarray_cstd_t |
the data handle of ub_esarray object, the inside of it is private More... | |
typedef void | ub_esarray_element_t |
data type of the element More... | |
typedef struct ub_esarray_cstd ub_esarray_cstd_t |
the data handle of ub_esarray object, the inside of it is private
typedef void ub_esarray_element_t |
data type of the element
ub_esarray_cstd_t* ub_esarray_init | ( | int | esunit, |
int | elesize, | ||
int | maxeles | ||
) |
initialize ub_esarray object.
esunit | expand and shrink unit |
elesize | element size |
maxeles | max number of elements |
void ub_esarray_close | ( | ub_esarray_cstd_t * | eah | ) |
close ub_esarray
eah | the data handle of ub_esarray object |
int ub_esarray_add_ele | ( | ub_esarray_cstd_t * | eah, |
ub_esarray_element_t * | ed | ||
) |
add one element
eah | the data handle of ub_esarray_array object |
ed | a new element to add |
int ub_esarray_pop_ele | ( | ub_esarray_cstd_t * | eah, |
ub_esarray_element_t * | ed | ||
) |
pop in fifo mode(get from index=0, and delete index=0)
eah | the data handle of ub_esarray_array object |
ed | popped element; the data is copied to ed, which must have elesize space |
int ub_esarray_pop_last_ele | ( | ub_esarray_cstd_t * | eah, |
ub_esarray_element_t * | ed | ||
) |
pop in stack mode(get from the last index, and delete it)
eah | the data handle of ub_esarray_array object |
ed | poped element; the data is copied to ed, which must have elesize space |
int ub_esarray_del_ele | ( | ub_esarray_cstd_t * | eah, |
ub_esarray_element_t * | ed | ||
) |
delete one element *ed
eah | the data handle of ub_esarray_array object |
ed | the element which has the same contents as 'ed' should be deleted |
int ub_esarray_data_lock | ( | ub_esarray_cstd_t * | eah | ) |
lock data to preserve checked out data by ub_esarray_get_newele or ub_esarray_get_ele
int ub_esarray_data_unlock | ( | ub_esarray_cstd_t * | eah | ) |
unlock data to return to the default status
int ub_esarray_ele_nums | ( | ub_esarray_cstd_t * | eah | ) |
returns the number of elements
ub_esarray_element_t* ub_esarray_get_newele | ( | ub_esarray_cstd_t * | eah | ) |
get a new element from the ub_esarray_array
eah | the data handle of ub_esarray_array object |
ub_esarray_element_t* ub_esarray_get_ele | ( | ub_esarray_cstd_t * | eah, |
int | index | ||
) |
get the indexed element from the ub_esarray_array
eah | the data handle of ub_esarray_array object |
index | index in the current ub_esarray_array |
int ub_esarray_del_pointer | ( | ub_esarray_cstd_t * | eah, |
ub_esarray_element_t * | ed | ||
) |
delete one element with element pointer
eah | the data handle of ub_esarray_array object |
ed | the element pointer which should be deleted |
int ub_esarray_del_index | ( | ub_esarray_cstd_t * | eah, |
int | index | ||
) |
delete one element with index
eah | the data handle of ub_esarray_array object |
index | the index of the current ub_esarray_array, which should be deleted |