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

Functions

static void cdc_circular_array_set (struct cdc_circular_array *d, 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_circular_array_insert (struct cdc_circular_array *d, size_t index, void *value)
 Inserts value at |index| position in the circular array. If index is 0, the value is prepended to the circular array. If index is cdc_circular_array_size(), the value is appended to the circular array. More...
 
void cdc_circular_array_erase (struct cdc_circular_array *d, size_t index)
 Removes an element at index position in the circular arrray. More...
 
void cdc_circular_array_clear (struct cdc_circular_array *d)
 Removes all the elements from the circular array. More...
 
enum cdc_stat cdc_circular_array_push_back (struct cdc_circular_array *d, void *value)
 Inserts an element at the end of the circular array. More...
 
void cdc_circular_array_pop_back (struct cdc_circular_array *d)
 Removes a last element in the circular array. More...
 
enum cdc_stat cdc_circular_array_push_front (struct cdc_circular_array *d, void *value)
 Inserts an element at the beginning of the circular array. More...
 
void cdc_circular_array_pop_front (struct cdc_circular_array *d)
 Removes a first element in the circular array. More...
 
void cdc_circular_array_swap (struct cdc_circular_array *a, struct cdc_circular_array *b)
 Swaps circular arrays a and b. This operation is very fast and never fails. More...
 

Detailed Description

Function Documentation

◆ cdc_circular_array_set()

static void cdc_circular_array_set ( struct cdc_circular_array d,
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]d- cdc_circular_array
[in]index- index position where the value will be written
[in]value- value

◆ cdc_circular_array_insert()

enum cdc_stat cdc_circular_array_insert ( struct cdc_circular_array d,
size_t  index,
void *  value 
)

Inserts value at |index| position in the circular array. If index is 0, the value is prepended to the circular array. If index is cdc_circular_array_size(), the value is appended to the circular array.

Parameters
[in]d- cdc_circular_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_circular_array_erase()

void cdc_circular_array_erase ( struct cdc_circular_array d,
size_t  index 
)

Removes an element at index position in the circular arrray.

Parameters
[in]d- cdc_circular_array
[in]index- index position where an element will be removed

◆ cdc_circular_array_clear()

void cdc_circular_array_clear ( struct cdc_circular_array d)

Removes all the elements from the circular array.

Parameters
[in]d- cdc_circular_array

◆ cdc_circular_array_push_back()

enum cdc_stat cdc_circular_array_push_back ( struct cdc_circular_array d,
void *  value 
)

Inserts an element at the end of the circular array.

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

◆ cdc_circular_array_pop_back()

void cdc_circular_array_pop_back ( struct cdc_circular_array d)

Removes a last element in the circular array.

Parameters
[in]d- cdc_circular_array

◆ cdc_circular_array_push_front()

enum cdc_stat cdc_circular_array_push_front ( struct cdc_circular_array d,
void *  value 
)

Inserts an element at the beginning of the circular array.

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

◆ cdc_circular_array_pop_front()

void cdc_circular_array_pop_front ( struct cdc_circular_array d)

Removes a first element in the circular array.

Parameters
[in]d- cdc_circular_array

◆ cdc_circular_array_swap()

void cdc_circular_array_swap ( struct cdc_circular_array a,
struct cdc_circular_array b 
)

Swaps circular arrays a and b. This operation is very fast and never fails.

Parameters
a- cdc_circular_array
b- cdc_circular_array