Go to the source code of this file.
Data Structures | |
struct | s_array |
Data structure that defines an array handler. More... | |
Defines | |
#define | array_size(array) (array.array_size) |
#define | array_number_of_elements(array) (array.number_of_elements) |
#define | array_first_elem(array) (array.first_element) |
#define | array_to_remove(array) (array.element_to_remove) |
Typedefs | |
typedef s_array | Array |
C data type for the array handler. | |
Functions | |
int | array_init (Array *array, void *first_element, int size, int(*copy_data)(void *src, void *dest), int(*remove_data)(void *target), int(*compare)(void *d1, void *d2), void *(*index)(void *start, int idx), int(*init_data)(void *data)) |
Initialize an array handler. | |
void | array_free (Array *array) |
Free all memory allocated for the array structure. | |
int | array_init_element (Array *array) |
Initialize all elements of an array. | |
int | array_add (Array *array, void *element) |
Add an element to the array (the element id added after the last element). | |
int | array_rem (Array *array, int idx) |
Remove an element from an array. The elements next to the one removed are shifted to the left (so there is no gaps, and the elements' order does not change). | |
int | array_insert (Array *array, int idx, void *data) |
Insert an element in an array. | |
int | array_schedule_for_rem (Array *array, int idx) |
Schedule an element of the array for removing. | |
int | array_rem_all (Array *array) |
Remove a list of previouly scheduled element. | |
int | array_find (Array *array, void *data) |
Find an given element in the array. |
Definition in file array.h.
|
This macro return a pointer on the first element in the array. |
|
This macro returns the current number of element in the array.
|
|
This macro returns the size of the array (that is, the maximum number of elements that can be stored in the array). |
|
This macro returns the number of element to remove. |
|
Add an element to the array (the element id added after the last element).
Definition at line 208 of file array.c. References s_array::array_size, s_array::copy_data, s_array::first_element, s_array::index, and s_array::number_of_elements. |
|
Find an given element in the array.
Definition at line 394 of file array.c. References s_array::compare, s_array::first_element, s_array::index, and s_array::number_of_elements. |
|
Free all memory allocated for the array structure.
Definition at line 73 of file array.c. References s_array::to_remove. |
|
Initialize an array handler.
Definition at line 38 of file array.c. References s_array::array_size, s_array::compare, s_array::copy_data, s_array::element_to_remove, s_array::first_element, s_array::index, s_array::init_data, s_array::number_of_elements, s_array::remove_data, and s_array::to_remove. |
|
Initialize all elements of an array.
Definition at line 184 of file array.c. References s_array::array_size, s_array::first_element, s_array::index, and s_array::init_data. |
|
Insert an element in an array.
Definition at line 330 of file array.c. References s_array::array_size, s_array::copy_data, s_array::first_element, s_array::index, and s_array::number_of_elements. |
|
Remove an element from an array. The elements next to the one removed are shifted to the left (so there is no gaps, and the elements' order does not change).
Definition at line 257 of file array.c. References s_array::copy_data, s_array::first_element, s_array::index, s_array::number_of_elements, and s_array::remove_data. Referenced by array_rem_all(). |
|
Remove a list of previouly scheduled element.
Definition at line 140 of file array.c. References array_rem(), s_array::element_to_remove, issort(), and s_array::to_remove. |
|
Schedule an element of the array for removing.
Definition at line 85 of file array.c. References s_array::array_size, s_array::element_to_remove, and s_array::to_remove. |