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

Linked List
[Data Containers]

Collaboration diagram for Linked List:


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

psListpsListAlloc (psPtr data)
 Creates a psList linked list object.
psListIteratorpsListIteratorAlloc (psList *list, int location, bool mutable)
 Creates a psListIterator object and associates it with a psList.
psBool psListIteratorSet (psListIterator *iterator, int location)
 Set the iterator of the list to a given position.
psBool psListAdd (psList *list, psS32 location, psPtr data)
 Adds an element to a psList at position given.
psBool psListAddAfter (psListIterator *list, psPtr data)
 Adds an data item to a psList at position just after the list position given.
psBool psListAddBefore (psListIterator *list, psPtr data)
 Adds an data item to a psList at position just before the list position given.
psBool psListRemove (psList *list, psS32 location)
 Remove an item at the specified location from a list.
psBool psListRemoveData (psList *list, psPtr data)
 Remove an item from a list.
psPtr psListGet (psList *list, psS32 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 (psList *dlist)
 Convert a linked list to an array.
psListpsArrayToList (psArray *arr)
 Convert array to a doubly-linked list.
psListpsListSort (psList *list, psComparePtrFcn compare)
 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 psArray arr  ) 
 

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:
arr  vector to convert

psBool psListAdd psList list,
psS32  location,
psPtr  data
 

Adds an element to a psList at position given.

Returns:
psBool 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.

psBool psListAddAfter psListIterator list,
psPtr  data
 

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

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

psBool psListAddBefore psListIterator list,
psPtr  data
 

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

Returns:
psBool TRUE if item was successfully added, otherwise FALSE.
Parameters:
list  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 no an empty psList is desired

psPtr psListGet psList list,
psS32  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,
int  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?

psBool psListIteratorSet psListIterator iterator,
int  location
 

Set the iterator of the list to a given position.

If location is invalid the iterator position is not changed.

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

psBool psListRemove psList list,
psS32  location
 

Remove an item at the specified location from a list.

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

psBool psListRemoveData psList list,
psPtr  data
 

Remove an item from a list.

Returns:
psBool 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,
psComparePtrFcn  compare
 

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
compare  the comparison function

psArray* psListToArray psList dlist  ) 
 

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:
dlist  List to convert


Generated on Wed Jun 15 11:01:14 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.1