tac0S
Template Affectional Command Operating System
|
Public Member Functions | |
List () | |
List::List Initialize a list, empty to start with. Elements can now be added to the list. | |
~List () | |
List::~List Prepare a list for deallocation. If the list still contains any ListElements, de-allocate them. However, note that we do not de-allocate the "items" on the list – this module allocates and de-allocates the ListElements to keep track of each item, but a given item may be on multiple lists, so we can't de-allocate them here. | |
void | Prepend (void *item) |
List::Prepend Put an "item" on the front of the list. More... | |
void | Append (void *item) |
List::Append Append an "item" to the end of the list. More... | |
void * | Remove () |
List::Remove Remove the first "item" from the front of the list. More... | |
void | Mapcar (VoidFunctionPtr func) |
List::Mapcar Apply a function to each item on the list, by walking through the list, one element at a time. More... | |
bool | IsEmpty () |
List::IsEmpty. More... | |
void | SortedInsert (void *item, long long sortKey) |
List::SortedInsert Insert an "item" into a list, so that the list elements are sorted in increasing order by "sortKey". More... | |
void * | SortedRemove (long long *keyPtr) |
List::SortedRemove Remove the first "item" from the front of a sorted list. More... | |
void * | get (unsigned int index) |
List::get Get an object at the place "i". More... | |
unsigned int | size () |
List::size Return the size of the current list. More... | |
bool | removeElement (void *ElementAdress) |
List::removeElemen Remove the element where the index is equal to the ElementAdress parameter. More... | |
void List::Append | ( | void * | item | ) |
List::Append Append an "item" to the end of the list.
Allocate a ListElement to keep track of the item. If the list is empty, then this will be the only element. Otherwise, put it at the end.
item | is the thing to put on the list, it can be a pointer to anything. |
void * List::get | ( | unsigned int | index | ) |
List::get Get an object at the place "i".
int index | : the place where it should be |
bool List::IsEmpty | ( | ) |
void List::Mapcar | ( | VoidFunctionPtr | func | ) |
List::Mapcar Apply a function to each item on the list, by walking through the list, one element at a time.
Unlike LISP, this mapcar does not return anything!
func | is the procedure to apply to each element of the list. |
void List::Prepend | ( | void * | item | ) |
List::Prepend Put an "item" on the front of the list.
Allocate a ListElement to keep track of the item. If the list is empty, then this will be the only element. Otherwise, put it at the beginning.
item | is the thing to put on the list, it can be a pointer to anything. |
void * List::Remove | ( | ) |
List::Remove Remove the first "item" from the front of the list.
Returns:
bool List::removeElement | ( | void * | ElementAdress | ) |
List::removeElemen Remove the element where the index is equal to the ElementAdress parameter.
ElementAdress | void * |
unsigned int List::size | ( | ) |
List::size Return the size of the current list.
void List::SortedInsert | ( | void * | item, |
long long | sortKey | ||
) |
List::SortedInsert Insert an "item" into a list, so that the list elements are sorted in increasing order by "sortKey".
Allocate a ListElement to keep track of the item. If the list is empty, then this will be the only element. Otherwise, walk through the list, one element at a time, to find where the new item should be placed.
item | is the thing to put on the list, it can be a pointer to anything. |
sortKey | is the priority of the item. |
void * List::SortedRemove | ( | long long * | keyPtr | ) |
List::SortedRemove Remove the first "item" from the front of a sorted list.
Returns:
@param "keyPtr" is a pointer to the location in which to store the priority of the removed item.