cdcontainers  0.1.1
Library of data containers and collections for C programming language.
Functions
Modifiers

Functions

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. More...
 
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. If index is cdc_array_size(), the value is appended to the array. More...
 
void cdc_array_erase (struct cdc_array *v, size_t index)
 Removes an element at index position in the arrray. More...
 
void cdc_array_clear (struct cdc_array *v)
 Removes all the elements from the array. More...
 
enum cdc_stat cdc_array_push_back (struct cdc_array *v, void *value)
 Inserts an element at the end of the array. More...
 
static void cdc_array_pop_back (struct cdc_array *v)
 Removes a last element in the array. More...
 
enum cdc_stat cdc_array_append (struct cdc_array *v, void **data, size_t len)
 Appends elements at the end of array. More...
 
enum cdc_stat cdc_array_append_move (struct cdc_array *v, struct cdc_array *other)
 Appends one array to the end of other array. More...
 
void cdc_array_swap (struct cdc_array *a, struct cdc_array *b)
 Swaps arrays. This operation is very fast and never fails. More...
 

Detailed Description

Function Documentation

◆ cdc_array_set()

static void cdc_array_set ( struct cdc_array v,
size_t  index,
void *  value 
)
inlinestatic

Sets an element at index position to the value. The function is not called to free memory.

Parameters
[in]v- cdc_array
[in]index- index position where the value will be written
[in]value- value

◆ cdc_array_insert()

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. If index is cdc_array_size(), the value is appended to the array.

Parameters
[in]v- cdc_array
[in]index- index position where an element will be inserted
[in]value- value
Returns
CDC_STATUS_OK in a successful case or other value indicating an error.

◆ cdc_array_erase()

void cdc_array_erase ( struct cdc_array v,
size_t  index 
)

Removes an element at index position in the arrray.

Parameters
[in]v- cdc_array
[in]index- index position where an element will be removed

◆ cdc_array_clear()

void cdc_array_clear ( struct cdc_array v)

Removes all the elements from the array.

Parameters
[in]v- cdc_array

◆ cdc_array_push_back()

enum cdc_stat cdc_array_push_back ( struct cdc_array v,
void *  value 
)

Inserts an element at the end of the array.

Parameters
[in]v- cdc_array
[in]value- value
Returns
CDC_STATUS_OK in a successful case or other value indicating an error.

◆ cdc_array_pop_back()

static void cdc_array_pop_back ( struct cdc_array v)
inlinestatic

Removes a last element in the array.

Parameters
[in]v- cdc_array

◆ cdc_array_append()

enum cdc_stat cdc_array_append ( struct cdc_array v,
void **  data,
size_t  len 
)

Appends elements at the end of array.

Parameters
[in]v- cdc_array
[in]data- pointer on data
[in]len- the number of data elements
Returns
CDC_STATUS_OK in a successful case or other value indicating an error.

◆ cdc_array_append_move()

enum cdc_stat cdc_array_append_move ( struct cdc_array v,
struct cdc_array other 
)

Appends one array to the end of other array.

Parameters
[in]v- cdc_array
[in]other- cdc_array
Returns
CDC_STATUS_OK in a successful case or other value indicating an error.

◆ cdc_array_swap()

void cdc_array_swap ( struct cdc_array a,
struct cdc_array b 
)

Swaps arrays. This operation is very fast and never fails.

Parameters
[in,out]a- cdc_array
[in,out]b- cdc_array