Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

LinkedList


Files

file  psList.h
 Support for doubly linked lists.

Data Structures

struct  psListElem
 Doubly-linked list element. More...
struct  psList
 The psList Linked list structure. More...
struct  psListIterator
 The psList iterator structure. More...

Typedefs

typedef psListElem psListElem
 Doubly-linked list element.

Enumerations

enum  { PS_LIST_HEAD = 0, PS_LIST_TAIL = -1 }
 Special values of index into list. More...

Functions

bool psMemCheckList (psPtr ptr)
 Checks the type of a particular pointer.
psListpsListAlloc (psPtr data)
 Creates a psList linked list object.
psListIteratorpsListIteratorAlloc (psList *list, long location, bool mutable)
 Creates a psListIterator object and associates it with a psList.
bool psListIteratorSet (psListIterator *iterator, long location)
 Set the iterator of the list to a given position.
bool psListAdd (psList *list, long location, psPtr data)
 Adds an element to a psList at position given.
bool psListAddAfter (psListIterator *iterator, psPtr data)
 Adds an data item to a psList at position just after the list position given.
bool psListAddBefore (psListIterator *iterator, psPtr data)
 Adds an data item to a psList at position just before the list position given.
bool psListRemove (psList *list, long location)
 Remove an item at the specified location from a list.
bool psListRemoveData (psList *list, psPtr data)
 Remove an item from a list.
psPtr psListGet (psList *list, long location)
 Retrieve an item from a list.
psPtr psListGetAndIncrement (psListIterator *iterator)
 Position the specified iterator to the next item in list.
psPtr psListGetAndDecrement (psListIterator *iterator)
 Position the specified iterator to the previous item in list.
psArraypsListToArray (const psList *list)
 Convert a linked list to an array.
psListpsArrayToList (const psArray *array)
 Convert array to a doubly-linked list.
psListpsListSort (psList *list, psComparePtrFunc func)
 Sort a list via a comparison function.


Typedef Documentation

typedef struct psListElem psListElem
 

Doubly-linked list element.


Enumeration Type Documentation

anonymous enum
 

Special values of index into list.

This list of possible list position values should be contiguous non-positive values ending with PS_LIST_UNKNOWN. Any value less-than-or-equal-to PS_LIST_UNKNOWN is considered a undefined position.

Enumeration values:
PS_LIST_HEAD  at head
PS_LIST_TAIL  at tail

Definition at line 33 of file psList.h.


Function Documentation

psList* psArrayToList const psArray array  ) 
 

Convert array to a doubly-linked list.

Returns:
psList* A new psList populated with elements formt the psArray, or NULL is the given arr parameter is NULL.
Parameters:
array  vector to convert

bool psListAdd psList list,
long  location,
psPtr  data
 

Adds an element to a psList at position given.

Returns:
bool TRUE if item was successfully added, otherwise FALSE.
Parameters:
list  list to add item to
location  index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.
data  data item to add. If NULL, list is not modified.

bool psListAddAfter psListIterator iterator,
psPtr  data
 

Adds an data item to a psList at position just after the list position given.

Returns:
bool TRUE if item was successfully added, otherwise FALSE.
Parameters:
iterator  list position to add item to
data  data item to add. If NULL, list is not modified.

bool psListAddBefore psListIterator iterator,
psPtr  data
 

Adds an data item to a psList at position just before the list position given.

Returns:
bool TRUE if item was successfully added, otherwise FALSE.
Parameters:
iterator  list position to add item to
data  data item to add. If NULL, list is not modified.

psList* psListAlloc psPtr  data  ) 
 

Creates a psList linked list object.

Returns:
psList* A new psList object.
Parameters:
data  initial data item; may be NULL if an empty psList is desired

psPtr psListGet psList list,
long  location
 

Retrieve an item from a list.

Returns:
psPtr the item corresponding to the location parameter. If location is invalid (e.g., a numbered index greater than the list size or if the list is empty), a NULL is returned.
Parameters:
list  list to retrieve element from
location  index number, PS_LIST_HEAD, or PS_LIST_TAIL

psPtr psListGetAndDecrement psListIterator iterator  ) 
 

Position the specified iterator to the previous item in list.

Returns:
psPtr the data item at the original iterator position or NULL if the iterator went past the beginning of the list.
Parameters:
iterator  iterator to move

psPtr psListGetAndIncrement psListIterator iterator  ) 
 

Position the specified iterator to the next item in list.

Returns:
psPtr the data item at the original iterator position or NULL if the iterator went past the end of the list.
Parameters:
iterator  iterator to move

psListIterator* psListIteratorAlloc psList list,
long  location,
bool  mutable
 

Creates a psListIterator object and associates it with a psList.

Returns:
psListIterator* A new psListIterator object.
Parameters:
list  the psList to iterate with
location  the initial starting point. This can be a numeric index, PS_LIST_HEAD, or PS_LIST_TAIL.
mutable  Is it permissible to modify list?

bool psListIteratorSet psListIterator iterator,
long  location
 

Set the iterator of the list to a given position.

If location is invalid the iterator position is not changed.

Returns:
bool TRUE if iterator successfully set, otherwise FALSE.
Parameters:
iterator  list iterator
location  index number, PS_LIST_HEAD, or PS_LIST_TAIL

bool psListRemove psList list,
long  location
 

Remove an item at the specified location from a list.

Returns:
bool TRUE if element is successfully removed, otherwise FALSE.
Parameters:
list  list to remove element from
location  index of item

bool psListRemoveData psList list,
psPtr  data
 

Remove an item from a list.

Returns:
bool TRUE if element is successfully removed, otherwise FALSE.
Parameters:
list  list to remove element from
data  data item to find and remove

psList* psListSort psList list,
psComparePtrFunc  func
 

Sort a list via a comparison function.

The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

If two members compare as equal, their order in the sorted array is undefined.

Returns:
psList* Sorted list.
Parameters:
list  the list to sort
func  the comparison function

psArray* psListToArray const psList list  ) 
 

Convert a linked list to an array.

Returns:
psArray* A new psArray populated with elements from the list, or NULL if the given dlist parameter is NULL.
Parameters:
list  List to convert

bool psMemCheckList psPtr  ptr  ) 
 

Checks the type of a particular pointer.

Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.

Returns:
bool: True if the pointer matches a psList structure, false otherwise.
Parameters:
ptr  the pointer whose type to check


Generated on Wed Sep 14 10:43:48 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2