30 #ifndef CDCONTAINERS_INCLUDE_CDCONTAINERS_VECTOR_H 31 #define CDCONTAINERS_INCLUDE_CDCONTAINERS_VECTOR_H 121 assert(index < v->
size);
252 assert(index < v->
size);
332 #ifdef CDC_USE_SHORT_NAMES 336 #define array_ctor(...) cdc_array_ctor(__VA_ARGS__) 337 #define array_ctorl(...) cdc_array_ctorl(__VA_ARGS__) 338 #define array_ctorv(...) cdc_array_ctorv(__VA_ARGS__) 339 #define array_dtor(...) cdc_array_dtor(__VA_ARGS__) 342 #define array_get(...) cdc_array_get(__VA_ARGS__) 343 #define array_at(...) cdc_array_at(__VA_ARGS__) 344 #define array_front(...) cdc_array_front(__VA_ARGS__) 345 #define array_back(...) cdc_array_back(__VA_ARGS__) 346 #define array_data(...) cdc_array_data(__VA_ARGS__) 349 #define array_reserve(...) cdc_array_reserve(__VA_ARGS__) 350 #define array_empty(...) cdc_array_empty(__VA_ARGS__) 351 #define array_size(...) cdc_array_size(__VA_ARGS__) 352 #define array_capacity(...) cdc_array_capacity(__VA_ARGS__) 353 #define array_cap_exp(...) cdc_array_cap_exp(__VA_ARGS__) 354 #define array_shrink_to_fit(...) cdc_array_shrink_to_fit(__VA_ARGS__) 357 #define array_set(...) cdc_array_set(__VA_ARGS__) 358 #define array_insert(...) cdc_array_insert(__VA_ARGS__) 359 #define array_erase(...) cdc_array_erase(__VA_ARGS__) 360 #define array_clear(...) cdc_array_clear(__VA_ARGS__) 361 #define array_push_back(...) cdc_array_push_back(__VA_ARGS__) 362 #define array_pop_back(...) cdc_array_pop_back(__VA_ARGS__) 363 #define array_append(...) cdc_array_append(__VA_ARGS__) 364 #define array_append_move(...) cdc_array_append_move(__VA_ARGS__) 365 #define array_swap(...) cdc_array_swap(__VA_ARGS__) 368 #endif // CDSTRUCTURES_INCLUDE_CDCONTAINERS_VECTOR_H size_t size
Definition: array.h:51
enum cdc_stat cdc_array_ctor(struct cdc_array **v, struct cdc_data_info *info)
Constructs an empty array.
enum cdc_stat cdc_array_ctorl(struct cdc_array **v, struct cdc_data_info *info,...)
Constructs an array, initialized by an variable number of pointers. The last pointer must be CDC_END...
enum cdc_stat cdc_array_reserve(struct cdc_array *v, size_t capacity)
Attempts to allocate memory for at least size elements. If you know in advance how large the array wi...
enum cdc_stat cdc_array_insert(struct cdc_array *v, size_t index, void *value)
Inserts value at |index| position in the array. If index is 0, the value is prepended to the array...
void cdc_array_erase(struct cdc_array *v, size_t index)
Removes an element at index position in the arrray.
void cdc_array_swap(struct cdc_array *a, struct cdc_array *b)
Swaps arrays. This operation is very fast and never fails.
static void cdc_array_set(struct cdc_array *v, size_t index, void *value)
Sets an element at index position to the value. The function is not called to free memory...
Definition: array.h:249
The cdc_array is service struct.
Definition: array.h:50
static void cdc_array_pop_back(struct cdc_array *v)
Removes a last element in the array.
Definition: array.h:295
void cdc_array_clear(struct cdc_array *v)
Removes all the elements from the array.
static void * cdc_array_front(struct cdc_array *v)
Returns a first element in the array.
Definition: array.h:142
enum cdc_stat cdc_array_append_move(struct cdc_array *v, struct cdc_array *other)
Appends one array to the end of other array.
enum cdc_stat cdc_array_at(struct cdc_array *v, size_t index, void **elem)
Writes to pointer an element from specified position in the array. Bounds checking is performed...
static size_t cdc_array_capacity(struct cdc_array *v)
Returns the number of elements that the container has currently allocated space for.
Definition: array.h:221
void ** buffer
Definition: array.h:53
cdc_stat
Definition: status.h:24
enum cdc_stat cdc_array_append(struct cdc_array *v, void **data, size_t len)
Appends elements at the end of array.
enum cdc_stat cdc_array_shrink_to_fit(struct cdc_array *v)
Requests the container to reduce its capacity to fit its size.
enum cdc_stat cdc_array_ctorv(struct cdc_array **v, struct cdc_data_info *info, va_list args)
Constructs an array, initialized by args. The last pointer must be CDC_END.
static void ** cdc_array_data(struct cdc_array *v)
Returns a pointer to the data stored in the array.
Definition: array.h:168
struct cdc_data_info * dinfo
Definition: array.h:54
The cdc_data_info struct used to initialize contaners.
Definition: common.h:71
static size_t cdc_array_size(struct cdc_array *v)
Returns the number of elements in the array.
Definition: array.h:209
void cdc_array_dtor(struct cdc_array *v)
Destroys the array.
enum cdc_stat cdc_array_push_back(struct cdc_array *v, void *value)
Inserts an element at the end of the array.
size_t capacity
Definition: array.h:52
static bool cdc_array_empty(struct cdc_array *v)
Checks if the array has no elements.
Definition: array.h:197
static void * cdc_array_back(struct cdc_array *v)
Returns a last element in the array.
Definition: array.h:155
static void * cdc_array_get(struct cdc_array *v, size_t index)
Returns an element at index position in the array.
Definition: array.h:118