#include <sys/types.h>
#include "../kaa_error.h"
Go to the source code of this file.
|
void * | kaa_deque_iterator_get_data (kaa_deque_iterator_t *it) |
| Extracts data pointed by an iterator. More...
|
|
kaa_deque_iterator_t * | kaa_deque_iterator_next (kaa_deque_iterator_t *it) |
| Accesses iterator placed after the given one. More...
|
|
kaa_deque_iterator_t * | kaa_deque_iterator_previous (kaa_deque_iterator_t *) |
| Accesses iterator placed before the given one. More...
|
|
void | kaa_deque_iterator_destroy (kaa_deque_iterator_t *it, kaa_deque_data_destroy_fn data_destroy_fn) |
| Releases memory occupied by an iterator. More...
|
|
kaa_error_t | kaa_deque_create (kaa_deque_t **self) |
| Create new kaa_deque_t object. More...
|
|
void | kaa_deque_destroy (kaa_deque_t *self, kaa_deque_data_destroy_fn data_destroy_fn) |
| Releases memory occupied by a kaa_deque_t object (including memory occupied by iterators). More...
|
|
kaa_error_t | kaa_deque_first (kaa_deque_t *self, kaa_deque_iterator_t **it) |
| Fetch iterator to the first element in a deque. More...
|
|
kaa_error_t | kaa_deque_last (kaa_deque_t *self, kaa_deque_iterator_t **it) |
| Fetch iterator to the last element in a deque. More...
|
|
kaa_error_t | kaa_deque_pop_front (kaa_deque_t *self, kaa_deque_iterator_t **it) |
| Fetch and remove iterator to the first element in a deque. More...
|
|
kaa_error_t | kaa_deque_pop_back (kaa_deque_t *self, kaa_deque_iterator_t **it) |
| Fetch and remove iterator to the last element in a deque. More...
|
|
kaa_error_t | kaa_deque_push_front_data (kaa_deque_t *self, void *data) |
| Add data to the beginning of the deque. More...
|
|
kaa_error_t | kaa_deque_push_front_iterator (kaa_deque_t *self, kaa_deque_iterator_t *it) |
| Add existing iterator to the beginning of the deque. More...
|
|
kaa_error_t | kaa_deque_push_back_data (kaa_deque_t *self, void *data) |
| Add data to the end of the deque. More...
|
|
kaa_error_t | kaa_deque_push_back_iterator (kaa_deque_t *self, kaa_deque_iterator_t *it) |
| Add existing iterator to the end of the deque. More...
|
|
ssize_t | kaa_deque_size (kaa_deque_t *self) |
| Returns number of elements stored in the deque. More...
|
|
kaa_deque_t * | kaa_deque_merge_move (kaa_deque_t *deque1, kaa_deque_t *deque2) |
| Moves elements from deque2 to deque1. More...
|
|
typedef void(* kaa_deque_data_destroy_fn)(void *) |
Function signature for functions used to cleanup data stored in a deque.
Definition at line 36 of file kaa_deque.h.
Iterator to access the data stored in kaa_deque_t.
Definition at line 26 of file kaa_deque.h.
Struct representing a deque object.
Definition at line 31 of file kaa_deque.h.
Create new kaa_deque_t object.
- Parameters
-
[in,out] | self | Pointer to the memory where kaa_deque_t object will be created. |
- Returns
- KAA_ERR_BADPARAM if, KAA_ERR_NOMEM if memory allocation failed, KAA_ERR_NONE otherwise.
Releases memory occupied by a kaa_deque_t object (including memory occupied by iterators).
- Parameters
-
[in,out] | self | Pointer to the kaa_deque_t object. |
[in] | data_destroy_fn | Pointer to the function which will be used to destroy the data pointed by an iterator. If NULL - no data destruction will be performed. |
Fetch iterator to the first element in a deque.
- Parameters
-
[in] | self | Pointer to the kaa_deque_t object. |
[in,out] | it | Pointer to an iterator which will contain iterator to the first element. |
- Returns
- KAA_ERR_BADPARAM if one of parameters is NULL, KAA_ERR_NONE otherwise.
Releases memory occupied by an iterator.
- Parameters
-
[in] | it | Iterator to be destroyed. |
[in] | data_destroy_fn | Pointer to the function which will be used to destroy the data pointed by an iterator. If NULL - no data destruction will be performed. |
Extracts data pointed by an iterator.
- Parameters
-
[in] | it | Valid iterator to the element in a deque. |
- Returns
- Pointer to a raw data.
Accesses iterator placed after the given one.
- Parameters
-
[in] | it | Valid iterator to the element in a deque. |
- Returns
- Next iterator or NULL if given iterator was last or NULL.
Accesses iterator placed before the given one.
- Parameters
-
[in] | it | Valid iterator to the element in a deque. |
- Returns
- Previous iterator or NULL if given iterator was first or NULL.
Fetch iterator to the last element in a deque.
- Parameters
-
[in] | self | Pointer to the kaa_deque_t object. |
[in,out] | it | Pointer to an iterator which will contain iterator to the last element. |
- Returns
- KAA_ERR_BADPARAM if one of parameters is NULL, KAA_ERR_NONE otherwise.
Moves elements from deque2 to deque1.
- Parameters
-
[in] | deque1 | Pointer to the kaa_deque_t object. |
[in] | deque2 | Pointer to the kaa_deque_t object. |
- Returns
- Pointer to the deque containing all elements from deque1 and deque2. If deque1 is NULL will return deque2, otherwise pointer to deque1.
Fetch and remove iterator to the last element in a deque.
- Parameters
-
[in] | self | Pointer to the kaa_deque_t object. |
[in,out] | it | Pointer to an iterator which will contain iterator to the last element. |
- Returns
- KAA_ERR_BADPARAM if one of parameters is NULL, KAA_ERR_NOT_FOUND if deque is empty, KAA_ERR_NONE otherwise.
Fetch and remove iterator to the first element in a deque.
- Parameters
-
[in] | self | Pointer to the kaa_deque_t object. |
[in,out] | it | Pointer to an iterator which will contain iterator to the first element. |
- Returns
- KAA_ERR_BADPARAM if one of parameters is NULL, KAA_ERR_NOT_FOUND if deque is empty, KAA_ERR_NONE otherwise.
Add data to the end of the deque.
Allocates memory for new kaa_deque_iterator_t object.
- Parameters
-
[in] | self | Pointer to the kaa_deque_t object. |
[in] | data | Pointer to the data. |
- Returns
- KAA_ERR_BADPARAM if parameter self is NULL, KAA_ERR_NOMEM if memory allocation for a new iterator fails, KAA_ERR_NONE otherwise.
Add existing iterator to the end of the deque.
No additional memory allocation is performed.
- Parameters
-
[in] | self | Pointer to the kaa_deque_t object. |
[in] | it | Iterator to be added. |
- Returns
- KAA_ERR_BADPARAM if one of parameters is NULL, KAA_ERR_NONE otherwise.
Add data to the beginning of the deque.
Allocates memory for new kaa_deque_iterator_t object.
- Parameters
-
[in] | self | Pointer to the kaa_deque_t object. |
[in] | data | Pointer to the data. |
- Returns
- KAA_ERR_BADPARAM if parameter self is NULL, KAA_ERR_NOMEM if memory allocation for a new iterator fails, KAA_ERR_NONE otherwise.
Add existing iterator to the beginning of the deque.
No additional memory allocation is performed.
- Parameters
-
[in] | self | Pointer to the kaa_deque_t object. |
[in] | it | Iterator to be added. |
- Returns
- KAA_ERR_BADPARAM if one of parameters is NULL, KAA_ERR_NONE otherwise.
Returns number of elements stored in the deque.
- Parameters
-
[in] | self | Pointer to the kaa_deque_t object. |
- Returns
- Number ( >= 0 ) of the elements in a deque, -1 if parameter self is NULL.