26#ifndef SOPC_SINGLY_LINKED_LIST_H_
27#define SOPC_SINGLY_LINKED_LIST_H_
99 int8_t (*pCompFn)(uintptr_t left, uintptr_t right));
uint32_t SOPC_SLinkedList_GetCapacity(SOPC_SLinkedList *list)
Get the maximum number of elements that can be contained in the linked list.
void SOPC_SLinkedList_EltGenericFree(uint32_t id, uintptr_t val)
Frees the value of an element of the SOPC_SLinkedList.
uintptr_t SOPC_SLinkedList_Next(SOPC_SLinkedListIterator *it)
Return the next element pointed by iterator in the linked list (iterate from head to tail)
uintptr_t SOPC_SLinkedList_SortedInsert(SOPC_SLinkedList *list, uint32_t id, uintptr_t value, int8_t(*pCompFn)(uintptr_t left, uintptr_t right))
Insert element in sorted list in correct index regarding compare function.
uintptr_t SOPC_SLinkedList_Prepend(SOPC_SLinkedList *list, uint32_t id, uintptr_t value)
Add a new element (and allocate new list element) before head of the given linked list.
uint32_t SOPC_SLinkedList_GetLength(SOPC_SLinkedList *list)
Get the number of elements in the linked list.
uintptr_t SOPC_SLinkedList_NextWithId(SOPC_SLinkedListIterator *it, uint32_t *pId)
Return the next element pointed by iterator in the linked list (iterate from head to tail)
struct SOPC_SLinkedList SOPC_SLinkedList
Singly linked list structure.
Definition sopc_singly_linked_list.h:36
SOPC_SLinkedList_Elt * SOPC_SLinkedListIterator
Definition sopc_singly_linked_list.h:40
uintptr_t SOPC_SLinkedList_PopLast(SOPC_SLinkedList *list)
Get and remove the last element of the list.
bool SOPC_SLinkedList_SetCapacity(SOPC_SLinkedList *list, size_t sizeMax)
Set the maximum number of elements that can be contained in the linked list. It might be used to modi...
uintptr_t SOPC_SLinkedList_RemoveFromValuePtr(SOPC_SLinkedList *list, uintptr_t value)
Find and remove the first value pointer equal in the linked list (iterate from head to tail)
SOPC_SLinkedList * SOPC_SLinkedList_Create(size_t sizeMax)
Create and allocate a new singly linked list containing 0 elements with a size limit of the given siz...
void SOPC_SLinkedList_Apply(SOPC_SLinkedList *list, void(*pFn)(uint32_t id, uintptr_t val))
Apply a function to the value of each element of the list.
uintptr_t SOPC_SLinkedList_GetLast(SOPC_SLinkedList *list)
Get the tail element of the list without removing it. Note: it shall not be freed.
uintptr_t SOPC_SLinkedList_RemoveFromId(SOPC_SLinkedList *list, uint32_t id)
Find and remove the first value associated to the given id in the linked list (iterate from head to t...
SOPC_SLinkedListIterator SOPC_SLinkedList_GetIterator(SOPC_SLinkedList *list)
Get an iterator on a linked list to iterate on elements from head to tail.
uintptr_t SOPC_SLinkedList_FindFromId(SOPC_SLinkedList *list, uint32_t id)
Find the first value associated to the given id in the linked list (iterate from head to tail)
bool SOPC_SLinkedList_HasNext(const SOPC_SLinkedListIterator *it)
Return true if iterator has a non NULL value to provide on next iteration (iterate from head to tail)
struct SOPC_SLinkedList_Elt SOPC_SLinkedList_Elt
Definition sopc_singly_linked_list.h:38
void SOPC_SLinkedList_Clear(SOPC_SLinkedList *list)
Delete all elements of the given linked list.
void SOPC_SLinkedList_Delete(SOPC_SLinkedList *list)
Delete and deallocate the given linked list.
uintptr_t SOPC_SLinkedList_Append(SOPC_SLinkedList *list, uint32_t id, uintptr_t value)
Add a new element (and allocate new list element) to the tail of the given linked list.
uintptr_t SOPC_SLinkedList_GetHead(SOPC_SLinkedList *list)
Get the head element of the list without removing it. Note: it shall not be freed.
uintptr_t SOPC_SLinkedList_PopHead(SOPC_SLinkedList *list)
Get and remove the head element of the list.