HALFRED
0.4.0
|
Introduction.
The LinkList module provides the functionality of a single-link list of items.
Data Structures | |
struct | LLSTItemDesc |
struct | LLSTListDesc |
Macros | |
#define | LLST_DECLARE(name, size, attributes) |
Typedefs | |
typedef struct LLSTItemDesc | LLSTItemDesc |
typedef struct LLSTItemDesc * | LLSTItem |
typedef struct LLSTListDesc * | LLSTList |
Functions | |
HALRESULT | LLST_Init (LLSTList list, LLSTItem items, size_t size) |
HALRESULT | LLST_Deinit (LLSTList list) |
HALRESULT | LLST_AddItem (LLSTList list, const void *data, LLSTItem *new_item) |
const void * | LLST_UnlinkFirstItem (LLSTList list) |
const void * | LLST_UnlinkLastItem (LLSTList list) |
const void * | LLST_UnlinkItem (LLSTList list, LLSTItem item) |
LLSTItem | LLST_GetFirstItem (LLSTList list) |
LLSTItem | LLST_GetNextItem (LLSTItem item) |
LLSTItem | LLST_GetLastItem (LLSTList list) |
LLSTItem | LLST_GetItemByIndex (LLSTList list, size_t index) |
LLSTItem | LLST_GetItemByData (LLSTList list, const void *data) |
const void * | LLST_GetItemData (LLSTItem item) |
HALRESULT | LLST_SetItemData (LLSTItem item, const void *data) |
#define LLST_DECLARE | ( | name, | |
size, | |||
attributes | |||
) |
Initializes link list.
list | link list |
items | pointer to a pool of items |
size | number of elements in the pool of items |
HALRESULT_OK | if list was initialized successfully |
HALRESULT_EMPTY_LINKLIST | when the provided pool size is zero |
HALRESULT_INVALID_LINKLIST | when the provided pool or list is invalid |
References DIAG_DEFAULT_CHANNEL.
Deinitializes link list.
list | link list |
HALRESULT_OK | if list was deinitialized successfully |
HALRESULT_INVALID_LINKLIST | if provided link list is invalid |
References DIAG_DEFAULT_CHANNEL.
Adds new item to the list.
list | link list |
data | item data |
new_item | pointer to a variable where the new item will be stored |
HALRESULT_OK | if new element was added successfully |
HALRESULT_LINKLIST_FULL | if the list is full and new element cannot be added |
HALRESULT_INVALID_LINKLIST_DATA | if the provided data is NULL |
HALRESULT_INVALID_LINKLIST | if the list is invalid |
HALRESULT_EMPTY_LINKLIST | if the list pool size is zero |
References CORE_EnterCritical, CORE_ExitCritical, and DIAG_DEFAULT_CHANNEL.
const void* LLST_UnlinkFirstItem | ( | LLSTList | list | ) |
Removes first item from the list.
list | link list |
References CORE_EnterCritical, CORE_ExitCritical, and DIAG_DEFAULT_CHANNEL.
const void* LLST_UnlinkLastItem | ( | LLSTList | list | ) |
Removes last item from the list.
list | link list |
References LLST_UnlinkItem().
Removes a given element from the list.
list | link list |
item |
References CORE_EnterCritical, CORE_ExitCritical, and DIAG_DEFAULT_CHANNEL.
Referenced by LLST_UnlinkLastItem().
Retrieves first element on the list.
list | link list |
References DIAG_DEFAULT_CHANNEL.
Retrieves next element on the list, relative to the given one.
item | element on the list |
References DIAG_DEFAULT_CHANNEL.
Retrieves last element on the list.
list | link list |
References DIAG_DEFAULT_CHANNEL.
Retrieves item under given index.
list | link list |
index | index (0-based) |
References DIAG_DEFAULT_CHANNEL.
Retrieves item associated with the given data.
list | link list |
data | item data |
References DIAG_DEFAULT_CHANNEL.
const void* LLST_GetItemData | ( | LLSTItem | item | ) |
Retrieves data associated with a given element.
item | element |
References DIAG_DEFAULT_CHANNEL.
Sets data for the given item.
item | link list item |
data | new data pointer |
HALRESULT_OK | if the item data was set successfully |
HALRESULT_INVALID_LINKLIST_ITEM | if item was invalid |
References DIAG_DEFAULT_CHANNEL.