MPLABĀ® Harmony Graphics Suite
legato_list.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
24 /*******************************************************************************
25  Module for Microchip Graphics Library - Legato User Interface Library
26 
27  Company:
28  Microchip Technology Inc.
29 
30  File Name:
31  legato_list.h
32 
33  Summary:
34  A linked list implementation for the Legato user interface library
35 
36  Description:
37  This is a linked list implementation that is used internally by the
38  Legato user interface library.
39 *******************************************************************************/
40 
48 #ifndef LEGATO_LIST_H
49 #define LEGATO_LIST_H
50 
52 
53 // *****************************************************************************
54 /* Structure:
55  leListNode
56 
57  Summary:
58  Linked list node definition
59 
60  Remarks:
61  None.
62 */
63 
68 typedef struct leListNode
69 {
70  struct leListNode* next;
71  void* val;
73 
74 
75 // *****************************************************************************
76 /* Structure:
77  leList
78 
79  Summary:
80  Linked list definition
81 
82  Remarks:
83  None.
84 */
85 
90 typedef struct leList
91 {
94  size_t size;
96 
97 // *****************************************************************************
108 int32_t leList_Create(leList* list);
109 
110 // *****************************************************************************
127 int32_t leList_Assign(leList* list, size_t idx, void* val);
128 
129 // *****************************************************************************
144 int32_t leList_PushFront(leList* list, void*);
145 
146 // *****************************************************************************
159 void leList_PopFront(leList* list);
160 
161 // *****************************************************************************
175 int32_t leList_PushBack(leList* list, void* val);
176 
177 // *****************************************************************************
190 int32_t leList_PopBack(leList* list);
191 
192 // *****************************************************************************
207 void* leList_Get(const leList* list, uint32_t idx);
208 
209 // *****************************************************************************
224 int32_t leList_Find(const leList* list, void* val);
225 
226 // *****************************************************************************
244 int32_t leList_InsertAt(leList* list,
245  void* val,
246  uint32_t idx);
247 
248 // *****************************************************************************
263 int32_t leList_Remove(leList* list, void* val);
264 
265 // *****************************************************************************
280 int32_t leList_RemoveAt(leList* list, uint32_t idx);
281 
282 // *****************************************************************************
296 int32_t leList_Copy(leList* l, leList* r);
297 
298 // *****************************************************************************
310 void leList_Clear(leList* list);
311 
312 // *****************************************************************************
324 void leList_Destroy(leList* list);
325 
326 #endif /* LEGATO_LIST_H */
leList::tail
leListNode * tail
Definition: legato_list.h:93
leList_Assign
int32_t leList_Assign(leList *list, size_t idx, void *val)
Assignes a new pointer.
Definition: legato_list.c:44
leList::head
leListNode * head
Definition: legato_list.h:92
leList
This struct represents a list.
Definition: legato_list.h:91
legato_memory.h
Memory functions and definitions.
leList_PushBack
int32_t leList_PushBack(leList *list, void *val)
Push value on back.
Definition: legato_list.c:141
leList_Clear
void leList_Clear(leList *list)
Clear array.
Definition: legato_list.c:421
leList_Destroy
void leList_Destroy(leList *list)
Remove array.
Definition: legato_list.c:446
leList_Copy
int32_t leList_Copy(leList *l, leList *r)
Copy list.
Definition: legato_list.c:373
leList_PushFront
int32_t leList_PushFront(leList *list, void *)
Push value on front.
Definition: legato_list.c:66
leList::size
size_t size
Definition: legato_list.h:94
leList_Remove
int32_t leList_Remove(leList *list, void *val)
Remove item.
Definition: legato_list.c:285
legato_list.h
A linked list implementation.
leList_RemoveAt
int32_t leList_RemoveAt(leList *list, uint32_t idx)
Remove item at index.
Definition: legato_list.c:331
leList_InsertAt
int32_t leList_InsertAt(leList *list, void *val, uint32_t idx)
Insert value at index.
Definition: legato_list.c:222
leList_Find
int32_t leList_Find(const leList *list, void *val)
Find index of a value.
Definition: legato_list.c:200
leListNode
struct leListNode leListNode
This struct represents a list node .
leList_Create
int32_t leList_Create(leList *list)
Create a new list.
Definition: legato_list.c:31
leListNode::next
struct leListNode * next
Definition: legato_list.h:70
leList
struct leList leList
This struct represents a list.
leList_PopBack
int32_t leList_PopBack(leList *list)
Pop value from back.
legato_common.h
Common macros and definitions used by Legato.
leListNode::val
void * val
Definition: legato_list.h:71
leListNode
This struct represents a list node .
Definition: legato_list.h:69
leList_PopFront
void leList_PopFront(leList *list)
Pop value from front.
Definition: legato_list.c:106
leList_Get
void * leList_Get(const leList *list, uint32_t idx)
Get a value from the list.
Definition: legato_list.c:181