|
Gama C Library
Gama C API Documentation
|
Provides a dynamic, NULL-terminated pointer list implementation. More...
Go to the source code of this file.
Macros | |
| #define | gm_ptr_list_for_each(item, list) |
| A macro for iterating over a gmPtrList. | |
| #define | gm_bodies_for_each(item, list) |
| A macro for iterating over a gmBodies list. | |
Typedefs | |
| typedef void ** | gmPtrList |
| A dynamic, NULL-terminated array of generic pointers. | |
| typedef gmBody ** | gmBodies |
| A specialized pointer list for gmBody pointers. | |
Functions | |
| size_t | gm_ptr_list_length (gmPtrList list) |
| Calculates the number of elements in a pointer list. | |
| int | gm_ptr_list_is_empty (gmPtrList list) |
| Checks if a pointer list is empty. | |
| size_t | gm_ptr_list_count (gmPtrList list, void *obj) |
| Counts the occurrences of a specific pointer in the list. | |
| gmPtrList | gm_ptr_list_push (gmPtrList list, void *obj) |
| Adds a pointer to the end of the list. | |
| gmPtrList | gm_ptr_list_pop (gmPtrList list) |
| Removes the last element from the list. | |
| gmPtrList | gm_ptr_list_remove (gmPtrList list, void *obj) |
| Removes all occurrences of a specific pointer from the list. | |
| gmPtrList | gm_ptr_list_pop_at (gmPtrList list, size_t idx) |
| Removes an element at a specific index. | |
| gmPtrList | gm_ptr_list_insert_at (gmPtrList list, size_t idx, void *value) |
| Inserts a pointer at a specific index. | |
| int | gm_ptr_list_find (gmPtrList list, void *value) |
| Finds the index of a specific pointer. | |
| void * | gm_ptr_list_get (gmPtrList list, size_t index) |
| Retrieves the element at a specific index. | |
| void * | gm_ptr_list_last (gmPtrList list) |
| Retrieves the last element of the list. | |
| void | gm_ptr_list_clear (gmPtrList list) |
| Frees the memory used by the list. | |
Provides a dynamic, NULL-terminated pointer list implementation.
This file contains a generic pointer list (gmPtrList) and a specialized version for physics bodies (gmBodies). The lists automatically resize and are always NULL-terminated, making them easy to iterate.
| #define gm_bodies_for_each | ( | item, | |
| list ) |
| #define gm_ptr_list_for_each | ( | item, | |
| list ) |
| typedef void** gmPtrList |
A dynamic, NULL-terminated array of generic pointers.
| void gm_ptr_list_clear | ( | gmPtrList | list | ) |
Frees the memory used by the list.
| list | The list to clear. |
| size_t gm_ptr_list_count | ( | gmPtrList | list, |
| void * | obj ) |
Counts the occurrences of a specific pointer in the list.
| list | The list to search. |
| obj | The pointer to count. |
| int gm_ptr_list_find | ( | gmPtrList | list, |
| void * | value ) |
Finds the index of a specific pointer.
| list | The list to search. |
| value | The pointer to find. |
| void * gm_ptr_list_get | ( | gmPtrList | list, |
| size_t | index ) |
Retrieves the element at a specific index.
| list | The list. |
| index | The index of the element to retrieve. |
Inserts a pointer at a specific index.
| list | The list to modify. |
| idx | The index at which to insert the value. |
| value | The pointer to insert. |
| int gm_ptr_list_is_empty | ( | gmPtrList | list | ) |
Checks if a pointer list is empty.
| list | The list to check. |
| void * gm_ptr_list_last | ( | gmPtrList | list | ) |
Retrieves the last element of the list.
| list | The list. |
| size_t gm_ptr_list_length | ( | gmPtrList | list | ) |
Calculates the number of elements in a pointer list.
| list | The NULL-terminated pointer list. |
Removes the last element from the list.
| list | The list to modify. |
Removes an element at a specific index.
| list | The list to modify. |
| idx | The index of the element to remove. |
Adds a pointer to the end of the list.
| list | The list to append to. |
| obj | The pointer to add. |