MPLABĀ® Harmony Graphics Suite  GFX v3.13.0
Legato API Documentation
legato_list.h File Reference

A linked list implementation. More...

Include dependency graph for legato_list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  leListNode
 This struct represents a list node . More...
 
struct  leList
 This struct represents a list. More...
 

Typedefs

typedef struct leListNode leListNode
 This struct represents a list node . More...
 
typedef struct leList leList
 This struct represents a list. More...
 

Functions

int32_t leList_Create (leList *list)
 Create a new list. More...
 
int32_t leList_Assign (leList *list, size_t idx, void *val)
 Assignes a new pointer. More...
 
int32_t leList_PushFront (leList *list, void *)
 Push value on front. More...
 
void leList_PopFront (leList *list)
 Pop value from front. More...
 
int32_t leList_PushBack (leList *list, void *val)
 Push value on back. More...
 
int32_t leList_PopBack (leList *list)
 Pop value from back. More...
 
void * leList_Get (const leList *list, uint32_t idx)
 Get a value from the list. More...
 
int32_t leList_Find (const leList *list, void *val)
 Find index of a value. More...
 
int32_t leList_InsertAt (leList *list, void *val, uint32_t idx)
 Insert value at index. More...
 
int32_t leList_Remove (leList *list, void *val)
 Remove item. More...
 
int32_t leList_RemoveAt (leList *list, uint32_t idx)
 Remove item at index. More...
 
int32_t leList_Copy (leList *l, leList *r)
 Copy list. More...
 
void leList_Clear (leList *list)
 Clear array. More...
 
void leList_Destroy (leList *list)
 Remove array. More...
 

Detailed Description

A linked list implementation.

This is a linked list implementation that is used internally by the Legato user interface library.

Typedef Documentation

◆ leList

typedef struct leList leList

This struct represents a list.

List is used use to hold a size limit of list nodes.

◆ leListNode

typedef struct leListNode leListNode

This struct represents a list node .

List node is used to hold a list of items.

Function Documentation

◆ leList_Assign()

int32_t leList_Assign ( leList list,
size_t  idx,
void *  val 
)

Assignes a new pointer.

Assigns val at the specified index for the specified list.

leList* list;
size_t idx;
void* val;
int32_t res = leList_Assign(list, idx, val);
Parameters
listis the array to modify.
idxis the location to update.
valis the value to assign.
Returns
0 if success, -1 if failure.

◆ leList_Clear()

void leList_Clear ( leList list)

Clear array.

Removes all values from list. The array capacity remains the same.

leList* list;
Parameters
listthe list to modify.
Returns
void.
Here is the caller graph for this function:

◆ leList_Copy()

int32_t leList_Copy ( leList l,
leList r 
)

Copy list.

Copies the contents of l to the array pointed to by r.

leList* l;
leList* r;
int32_t index = leList_Copy(l, r);
Parameters
lthe source list.
rthe result list.
Returns
0 if success, -1 if failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ leList_Create()

int32_t leList_Create ( leList list)

Create a new list.

Creates a new list using list.

leArray* list;
int32_t res = leList_Create(list)
Parameters
Pointerto the list to create.
Returns
0 if success, -1 if failure.
Here is the caller graph for this function:

◆ leList_Destroy()

void leList_Destroy ( leList list)

Remove array.

Removes all values from list. The function frees the data of each node.

leList* list;
Parameters
listthe list to modify.
Returns
void.
Here is the caller graph for this function:

◆ leList_Find()

int32_t leList_Find ( const leList list,
void *  val 
)

Find index of a value.

Finds the index of val from list. All existing values from index are shifted right one place.

leList* list;
void* val;
int32_t index = leList_Get(list, val);
Parameters
pointerto the list to reference.
thevalue to search for.
Returns
the index of the value searched for.

◆ leList_Get()

void* leList_Get ( const leList list,
uint32_t  idx 
)

Get a value from the list.

Gets val from list at the specified idx. All existing values from index are shifted right one place.

leList* list;
void* value = leList_Get(list);
Parameters
pointerto the list to reference.
theindex of the value to retrieve.
Returns
pointer to the retrieved value.
Here is the caller graph for this function:

◆ leList_InsertAt()

int32_t leList_InsertAt ( leList list,
void *  val,
uint32_t  idx 
)

Insert value at index.

Inserts val into list at the specified idx. All existing values from index are shifted right one place.

leList* list;
void* val;
uint32_t idx;
int32_t res = leList_InsertAt(list, val, idx);
Parameters
listis the array to modify.
valis value to insert.
idxis the location at which to insert.
Returns
0 if success, -1 if failure.
Here is the call graph for this function:

◆ leList_PopBack()

int32_t leList_PopBack ( leList list)

Pop value from back.

Pops a value from the back list. This is the last value from the list. of the array pointed to by list.

leList* list;
int32_t val = leList_PopBack(list);
Parameters
listis the array to modify.
Returns
last value.

◆ leList_PopFront()

void leList_PopFront ( leList list)

Pop value from front.

Removes the first value from the front of list. This function shuffles all other values forward one index.

leList* list;
Parameters
listis the array to modify.
Returns
void.
Here is the caller graph for this function:

◆ leList_PushBack()

int32_t leList_PushBack ( leList list,
void *  val 
)

Push value on back.

Pushes val onto the back of list.

leList* list;
void* val;
int32_t res = leList_PushBack(list, val);
Parameters
listis the array to modify.
valis the value to push.
Returns
0 if success, -1 if failure.
Here is the caller graph for this function:

◆ leList_PushFront()

int32_t leList_PushFront ( leList list,
void *   
)

Push value on front.

Pushes val onto the front of the specified list. This function shuffles all other values backward one index.

leList* list;
void* val;
int32_t res = leList_Create(list, idx, val);
Parameters
listis the array to modify.
valis the value to push.
Returns
0 if success, -1 if failure.
Here is the caller graph for this function:

◆ leList_Remove()

int32_t leList_Remove ( leList list,
void *  val 
)

Remove item.

Removes the first instance of val from list. The function shuffles all values left to fill the gap.

leList* list;
void* val;
int32_t index = leList_Remove(list, val);
Parameters
listis the array to modify.
valis the value removed.
Returns
0 if success, -1 if failure.

◆ leList_RemoveAt()

int32_t leList_RemoveAt ( leList list,
uint32_t  idx 
)

Remove item at index.

Removes an item from list at the specified idx.

leList* list;
uint32_t idx;
int32_t res = leList_Remove(list, idx);
Parameters
listis the array to modify.
idxis the location at which to remove.
Returns
0 if success, -1 if failure.