Module for storing items in the ordered list. More...
Modules | |
Sorted list configuration | |
Data Structures | |
struct | nrf_sortlist_item_s |
A structure for item in the sorted list. More... | |
struct | nrf_sortlist_cb_t |
Sorted list instance control block. More... | |
struct | nrf_sortlist_t |
Structure for sorted list instance. More... | |
Macros | |
#define | NRF_SORTLIST_INST_NAME(_name) |
Macro for conditionally including instance name. More... | |
#define | NRF_SORTLIST_DEF(_name, _compare_func) |
Macro for defining a sorted list instance. More... | |
Typedefs | |
typedef struct nrf_sortlist_item_s | nrf_sortlist_item_t |
Forward declaration of sorted list item. | |
typedef bool(* | nrf_sortlist_compare_func_t )(nrf_sortlist_item_t *p_item0, nrf_sortlist_item_t *p_item1) |
Prototype of a function which compares two elements. More... | |
Functions | |
void | nrf_sortlist_add (nrf_sortlist_t const *p_list, nrf_sortlist_item_t *p_item) |
Function for adding an element into a list. More... | |
nrf_sortlist_item_t * | nrf_sortlist_pop (nrf_sortlist_t const *p_list) |
Function for removing an item from the list head. More... | |
nrf_sortlist_item_t const * | nrf_sortlist_peek (nrf_sortlist_t const *p_list) |
Function for getting (without removing) an item from the list head. More... | |
nrf_sortlist_item_t const * | nrf_sortlist_next (nrf_sortlist_item_t const *p_item) |
Function for iterating over the list. More... | |
bool | nrf_sortlist_remove (nrf_sortlist_t const *p_list, nrf_sortlist_item_t *p_item) |
Function for removing an item from the queue. More... | |
Module for storing items in the ordered list.
#define NRF_SORTLIST_DEF | ( | _name, | |
_compare_func | |||
) |
Macro for defining a sorted list instance.
_name | Instance name. |
_compare_func | Pointer to a compare function. |
#define NRF_SORTLIST_INST_NAME | ( | _name | ) |
Macro for conditionally including instance name.
_name | Instance name. |
typedef bool(* nrf_sortlist_compare_func_t)(nrf_sortlist_item_t *p_item0, nrf_sortlist_item_t *p_item1) |
Prototype of a function which compares two elements.
p_item0 | Item 0. |
p_item1 | Item 1. |
void nrf_sortlist_add | ( | nrf_sortlist_t const * | p_list, |
nrf_sortlist_item_t * | p_item | ||
) |
Function for adding an element into a list.
New item will be placed in the queue based on the compare function.
p_list | List instance. |
p_item | Item. |
nrf_sortlist_item_t const* nrf_sortlist_next | ( | nrf_sortlist_item_t const * | p_item | ) |
Function for iterating over the list.
p_item | Item in the list. |
nrf_sortlist_item_t const* nrf_sortlist_peek | ( | nrf_sortlist_t const * | p_list | ) |
Function for getting (without removing) an item from the list head.
p_list | List instance. |
nrf_sortlist_item_t* nrf_sortlist_pop | ( | nrf_sortlist_t const * | p_list | ) |
Function for removing an item from the list head.
p_list | List instance. |
bool nrf_sortlist_remove | ( | nrf_sortlist_t const * | p_list, |
nrf_sortlist_item_t * | p_item | ||
) |
Function for removing an item from the queue.
p_list | List instance. |
p_item | Item. |
true | Item was found and removed. |
false | Item not found in the list. |