|
HALFRED
0.4.0
|
Data Structures | |
| struct | SLSTListDesc |
Macros | |
| #define | SLST_GetCount(list) (((SLSTList)list)->count) |
| #define | SLST_Clear(list) do { ((SLSTList)list)->count = 0; } while (0) |
| #define | SLST_Lock(list, timeout) OSMUTEX_Take((((SLSTList)list)->lock), (timeout)) |
| #define | SLST_Unlock(list) OSMUTEX_Give(((SLSTList)list)->lock) |
| #define | SLST_GetMemoryFootprint(list) (sizeof(SLSTListDesc) + (((SLSTList)list)->element_size*((SLSTList)list)->list_size)) |
Typedefs | |
| typedef struct SLSTListDesc * | SLSTList |
Functions | |
| SLSTList | SLST_Create (size_t elem_count, size_t elem_size) |
| void | SLST_Destroy (SLSTList list) |
| SLSTList | SLST_Init (void *area, size_t area_size, size_t element_size) |
| void * | SLST_AddElement (SLSTList list) |
| void * | SLST_InsertElement (SLSTList list, const void *element) |
| void * | SLST_InsertElementAtPos (SLSTList list, int pos) |
| void | SLST_RemoveElement (SLSTList list, void *element) |
| void * | SLST_GetElementByField (SLSTList list, const void *field, size_t field_size, uint32_t field_offset) |
| void * | SLST_GetNextElement (SLSTList list, void *element) |
| void * | SLST_GetFirstElement (SLSTList list) |
| #define SLST_GetCount | ( | list | ) | (((SLSTList)list)->count) |
Returns the number of elements stored in the list
| list | pointer to the list |
| #define SLST_Clear | ( | list | ) | do { ((SLSTList)list)->count = 0; } while (0) |
Clears the list
| list | pointer to the list |
| #define SLST_Lock | ( | list, | |
| timeout | |||
| ) | OSMUTEX_Take((((SLSTList)list)->lock), (timeout)) |
Locks access to list for mutually exclusive access
| list | pointer to the list |
| timeout | maximum time to wait for access |
| #define SLST_Unlock | ( | list | ) | OSMUTEX_Give(((SLSTList)list)->lock) |
Unlocks access to endpoint list
| list | pointer to the list |
| #define SLST_GetMemoryFootprint | ( | list | ) | (sizeof(SLSTListDesc) + (((SLSTList)list)->element_size*((SLSTList)list)->list_size)) |
Returns total size of memory used by the list (in bytes)
| SLSTList SLST_Create | ( | size_t | elem_count, |
| size_t | elem_size | ||
| ) |
Creates list
This function uses dynamic memory manager to allocate a buffer space for the list.
| elem_count | count of elements that list will be able to store |
| elem_size | size of a single element that will be stored in the list |
References SLSTListDesc::count, SLSTListDesc::element_size, SLSTListDesc::list_size, and OSMUTEX_Create().
| void SLST_Destroy | ( | SLSTList | list | ) |
Destroys list
This function destroys previously created list.
| list | pointer to list that we want to destroy |
References OSMUTEX_Destroy().
| SLSTList SLST_Init | ( | void * | area, |
| size_t | area_size, | ||
| size_t | element_size | ||
| ) |
Initializes list
This function destroys previously created list
| area | pointer to buffer space that will store list and it's descriptor |
| area_size | size of "area" space |
| element_size | size of a single element that will be stored in the list |
References SLSTListDesc::count, SLSTListDesc::element_size, and SLSTListDesc::list_size.
| void* SLST_AddElement | ( | SLSTList | list | ) |
Adds single element to the list.
This function reserves space for a next element in the list and returns pointer to that space.
| list | pointer to the list |
References SLSTListDesc::count, SLSTListDesc::element_size, and SLSTListDesc::list_size.
Referenced by SLST_InsertElementAtPos().
| void* SLST_InsertElement | ( | SLSTList | list, |
| const void * | element | ||
| ) |
Inserts single element to list at a specified position.
| list | pointer to the list |
| element | new element will be inserted before this element |
References SLSTListDesc::element_size, and SLST_InsertElementAtPos().
| void* SLST_InsertElementAtPos | ( | SLSTList | list, |
| int | pos | ||
| ) |
Inserts single element to list at a specified position.
| list | pointer to the list |
| pos | position in list, counting from 0 |
References SLSTListDesc::count, SLSTListDesc::element_size, SLSTListDesc::list_size, and SLST_AddElement().
Referenced by SLST_InsertElement().
| void SLST_RemoveElement | ( | SLSTList | list, |
| void * | element | ||
| ) |
Removes single element from list.
| list | pointer to the list |
| element | pointer to element to remove |
References SLSTListDesc::count, and SLSTListDesc::element_size.
| void* SLST_GetElementByField | ( | SLSTList | list, |
| const void * | field, | ||
| size_t | field_size, | ||
| uint32_t | field_offset | ||
| ) |
Returns pointer to a element that contains specified value in specified field
| list | pointer to the list |
| field | pointer to field that have to be compared with piece of list's element |
| field_size | size of element pointed by the "Field" |
| field_offset | offset in the list's element that have to include compared element |
References SLSTListDesc::count, and SLSTListDesc::element_size.
| void* SLST_GetNextElement | ( | SLSTList | list, |
| void * | element | ||
| ) |
Returns pointer to next element in the list
| list | pointer to the list |
| element | pointer to actually used element |
References SLSTListDesc::count, and SLSTListDesc::element_size.
| void* SLST_GetFirstElement | ( | SLSTList | list | ) |
Returns pointer to the first element in the list
| list | pointer to the list |
References SLSTListDesc::count.
1.8.7