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

Array Container
[Data Containers]

Collaboration diagram for Array Container:


Files

file  psArray.h
 Contains basic array definitions and operations.

Data Structures

struct  psArray
 An array to support primitive types. More...

Functions

psArraypsArrayAlloc (psU32 nalloc)
 Allocate an array.
psArraypsArrayRealloc (psArray *psArr, psU32 nalloc)
 Reallocate an array.
psArraypsArrayAdd (psArray *psArr, int delta, psPtr data)
 Add an element to the end the array, expanding the array storage if necessary.
psBool psArrayRemove (psArray *psArr, psPtr data)
 Remove an element from the array.
void psArrayElementFree (psArray *psArr)
 Deallocate/Dereference elements of an array.
psArraypsArraySort (psArray *in, psComparePtrFcn compare)
 Sort the array according to an external compare function.
psBool psArraySet (psArray *in, psU32 position, void *value)
 Set an element in the array.
void * psArrayGet (psArray *in, psU32 position)
 Get an element from the array.


Function Documentation

psArray* psArrayAdd psArray psArr,
int  delta,
psPtr  data
 

Add an element to the end the array, expanding the array storage if necessary.

Returns:
psArray* The array with the element added
Parameters:
psArr  array to operate on
delta  the amount to expand array, if necessary. If less than one, 10 will be used.
data  the data pointer to add to psArray

psArray* psArrayAlloc psU32  nalloc  ) 
 

Allocate an array.

Uses psLib memory allocation functions to create an array collection of data

Returns:
psArray* : Pointer to psArray.
Parameters:
nalloc  Total number of elements to make available.

void psArrayElementFree psArray psArr  ) 
 

Deallocate/Dereference elements of an array.

Uses psLib memory allocation functions to deallocate/dereference elements of a array of void pointers. The array psArr is not freed, and its elements will all be set to NULL.

Parameters:
psArr  Void pointer array to destroy.

void* psArrayGet psArray in,
psU32  position
 

Get an element from the array.

Returns:
void* the element at given position.
Parameters:
in  input array to get element from
position  the element position to get

psArray* psArrayRealloc psArray psArr,
psU32  nalloc
 

Reallocate an array.

Uses psLib memory allocation functions to reallocate an array collection of data.

Returns:
psArray* : Pointer to psArray.
Parameters:
psArr  array to reallocate.
nalloc  Total number of elements to make available.

psBool psArrayRemove psArray psArr,
psPtr  data
 

Remove an element from the array.

Finds and removes the specified data pointer from the list.

Returns:
bool: TRUE if the specified data pointer was found and removed, otherwise FALSE.
Parameters:
psArr  array to operate on
data  the data pointer to remove from psArray

psBool psArraySet psArray in,
psU32  position,
void *  value
 

Set an element in the array.

If the current element is non-NULL, the old element is freed.

Returns:
psBool TRUE if the element was set successfully, otherwise FALSE
Parameters:
in  input array to set element in
position  the element position to set
value  the value to set it to

psArray* psArraySort psArray in,
psComparePtrFcn  compare
 

Sort the array according to an external compare function.

Sorts an array via the specification of a comparison function to specify how the objects on the array should be sorted.

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:
psArray* The sorted array.
Parameters:
in  input array to sort.
compare  the compare function


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