GL Studio C++ Runtime API
List_c Class Reference

#include <list.h>

Inheritance diagram for List_c:
TextureLoaderList

Public Member Functions

int IsEmpty ()
 
void Empty ()
 
ListItemFirst ()
 
ListItemLast ()
 
ListItemNth (int where)
 
void InsertAfter (int where, const void *data, int size, void **parentPtr)
 
void InsertAfter (ListItem *after, const void *data, int size, void **parentPtr)
 
void InsertAfter (ListItem *after, ListItem *pNewNode)
 
void InsertBefore (ListItem *before, ListItem *pNewNode)
 
void Push (const void *data, int size, void **parentPtr)
 
void Push (const void *data, int size)
 
void Push (ListItem *pNewNode)
 
void Enqueue (const void *data, int size, void **parentPtr)
 
void Enqueue (const void *data, int size)
 
void Enqueue (ListItem *pNewNode)
 
void * Dequeue ()
 
void * GetElement (int where)
 
int Count ()
 
void Delete (ListItem *element)
 
void AddNodeWithPriority (ListItem *pNewNode, int priority)
 
void AddNodeWithPriority (const void *data, int size, int priority)
 
void ForwardIterator (ListIterator func, void *data=NULL)
 
void BackwardIterator (ListIterator func, void *data=NULL)
 
void Iterator (ListIterator func, void *data, ListIteratorDirection direction)
 

Protected Attributes

ListItem_pTail
 

Detailed Description

Implements a doubly Linked List

Member Function Documentation

void AddNodeWithPriority ( ListItem pNewNode,
int  priority 
)

Adds a new node (item) to the list. The item position will be determined based on its priority.

Parameters
pNewNodeA previously allocated list node containing the data to add
prioritySorting priority
void AddNodeWithPriority ( const void *  data,
int  size,
int  priority 
)

Adds a new node (item) to the list. The item position will be determined based on its priority. This method will dynamically allocate space for the data

Parameters
dataPointer to the data to be added
sizeSize of the data to be added
prioritySorting priority
void BackwardIterator ( ListIterator  func,
void *  data = NULL 
)

Iterates through the list in reverse order, calling the supplied function on each element and passing the supplied data to that function

Parameters
funcListIterator function to call
dataData that will be supplied to each call of the list iterator function
int Count ( )
Returns
The number of items in this list
void Delete ( ListItem element)

Deletes the specified list element. Frees the data pointed to by the element.

Parameters
elementThe element to delete
void* Dequeue ( )

Gets a pointer to the data in the first element of the list. The list element will be freed. The user should free the data returned by this call.

Returns
Data pointed to by the first element in the list or NULL if the list is empty
void Empty ( )

Empties the list (deletes all the elements)

void Enqueue ( const void *  data,
int  size,
void **  parentPtr 
)

Inserts the given data at the end of the list. A new ListItem will be allocated, space will be allocated for the data passed in

Parameters
dataPointer to the data to insert
sizeSize of the data to insert
parentPtrWill be filled in with a pointer to the ListItem that this method allocates
void Enqueue ( const void *  data,
int  size 
)

Inserts the given data at the end of the list. A new ListItem will be allocated, space will be allocated for the data passed in

Parameters
dataPointer to the data to insert
sizeSize of the data to insert
void Enqueue ( ListItem pNewNode)

Inserts the given list element at the end of the list

Parameters
pNewNodeA previously allocated ListItem to insert
ListItem* First ( )

Get a pointer to the first ListItem in the list

Returns
Pointer to the first ListItem in the list or NULL if the list is empty
void ForwardIterator ( ListIterator  func,
void *  data = NULL 
)

Iterates through the list from head to tail, calling the supplied function on each element and passing the supplied data to that function

Parameters
funcListIterator function to call
dataData that will be supplied to each call of the list iterator function
void* GetElement ( int  where)

Gets a pointer to the data at the given "index" into the list

Returns
A pointer to the data or NULL if the index is invalid
void InsertAfter ( int  where,
const void *  data,
int  size,
void **  parentPtr 
)

Inserts the given data at designated index in the list. If the index is greater than the list size, the element will be inserted at the end of the list A new ListItem will be allocated, space will be allocated for the data passed in

Parameters
whereThe zero based index
dataPointer to the data to insert
sizeSize of the data to insert
parentPtrWill be filled in with a pointer to the ListItem that this method allocates
void InsertAfter ( ListItem after,
const void *  data,
int  size,
void **  parentPtr 
)

Inserts the given data after the specified list item A new ListItem will be allocated, space will be allocated for the data passed in

Parameters
afterPointer to the list element to insert after
dataPointer to the data to insert
sizeSize of the data to insert
parentPtrWill be filled in with a pointer to the ListItem that this method allocates
void InsertAfter ( ListItem after,
ListItem pNewNode 
)

Inserts the given list element after the specified list element

Parameters
afterPointer to the list element to insert after
pNewNodeA previously allocated ListItem to insert
void InsertBefore ( ListItem before,
ListItem pNewNode 
)

Inserts the given list element before the specified list element

Parameters
beforePointer to the list element to insert before
pNewNodeA previously allocated ListItem to insert
int IsEmpty ( )

Number of items in the list Returns whether or not the list is empty

Returns
Whether or not the list is empty
void Iterator ( ListIterator  func,
void *  data,
ListIteratorDirection  direction 
)

Iterates through the list in the specified direction, calling the supplied function on each element and passing the supplied data to that function

Parameters
funcListIterator function to call
dataData that will be supplied to each call of the list iterator function
directionWhich directon to iterate
ListItem* Last ( )

Get a pointer to the first ListItem in the list

Returns
Pointer to the first ListItem in the list or NULL if the list is empty
ListItem* Nth ( int  where)

Get a pointer to the ListItem for the Nth element

Parameters
where0 based array index
Returns
Pointer to the ListItem at that index or NULL if the list is empty
void Push ( const void *  data,
int  size,
void **  parentPtr 
)

Inserts the given data at the front of the list. A new ListItem will be allocated, space will be allocated for the data passed in

Parameters
dataPointer to the data to insert
sizeSize of the data to insert
parentPtrWill be filled in with a pointer to the ListItem that this method allocates
void Push ( const void *  data,
int  size 
)

Inserts the given data at the front of the list. A new ListItem will be allocated, space will be allocated for the data passed in

Parameters
dataPointer to the data to insert
sizeSize of the data to insert
void Push ( ListItem pNewNode)

Inserts the given list element at the front of the list

Parameters
pNewNodeA previously allocated ListItem to insert

Member Data Documentation

ListItem* _pTail
protected

Pointer to the head (first item) of the list


The documentation for this class was generated from the following file: