|
cvx
|
An array that gets reallocated as needed. More...
Go to the source code of this file.
Data Structures | |
| struct | cvx_container |
| struct | dynamic_array_vtabv |
| struct | dynamic_array |
| struct | dynamic_array_iter |
| ITERATOR. More... | |
Typedefs | |
| typedef struct cvx_container | cvx_container |
Enumerations | |
| enum | cvx_flags { CVX_FLAG_OK = 0 , CVX_FLAG_VTAB = 1 , CVX_FLAG_WRONG_TAG = 2 , CVX_FLAG_ALLOC = 3 , CVX_FLAG_EMPTY = 4 , CVX_FLAG_FULL = 5 , CVX_FLAG_RANGE = 6 , CVX_FLAG_NOT_FOUND = 7 , CVX_FLAG_INVALID = 8 , CVX_FLAG_DUPLICATE = 9 , CVX_FLAG_ERROR = 10 } |
| Status and error flags for the CVX library. More... | |
| enum | cvx_heap_order { CVX_MAX_HEAP = 1 , CVX_MIN_HEAP = -1 } |
| enum cvx_heap_order More... | |
Functions | |
| void | da_init (struct dynamic_array *self, struct dynamic_array_vtabv *vtabv, size_t capacity) |
| void | da_drop (struct dynamic_array *self) |
| void | da_clone (struct dynamic_array *orig, struct dynamic_array *clone) |
| enum cvx_flags | da_flag (struct dynamic_array *self) |
| size_t | da_count (struct dynamic_array *self) |
| size_t | da_capacity (struct dynamic_array *self) |
| _Bool | da_empty (struct dynamic_array *self) |
| _Bool | da_full (struct dynamic_array *self) |
| TVal | da_front (struct dynamic_array *self) |
| TVal | da_back (struct dynamic_array *self) |
| TVal | da_get (struct dynamic_array *self, size_t index) |
| void | da_push_front (struct dynamic_array *self, TVal item) |
| Inserts an element at position 0. | |
| void | da_push_at (struct dynamic_array *self, TVal item, size_t index) |
Inserts an item at position index. | |
| void | da_push_back (struct dynamic_array *self, TVal item) |
| Inserts an element at the last position. | |
| TVal | da_pop_front (struct dynamic_array *self) |
| Removes an item at the index 0. | |
| TVal | da_pop_at (struct dynamic_array *self, size_t index) |
| TVal | da_pop_back (struct dynamic_array *self) |
| TVal | da_replace_front (struct dynamic_array *self, TVal _new_) |
| TVal | da_replace_back (struct dynamic_array *self, TVal _new_) |
| void | da_swap (struct dynamic_array *self, size_t idx1, size_t idx2) |
| int | da_compare (struct dynamic_array *left, struct dynamic_array *right) |
| void | da_sort (struct dynamic_array *self) |
| _Bool | da__assert_capacity (struct dynamic_array *self) |
| PRIVATE FUNCTIONS. | |
| _Bool | da__assert_buffer (struct dynamic_array *self, size_t capacity) |
| struct dynamic_array_iter | da_iter__start (TVal *buffer, size_t capacity, size_t count) |
| struct dynamic_array_iter | da_iter__end (TVal *buffer, size_t capacity, size_t count) |
| _Bool | da_iter_at_end (struct dynamic_array_iter *self) |
| _Bool | da_iter_at_start (struct dynamic_array_iter *self) |
| void | da_iter_to_end (struct dynamic_array_iter *self) |
| void | da_iter_to_start (struct dynamic_array_iter *self) |
| void | da_iter_next (struct dynamic_array_iter *self) |
| void | da_iter_prev (struct dynamic_array_iter *self) |
| void | da_iter_go_to (struct dynamic_array_iter *self) |
| void | da_iter_forward (struct dynamic_array_iter *self, size_t steps) |
| void | da_iter_backward (struct dynamic_array_iter *self, size_t steps) |
| size_t | da_iter_index (struct dynamic_array_iter *self) |
| TVal | da_iter_value (struct dynamic_array_iter *self) |
| struct dynamic_array_iter | da_iter_start (struct dynamic_array *self) |
| struct dynamic_array_iter | da_iter_end (struct dynamic_array *self) |
An array that gets reallocated as needed.
struct SNAME, struct SNAME_vtabv, etc.).| typedef struct cvx_container cvx_container |
| enum cvx_flags |
Status and error flags for the CVX library.
Error Handling
| enum cvx_heap_order |
| _Bool da__assert_buffer | ( | struct dynamic_array * | self, |
| size_t | capacity | ||
| ) |
| _Bool da__assert_capacity | ( | struct dynamic_array * | self | ) |
PRIVATE FUNCTIONS.
| TVal da_back | ( | struct dynamic_array * | self | ) |
| size_t da_capacity | ( | struct dynamic_array * | self | ) |
| void da_clone | ( | struct dynamic_array * | orig, |
| struct dynamic_array * | clone | ||
| ) |
| int da_compare | ( | struct dynamic_array * | left, |
| struct dynamic_array * | right | ||
| ) |
| size_t da_count | ( | struct dynamic_array * | self | ) |
| void da_drop | ( | struct dynamic_array * | self | ) |
| _Bool da_empty | ( | struct dynamic_array * | self | ) |
| enum cvx_flags da_flag | ( | struct dynamic_array * | self | ) |
| TVal da_front | ( | struct dynamic_array * | self | ) |
| _Bool da_full | ( | struct dynamic_array * | self | ) |
| TVal da_get | ( | struct dynamic_array * | self, |
| size_t | index | ||
| ) |
| void da_init | ( | struct dynamic_array * | self, |
| struct dynamic_array_vtabv * | vtabv, | ||
| size_t | capacity | ||
| ) |
| struct dynamic_array_iter da_iter__end | ( | TVal * | buffer, |
| size_t | capacity, | ||
| size_t | count | ||
| ) |
| struct dynamic_array_iter da_iter__start | ( | TVal * | buffer, |
| size_t | capacity, | ||
| size_t | count | ||
| ) |
| _Bool da_iter_at_end | ( | struct dynamic_array_iter * | self | ) |
| _Bool da_iter_at_start | ( | struct dynamic_array_iter * | self | ) |
| void da_iter_backward | ( | struct dynamic_array_iter * | self, |
| size_t | steps | ||
| ) |
| struct dynamic_array_iter da_iter_end | ( | struct dynamic_array * | self | ) |
| void da_iter_forward | ( | struct dynamic_array_iter * | self, |
| size_t | steps | ||
| ) |
| void da_iter_go_to | ( | struct dynamic_array_iter * | self | ) |
| size_t da_iter_index | ( | struct dynamic_array_iter * | self | ) |
| void da_iter_next | ( | struct dynamic_array_iter * | self | ) |
| void da_iter_prev | ( | struct dynamic_array_iter * | self | ) |
| struct dynamic_array_iter da_iter_start | ( | struct dynamic_array * | self | ) |
| void da_iter_to_end | ( | struct dynamic_array_iter * | self | ) |
| void da_iter_to_start | ( | struct dynamic_array_iter * | self | ) |
| TVal da_iter_value | ( | struct dynamic_array_iter * | self | ) |
| TVal da_pop_at | ( | struct dynamic_array * | self, |
| size_t | index | ||
| ) |
| TVal da_pop_back | ( | struct dynamic_array * | self | ) |
| TVal da_pop_front | ( | struct dynamic_array * | self | ) |
Removes an item at the index 0.
_pop* functions do not cause the buffer to shrink. | self | a non-NULL pointer to a initialized dynamic array |
Error Handling
CVX_FLAG_EMPTY - if there are no items in the dynamic array. | void da_push_at | ( | struct dynamic_array * | self, |
| TVal | item, | ||
| size_t | index | ||
| ) |
Inserts an item at position index.
CVX_BUFFER_GROWTH_RATE and CVX_BUFFER_MIN_SIZE. | self | a non-NULL pointer to a initialized dynamic array |
| item | the item to be inserted at index |
| index | must be 0 <= index <= count |
Error Handling
CVX_FLAG_ALLOC - if reallocation of the buffer fails | void da_push_back | ( | struct dynamic_array * | self, |
| TVal | item | ||
| ) |
Inserts an element at the last position.
CVX_BUFFER_GROWTH_RATE and CVX_BUFFER_MIN_SIZE. | self | a non-NULL pointer to a initialized dynamic array |
| item | the item to be inserted at the back |
Error Handling
CVX_FLAG_ALLOC - if reallocation of the buffer fails | void da_push_front | ( | struct dynamic_array * | self, |
| TVal | item | ||
| ) |
Inserts an element at position 0.
CVX_BUFFER_GROWTH_RATE and CVX_BUFFER_MIN_SIZE. | self | a non-NULL pointer to a initialized dynamic array |
| item | the item to be inserted at the front |
Error Handling
CVX_FLAG_ALLOC - if reallocation of the buffer fails | TVal da_replace_back | ( | struct dynamic_array * | self, |
| TVal | _new_ | ||
| ) |
| TVal da_replace_front | ( | struct dynamic_array * | self, |
| TVal | _new_ | ||
| ) |
| void da_sort | ( | struct dynamic_array * | self | ) |
| void da_swap | ( | struct dynamic_array * | self, |
| size_t | idx1, | ||
| size_t | idx2 | ||
| ) |