![]() |
ATLAS Offline Software
|
Automatically resizing array. More...
Go to the source code of this file.
Classes | |
| struct | _ArrayList |
| Definition of an ArrayList. More... | |
Typedefs | |
| typedef void * | ArrayListValue |
| A value to be stored in an ArrayList. More... | |
| typedef struct _ArrayList | ArrayList |
| An ArrayList structure. More... | |
| typedef int(* | ArrayListEqualFunc) (ArrayListValue value1, ArrayListValue value2) |
| Compare two values in an arraylist to determine if they are equal. More... | |
| typedef int(* | ArrayListCompareFunc) (ArrayListValue value1, ArrayListValue value2) |
| Compare two values in an arraylist. More... | |
Functions | |
| ArrayList * | arraylist_new (int length) |
| Allocate a new ArrayList for use. More... | |
| void | arraylist_free (ArrayList *arraylist) |
| Destroy an ArrayList and free back the memory it uses. More... | |
| int | arraylist_append (ArrayList *arraylist, ArrayListValue data) |
| Append a value to the end of an ArrayList. More... | |
| int | arraylist_prepend (ArrayList *arraylist, ArrayListValue data) |
| Prepend a value to the beginning of an ArrayList. More... | |
| void | arraylist_remove (ArrayList *arraylist, int index) |
| Remove the entry at the specified location in an ArrayList. More... | |
| void | arraylist_remove_range (ArrayList *arraylist, int index, int length) |
| Remove a range of entries at the specified location in an ArrayList. More... | |
| int | arraylist_insert (ArrayList *arraylist, int index, ArrayListValue data) |
| Insert a value at the specified index in an ArrayList. More... | |
| int | arraylist_index_of (ArrayList *arraylist, ArrayListEqualFunc callback, ArrayListValue data) |
| Find the index of a particular value in an ArrayList. More... | |
| void | arraylist_clear (ArrayList *arraylist) |
| Remove all entries from an ArrayList. More... | |
| void | arraylist_sort (ArrayList *arraylist, ArrayListCompareFunc compare_func) |
| Sort the values in an ArrayList. More... | |
Automatically resizing array.
ArrayLists are arrays of pointers which automatically increase in size.
To create an ArrayList, use arraylist_new. To destroy an ArrayList, use arraylist_free.
To add a value to an ArrayList, use arraylist_prepend, arraylist_append, or arraylist_insert.
To remove a value from an ArrayList, use arraylist_remove or arraylist_remove_range.
Definition in file arraylist.h.
| typedef struct _ArrayList ArrayList |
An ArrayList structure.
New ArrayLists can be created using the arraylist_new function.
Definition at line 50 of file arraylist.h.
| typedef int(* ArrayListCompareFunc) (ArrayListValue value1, ArrayListValue value2) |
Compare two values in an arraylist.
Used by arraylist_sort when sorting values.
| value1 | The first value. |
| value2 | The second value. |
Definition at line 100 of file arraylist.h.
| typedef int(* ArrayListEqualFunc) (ArrayListValue value1, ArrayListValue value2) |
Compare two values in an arraylist to determine if they are equal.
Definition at line 86 of file arraylist.h.
| typedef void* ArrayListValue |
A value to be stored in an ArrayList.
Definition at line 50 of file arraylist.h.
| int arraylist_append | ( | ArrayList * | arraylist, |
| ArrayListValue | data | ||
| ) |
Append a value to the end of an ArrayList.
| arraylist | The ArrayList. |
| data | The value to append. |
| void arraylist_clear | ( | ArrayList * | arraylist | ) |
Remove all entries from an ArrayList.
| arraylist | The ArrayList. |
| void arraylist_free | ( | ArrayList * | arraylist | ) |
Destroy an ArrayList and free back the memory it uses.
| arraylist | The ArrayList to free. |
| int arraylist_index_of | ( | ArrayList * | arraylist, |
| ArrayListEqualFunc | callback, | ||
| ArrayListValue | data | ||
| ) |
Find the index of a particular value in an ArrayList.
| arraylist | The ArrayList to search. |
| callback | Callback function to be invoked to compare values in the list with the value to be searched for. |
| data | The value to search for. |
| int arraylist_insert | ( | ArrayList * | arraylist, |
| int | index, | ||
| ArrayListValue | data | ||
| ) |
Insert a value at the specified index in an ArrayList.
The index where the new value can be inserted is limited by the size of the ArrayList.
| arraylist | The ArrayList. |
| index | The index at which to insert the value. |
| data | The value. |
| ArrayList* arraylist_new | ( | int | length | ) |
Allocate a new ArrayList for use.
| length | Hint to the initialise function as to the amount of memory to allocate initially to the ArrayList. |
| int arraylist_prepend | ( | ArrayList * | arraylist, |
| ArrayListValue | data | ||
| ) |
Prepend a value to the beginning of an ArrayList.
| arraylist | The ArrayList. |
| data | The value to prepend. |
| void arraylist_remove | ( | ArrayList * | arraylist, |
| int | index | ||
| ) |
Remove the entry at the specified location in an ArrayList.
| arraylist | The ArrayList. |
| index | The index of the entry to remove. |
| void arraylist_remove_range | ( | ArrayList * | arraylist, |
| int | index, | ||
| int | length | ||
| ) |
Remove a range of entries at the specified location in an ArrayList.
| arraylist | The ArrayList. |
| index | The index of the start of the range to remove. |
| length | The length of the range to remove. |
| void arraylist_sort | ( | ArrayList * | arraylist, |
| ArrayListCompareFunc | compare_func | ||
| ) |
Sort the values in an ArrayList.
| arraylist | The ArrayList. |
| compare_func | Function used to compare values in sorting. |
1.8.18