55 #if !defined(__AMXC_ARRAY_H__)
56 #define __AMXC_ARRAY_H__
494 const unsigned int index);
515 const unsigned int index,
712 const unsigned int index) {
714 return (
it != NULL) ?
it->data : NULL;
730 return (
it != NULL) ?
it->data : NULL;
int(* amxc_array_it_cmp_t)(amxc_array_it_t *it1, amxc_array_it_t *it2)
Type definition of an array iterator compare callback function.
amxc_array_it_t * amxc_array_it_get_next_free(const amxc_array_it_t *const reference)
Gets the next free item in the array, starting from the provided array iterator.
int amxc_array_it_set_data(amxc_array_it_t *const it, void *data)
Sets the data pointer of an array iterator.
amxc_array_it_t * amxc_array_it_get_previous(const amxc_array_it_t *const reference)
Gets the previous used item in the array, starting from the provided array iterator.
amxc_array_it_t * amxc_array_it_get_next(const amxc_array_it_t *const reference)
Gets the next used item in the array, starting from the provided array iterator.
struct _amxc_array_it amxc_array_it_t
The array iterator structure.
void * amxc_array_it_take_data(amxc_array_it_t *const it)
Gets and removes a data pointer from the iterator.
amxc_array_it_t * amxc_array_it_get_previous_free(const amxc_array_it_t *const reference)
Gets the previous free item in the array, starting from the provided array iterator.
AMXC_INLINE void * amxc_array_it_get_data(const amxc_array_it_t *const it)
Gets the data pointer of array iterator.
unsigned int amxc_array_it_index(const amxc_array_it_t *const it)
Gets the index of the iterator in the array.
int amxc_array_it_swap(amxc_array_it_t *const it1, amxc_array_it_t *const it2)
Swaps the content of the two array iterators.
amxc_array_it_t * amxc_array_get_last(const amxc_array_t *const array)
Gets the item iterator of the last used item in the array.
AMXC_INLINE size_t amxc_array_capacity(const amxc_array_t *const array)
Gets the capacity of the array.
int amxc_array_shift_right(amxc_array_t *const array, const size_t items, amxc_array_it_delete_t func)
Shift all items to the right in the array.
amxc_array_it_t * amxc_array_set_data_at(amxc_array_t *const array, const unsigned int index, void *data)
Sets data at the given index.
void * amxc_array_take_first_data(amxc_array_t *const array)
Takes the data pointer from the first used item in the array.
size_t amxc_array_size(const amxc_array_t *const array)
Calculates the number of used items in the array.
AMXC_INLINE void * amxc_array_get_data_at(const amxc_array_t *const array, const unsigned int index)
Gets the data pointer of the item at the given index.
amxc_array_it_t * amxc_array_get_last_free(const amxc_array_t *const array)
Gets the last free position in the array.
int amxc_array_shift_left(amxc_array_t *const array, const size_t items, amxc_array_it_delete_t func)
Shift all items to the left in the array.
void * amxc_array_take_last_data(amxc_array_t *const array)
Takes the data pointer from the last used item in the array.
int amxc_array_init(amxc_array_t *const array, const size_t items)
Initializes an array.
amxc_array_it_t * amxc_array_get_at(const amxc_array_t *const array, const unsigned int index)
Gets the item iterator for the given index.
int amxc_array_shrink(amxc_array_t *const array, const size_t items, amxc_array_it_delete_t func)
Shrinks the array.
amxc_array_it_t * amxc_array_get_first(const amxc_array_t *const array)
Gets the item iterator of the first used item in the array.
amxc_array_it_t * amxc_array_prepend_data(amxc_array_t *const array, void *data)
Adds an item before the first used item in the array.
bool amxc_array_is_empty(const amxc_array_t *const array)
Checks that the array is empty.
int8_t amxc_array_new(amxc_array_t **array, const size_t items)
Allocates an array.
void amxc_array_clean(amxc_array_t *const array, amxc_array_it_delete_t func)
Removes all items from the array.
amxc_array_it_t * amxc_array_get_first_free(const amxc_array_t *const array)
Gets the first free position in the array.
void(* amxc_array_it_delete_t)(amxc_array_it_t *it)
Definition of the array item delete callback function.
amxc_array_it_t * amxc_array_append_data(amxc_array_t *const array, void *data)
Adds an item after the last used item in the array.
int amxc_array_sort(amxc_array_t *const array, amxc_array_it_cmp_t cmp)
Sorts the content of the array.
int amxc_array_grow(amxc_array_t *const array, const size_t items)
Expands the array.
void amxc_array_delete(amxc_array_t **array, const amxc_array_it_delete_t func)
Frees the previously allocated array.
struct _amxc_array amxc_array_t
The array structure.
The array iterator structure.
struct _amxc_array_it * buffer
static unsigned int array[2006]
static amxc_htable_it_t it[2000]
static amxc_llist_it_t it2
static amxc_llist_it_t it1