|
typedef int32_t(* | f_cmp) (void *data1, void *data2) |
| Prototype of the compare function. More...
|
|
|
Each function interacting with the list have one of the following formats.
Aditionaly they may have one more parametere for specific functionalities.
In the Iterator functions, the list reference is replaced by the iterator's one.
|
typedef int32_t(* | f_add) (struct no_os_list_desc *list_desc, void *data) |
| Add an element in the list. More...
|
|
typedef int32_t(* | f_edit) (struct no_os_list_desc *list_desc, void *new_data) |
| Edit an element in the list. The content is replaced by new_data. More...
|
|
typedef int32_t(* | f_read) (struct no_os_list_desc *list_desc, void **data) |
| Read an element from the list. More...
|
|
typedef int32_t(* | f_get) (struct no_os_list_desc *list_desc, void **data) |
| Read and remove an element from the list. More...
|
|
|
int32_t | no_os_list_init (struct no_os_list_desc **list_desc, enum no_os_adapter_type type, f_cmp comparator) |
|
int32_t | no_os_list_remove (struct no_os_list_desc *list_desc) |
|
int32_t | no_os_list_get_size (struct no_os_list_desc *list_desc, uint32_t *out_size) |
|
|
An iterator is used to iterate through the list. For a list, any number of iterators can be created. All must be removed before removing a list.
|
int32_t | no_os_iterator_init (struct no_os_iterator **iter, struct no_os_list_desc *list_desc, bool start) |
|
int32_t | no_os_iterator_remove (struct no_os_iterator *iter) |
|
int32_t | no_os_iterator_move (struct no_os_iterator *iter, int32_t steps) |
|
int32_t | no_os_iterator_move_to_idx (struct no_os_iterator *iter, int32_t idx) |
|
int32_t | no_os_iterator_find (struct no_os_iterator *iter, void *cmp_data) |
|
int32_t | no_os_iterator_insert (struct no_os_iterator *iter, void *data, bool after) |
|
int32_t | no_os_iterator_edit (struct no_os_iterator *iter, void *new_data) |
|
int32_t | no_os_iterator_read (struct no_os_iterator *iter, void **data) |
|
int32_t | no_os_iterator_get (struct no_os_iterator *iter, void **data) |
|
|
These functions will operate on the first or last element of the list
|
int32_t | no_os_list_add_first (struct no_os_list_desc *list_desc, void *data) |
|
int32_t | no_os_list_edit_first (struct no_os_list_desc *list_desc, void *new_data) |
|
int32_t | no_os_list_read_first (struct no_os_list_desc *list_desc, void **data) |
|
int32_t | no_os_list_get_first (struct no_os_list_desc *list_desc, void **data) |
|
int32_t | no_os_list_add_last (struct no_os_list_desc *list_desc, void *data) |
|
int32_t | no_os_list_edit_last (struct no_os_list_desc *list_desc, void *new_data) |
|
int32_t | no_os_list_read_last (struct no_os_list_desc *list_desc, void **data) |
|
int32_t | no_os_list_get_last (struct no_os_list_desc *list_desc, void **data) |
|
|
These functions use an index to identify the element in the list.
|
int32_t | no_os_list_add_idx (struct no_os_list_desc *list_desc, void *data, uint32_t idx) |
|
int32_t | no_os_list_edit_idx (struct no_os_list_desc *list_desc, void *new_data, uint32_t idx) |
|
int32_t | no_os_list_read_idx (struct no_os_list_desc *list_desc, void **data, uint32_t idx) |
|
int32_t | no_os_list_get_idx (struct no_os_list_desc *list_desc, void **data, uint32_t idx) |
|
|
These functions use the specified f_cmp at no_os_list_init to identify the element this will operate on.
|
int32_t | no_os_list_add_find (struct no_os_list_desc *list_desc, void *data) |
|
int32_t | no_os_list_edit_find (struct no_os_list_desc *list_desc, void *new_data, void *cmp_data) |
|
int32_t | no_os_list_read_find (struct no_os_list_desc *list_desc, void **data, void *cmp_data) |
|
int32_t | no_os_list_get_find (struct no_os_list_desc *list_desc, void **data, void *cmp_data) |
|
List library header.
- Author
- Mihail Chindris (mihai.nosp@m.l.ch.nosp@m.indri.nosp@m.s@an.nosp@m.alog..nosp@m.com)
- Copyright
- Copyright 2020(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Library description
This library handles double linked lists and it expose inseart, read, get and delete functions.
It also can be accesed using it member functions which wrapp function for usual list types.
Sample code
struct no_os_iterator *it;
uint32_t a;
printf("Last: %d\n", a);
printf("Current: %d\n", a);
printf("Last: %d\n", a);