MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_array.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_array.h
32 
33  Summary:
34  An array implementation for storing pointers for the
35  Legato user interface library
36 
37  Description:
38  This is an array implementation that is used internally by the
39  Legato user interface library.
40 *******************************************************************************/
41 
42 
50 #ifndef LEGATO_ARRAY_H
51 #define LEGATO_ARRAY_H
52 
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 // *****************************************************************************
64 typedef struct leArray
65 {
66  void** values;
67  uint32_t size;
68  uint32_t capacity;
69 } leArray;
70 
71 // *****************************************************************************
83 
84 
85 // *****************************************************************************
103 leResult leArray_Resize(leArray* arr, uint32_t sz);
104 
105 // *****************************************************************************
120 leResult leArray_PushFront(leArray* arr, void* val);
121 
122 // *****************************************************************************
136 
137 // *****************************************************************************
151 leResult leArray_PushBack(leArray* arr, void* val);
152 
153 // *****************************************************************************
166 
167 // *****************************************************************************
186  uint32_t idx,
187  void* val);
188 
189 // *****************************************************************************
204 leResult leArray_RemoveAt(leArray* arr, uint32_t idx);
205 
206 // *****************************************************************************
221 leResult leArray_Remove(leArray* arr, void* val);
222 
223 // *****************************************************************************
238 void* leArray_Get(const leArray* arr, uint32_t idx);
239 
240 // *****************************************************************************
257 leResult leArray_Set(leArray* arr, uint32_t idx, void* val);
258 
259 // *****************************************************************************
273 int32_t leArray_Find(const leArray* arr, void* val);
274 
275 // *****************************************************************************
289 leResult leArray_Copy(leArray* src, leArray* dest);
290 
291 // *****************************************************************************
304 
305 #ifdef __cplusplus
306 }
307 #endif
308 
309 #endif /* LEGATO_ARRAY_H */
Common macros and definitions used by Legato.
leResult leArray_Resize(leArray *arr, uint32_t sz)
Resize array.
Definition: legato_array.c:85
void ** values
Definition: legato_array.h:66
leResult leArray_Set(leArray *arr, uint32_t idx, void *val)
Set value at index.
Definition: legato_array.c:232
leResult leArray_RemoveAt(leArray *arr, uint32_t idx)
Remove value at index.
Definition: legato_array.c:197
leResult leArray_PushBack(leArray *arr, void *val)
Push value on back.
Definition: legato_array.c:147
leResult leArray_Create(leArray *arr)
Create a new array.
Definition: legato_array.c:73
leResult leArray_InsertAt(leArray *arr, uint32_t idx, void *val)
Insert value at index.
Definition: legato_array.c:174
leResult
This enum represents function call results.
Definition: legato_common.h:123
int32_t leArray_Find(const leArray *arr, void *val)
Find a first index of value.
Definition: legato_array.c:242
leResult leArray_PushFront(leArray *arr, void *val)
Push value on front.
Definition: legato_array.c:119
leResult leArray_PopFront(leArray *arr)
Pop value from front.
Definition: legato_array.c:137
leResult leArray_Clear(leArray *arr)
Clear array.
Definition: legato_array.c:279
uint32_t size
Definition: legato_array.h:67
This struct represents a array.
Definition: legato_array.h:64
leResult leArray_PopBack(leArray *arr)
Pop value from back.
Definition: legato_array.c:164
uint32_t capacity
Definition: legato_array.h:68
leResult leArray_Copy(leArray *src, leArray *dest)
Copy array.
Definition: legato_array.c:258
struct leArray leArray
This struct represents a array.
void * leArray_Get(const leArray *arr, uint32_t idx)
Get entry at index.
Definition: legato_array.c:224
leResult leArray_Remove(leArray *arr, void *val)
Remove value.
Definition: legato_array.c:207