libamxc  1.10.3
C Generic Data Containers
amxc_llist.h File Reference

Ambiorix linked list API header file. More...

#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include <amxc/amxc_common.h>

Go to the source code of this file.

Data Structures

struct  _amxc_llist_it
 The linked list iterator structure. More...
 
struct  _amxc_llist
 The linked list structure. More...
 

Macros

#define AMXC_LLIST_RANGE   UINT32_MAX
 
#define amxc_llist_it_get_data(it, type, member)    amxc_container_of(it, type, member)
 Gets the data pointer from a linked list iterator. More...
 
#define amxc_llist_for_each(it, list)
 Loops over the list from head to tail. More...
 
#define amxc_llist_iterate(it, list)
 Loops over the list from head to tail. More...
 
#define amxc_llist_for_each_reverse(it, list)
 Loops over the list from tail to head. More...
 
#define amxc_llist_iterate_reverse(it, list)
 Loops over the list from tail to head. More...
 

Typedefs

typedef struct _amxc_llist_it amxc_llist_it_t
 The linked list iterator structure. More...
 
typedef struct _amxc_llist amxc_llist_t
 The linked list structure. More...
 
typedef void(* amxc_llist_it_delete_t) (amxc_llist_it_t *it)
 Definition of the linked list item delete function. More...
 
typedef int(* amxc_llist_it_cmp_t) (amxc_llist_it_t *it1, amxc_llist_it_t *it2)
 Type definition of a linked list iterator compare callback function. More...
 

Functions

int amxc_llist_new (amxc_llist_t **llist)
 Allocates a linked list. More...
 
void amxc_llist_delete (amxc_llist_t **llist, amxc_llist_it_delete_t func)
 Frees the previously allocated linked list. More...
 
int amxc_llist_init (amxc_llist_t *const llist)
 Initializes a linked list. More...
 
void amxc_llist_clean (amxc_llist_t *const llist, amxc_llist_it_delete_t func)
 Removes all items from the linked list. More...
 
int amxc_llist_move (amxc_llist_t *const dest, amxc_llist_t *const src)
 Moves all items from one linked list to another linked list. More...
 
bool amxc_llist_is_empty (const amxc_llist_t *const llist)
 Checks that the linked list is empty. More...
 
size_t amxc_llist_size (const amxc_llist_t *const llist)
 Calculates the size of the linked list. More...
 
int amxc_llist_append (amxc_llist_t *const llist, amxc_llist_it_t *const it)
 Adds an item to the end of the linked list. More...
 
int amxc_llist_prepend (amxc_llist_t *const llist, amxc_llist_it_t *const it)
 Adds an item to the beginning of the linked list. More...
 
amxc_llist_it_tamxc_llist_get_at (const amxc_llist_t *const llist, const unsigned int index)
 Gets an item at a certain position of the linked list. More...
 
int amxc_llist_set_at (amxc_llist_t *llist, const unsigned int index, amxc_llist_it_t *const it)
 Inserts an item at a certain position. More...
 
int amxc_llist_it_init (amxc_llist_it_t *const it)
 Initializes a linked list iterator. More...
 
void amxc_llist_it_clean (amxc_llist_it_t *const it, amxc_llist_it_delete_t func)
 Removes the iterator from the list and frees allocated memory. More...
 
void amxc_llist_it_take (amxc_llist_it_t *const it)
 Removes the iterator from the list. More...
 
int amxc_llist_it_insert_before (amxc_llist_it_t *const reference, amxc_llist_it_t *const it)
 Inserts an iterator before a reference interator in the list. More...
 
int amxc_llist_it_insert_after (amxc_llist_it_t *const reference, amxc_llist_it_t *const it)
 Inserts an iterator after another reference interator in the list. More...
 
unsigned int amxc_llist_it_index_of (const amxc_llist_it_t *const it)
 Gets the index of an iterator in the list. More...
 
int amxc_llist_it_swap (amxc_llist_it_t *it1, amxc_llist_it_t *it2)
 Swaps two linked list iterators. More...
 
int amxc_llist_sort (amxc_llist_t *const llist, amxc_llist_it_cmp_t cmp)
 Sorts a linked list. More...
 
AMXC_INLINE amxc_llist_it_tamxc_llist_get_first (const amxc_llist_t *const llist)
 Gets the first item of the linked list. More...
 
AMXC_INLINE amxc_llist_it_tamxc_llist_get_last (const amxc_llist_t *const llist)
 Gets the last item of the linked list. More...
 
AMXC_INLINE amxc_llist_it_tamxc_llist_take_first (amxc_llist_t *const llist)
 Removes the first item from the linked list. More...
 
AMXC_INLINE amxc_llist_it_tamxc_llist_take_last (amxc_llist_t *const llist)
 Removes the last item from the linked list. More...
 
AMXC_INLINE amxc_llist_it_tamxc_llist_take_at (const amxc_llist_t *llist, const unsigned int index)
 Removes an item at a certain position of the linked list. More...
 
AMXC_INLINE amxc_llist_it_tamxc_llist_it_get_next (const amxc_llist_it_t *const reference)
 Gets the next iterator in the list. More...
 
AMXC_INLINE amxc_llist_it_tamxc_llist_it_get_previous (const amxc_llist_it_t *const reference)
 Gets the previous iterator in the list. More...
 
AMXC_INLINE bool amxc_llist_it_is_in_list (const amxc_llist_it_t *const it)
 Checks that an iterator is in a list. More...
 

Detailed Description

Ambiorix linked list API header file.

Definition in file amxc_llist.h.

Macro Definition Documentation

◆ AMXC_LLIST_RANGE

#define AMXC_LLIST_RANGE   UINT32_MAX

Definition at line 69 of file amxc_llist.h.