# CO_DLIST
[COMMON]

Double linked list management. More...

Collaboration diagram for CO_DLIST:

## Data Structures
struct | co_dlist_hdr
| Double linked list element header. More...
struct | co_dlist
| Double link list. More...
## Functions
void | co_dlist_init (struct co_dlist *list)
| Initialize the double linked list.
void | co_dlist_push_back (struct co_dlist *list, struct co_dlist_hdr *list_hdr)
| Add an element at the end of the double linked list.
void | co_dlist_push_front (struct co_dlist *list, struct co_dlist_hdr *list_hdr)
| Add an element at the beginning of the double linked list.
struct co_dlist_hdr * | co_dlist_pop_front (struct co_dlist *list)
| Extract the first element of the double linked list.
void | co_dlist_extract (struct co_dlist *list, struct co_dlist_hdr const *list_hdr)
| Search for a specific element in the list, and extract it if found.
__INLINE bool | co_dlist_is_empty (struct co_dlist const *list)
| Test if the list is empty.
__INLINE uint32_t | co_dlist_cnt (struct co_dlist const *list)
| Return the number of element of the list.
__INLINE struct co_dlist_hdr * | co_dlist_pick (struct co_dlist const *list)
| Pick the first element from the list without removing it.
__INLINE struct co_dlist_hdr * | co_dlist_next (struct co_dlist_hdr const *list_hdr)
| Return following element of a list element.

## Detailed Description

Double linked list management.

This module contains the double linked list structures and handling functions.

## Function Documentation

__INLINE uint32_t co_dlist_cnt | ( | struct co_dlist const * | list | ) |

Return the number of element of the list.

Parameters:

  `[in,out]` | list | Pointer to the double linked list.

Returns:
  The number of elements in the list.

Definition at line 157 of file co_dlist.h.

References co_dlist::cnt.

void co_dlist_extract | ( | struct co_dlist * | list,
|  | struct co_dlist_hdr const * | list_hdr |
| ) |  |  |

Search for a specific element in the list, and extract it if found.

Parameters:

  `[in,out]` | list | Pointer to the double linked list.
  `[in]` | list_hdr | Pointer to the searched element.

void co_dlist_init | ( | struct co_dlist * | list | ) |

Initialize the double linked list.

Parameters:

  `[in,out]` | list | Pointer to the double linked list.

__INLINE bool co_dlist_is_empty | ( | struct co_dlist const * | list | ) |

Test if the list is empty.

Parameters:

  `[in]` | list | Pointer to the double linked list.

Returns:
  true if the list is empty, false else otherwise.

Definition at line 141 of file co_dlist.h.

References co_dlist::first.

__INLINE struct co_dlist_hdr* co_dlist_next | ( | struct co_dlist_hdr const * | list_hdr | ) | `[read]`

Return following element of a list element.

Parameters:

  `[in]` | list_hdr | Pointer to the double linked list element.

Returns:
  The pointer to the next element.

Definition at line 186 of file co_dlist.h.

References co_dlist_hdr::next.

__INLINE struct co_dlist_hdr* co_dlist_pick | ( | struct co_dlist const * | list | ) | `[read]`

Pick the first element from the list without removing it.

Parameters:

  `[in]` | list | Pointer to the double linked list.

Returns:
  First element address. Returns NULL pointer if the list is empty.

Definition at line 171 of file co_dlist.h.

References co_dlist::first.

struct co_dlist_hdr * co_dlist_pop_front | ( | struct co_dlist * | list | ) | `[read]`

Extract the first element of the double linked list.

Parameters:

  `[in,out]` | list | Pointer to the double linked list.

Returns:
  The pointer to the element extracted, and NULL if the list is empty.

void co_dlist_push_back | ( | struct co_dlist * | list,
|  | struct co_dlist_hdr * | list_hdr |
| ) |  |  |

Add an element at the end of the double linked list.

Parameters:

  `[in,out]` | list | Pointer to the double linked list.
  `[in,out]` | list_hdr | Pointer to the element to add at the end of the list.

void co_dlist_push_front | ( | struct co_dlist * | list,
|  | struct co_dlist_hdr * | list_hdr |
| ) |  |  |

Add an element at the beginning of the double linked list.

Parameters:

  `[in,out]` | list | Pointer to the double linked list.
  `[in,out]` | list_hdr | Pointer to the element to add at the beginning of the list.