MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
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 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 // *****************************************************************************
58 /* Structure:
59  leListNode
60 
61  Summary:
62  Linked list node definition
63 
64  Remarks:
65  None.
66 */
67 
72 typedef struct leListNode
73 {
74  struct leListNode* next;
75  void* val;
76 } leListNode;
77 
78 
79 // *****************************************************************************
80 /* Structure:
81  leList
82 
83  Summary:
84  Linked list definition
85 
86  Remarks:
87  None.
88 */
89 
94 typedef struct leList
95 {
98  size_t size;
99 } leList;
100 
101 // *****************************************************************************
112 int32_t leList_Create(leList* list);
113 
114 // *****************************************************************************
131 int32_t leList_Assign(leList* list, size_t idx, void* val);
132 
133 // *****************************************************************************
148 int32_t leList_PushFront(leList* list, void*);
149 
150 // *****************************************************************************
163 void leList_PopFront(leList* list);
164 
165 // *****************************************************************************
179 int32_t leList_PushBack(leList* list, void* val);
180 
181 // *****************************************************************************
194 int32_t leList_PopBack(leList* list);
195 
196 // *****************************************************************************
211 void* leList_Get(const leList* list, uint32_t idx);
212 
213 // *****************************************************************************
228 int32_t leList_Find(const leList* list, void* val);
229 
230 // *****************************************************************************
248 int32_t leList_InsertAt(leList* list,
249  void* val,
250  uint32_t idx);
251 
252 // *****************************************************************************
267 int32_t leList_Remove(leList* list, void* val);
268 
269 // *****************************************************************************
284 int32_t leList_RemoveAt(leList* list, uint32_t idx);
285 
286 // *****************************************************************************
300 int32_t leList_Copy(leList* l, leList* r);
301 
302 // *****************************************************************************
314 void leList_Clear(leList* list);
315 
316 // *****************************************************************************
328 void leList_Destroy(leList* list);
329 
330 #ifdef __cplusplus
331 }
332 #endif
333 
334 #endif /* LEGATO_LIST_H */
struct leList leList
This struct represents a list.
struct leListNode leListNode
This struct represents a list node .
This struct represents a list node .
Definition: legato_list.h:72
Common macros and definitions used by Legato.
int32_t leList_PushFront(leList *list, void *)
Push value on front.
Definition: legato_list.c:66
int32_t leList_Remove(leList *list, void *val)
Remove item.
Definition: legato_list.c:285
leListNode * head
Definition: legato_list.h:96
int32_t leList_PopBack(leList *list)
Pop value from back.
int32_t leList_RemoveAt(leList *list, uint32_t idx)
Remove item at index.
Definition: legato_list.c:331
void * leList_Get(const leList *list, uint32_t idx)
Get a value from the list.
Definition: legato_list.c:181
int32_t leList_Create(leList *list)
Create a new list.
Definition: legato_list.c:31
int32_t leList_Find(const leList *list, void *val)
Find index of a value.
Definition: legato_list.c:200
This struct represents a list.
Definition: legato_list.h:94
void leList_Clear(leList *list)
Clear array.
Definition: legato_list.c:421
void leList_PopFront(leList *list)
Pop value from front.
Definition: legato_list.c:106
void leList_Destroy(leList *list)
Remove array.
Definition: legato_list.c:446
size_t size
Definition: legato_list.h:98
int32_t leList_Copy(leList *l, leList *r)
Copy list.
Definition: legato_list.c:373
leListNode * tail
Definition: legato_list.h:97
int32_t leList_Assign(leList *list, size_t idx, void *val)
Assignes a new pointer.
Definition: legato_list.c:44
void * val
Definition: legato_list.h:75
struct leListNode * next
Definition: legato_list.h:74
int32_t leList_PushBack(leList *list, void *val)
Push value on back.
Definition: legato_list.c:141
int32_t leList_InsertAt(leList *list, void *val, uint32_t idx)
Insert value at index.
Definition: legato_list.c:222