Index: trunk/psLib/src/collections/psArray.h
===================================================================
--- trunk/psLib/src/collections/psArray.h	(revision 511)
+++ trunk/psLib/src/collections/psArray.h	(revision 578)
@@ -8,6 +8,6 @@
  *  @author Ross Harman, MHPCC
  *   
- *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-04-23 21:33:59 $
+ *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-05-05 20:43:57 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -75,75 +75,24 @@
 psType;
 
-/** An array of integers.
- *
- * Struct for maintaining an array of integer numbers.
+/** An array of generic primitive types.
+ *
+ * Struct for maintaining an array of frequently used primitive types.
  *
  */
 typedef struct
 {
-    psType type;    ///< Type of data.
-    int nalloc;     ///< Total number of elements available.
-    int n;          ///< Number of elements in use.
-    int *arr;       ///< Array data.
+    psType type;                ///< Type of data.
+    int nalloc;                 ///< Total number of elements available.
+    int n;                      ///< Number of elements in use.
+
+    union {
+        int *intArr;            ///< Integer array.
+        float *fltArr;          ///< Single precision floating point array.
+        double *dblArr;         ///< Double precision floating point array.
+        complex float *cFltArr; ///< Single precision floating pont complex array.
+        void **ptrArr;          ///< Void pointer array.
+    }arr;                       ///< Union with array data.
 }
-psIntArray;
-
-/** An array of floats.
- *
- * Struct for maintaining an array of single precision floating point numbers.
- *
- */
-typedef struct
-{
-    psType type;    ///< Type of data.
-    int nalloc;     ///< Total number of elements available.
-    int n;          ///< Number of elements in use.
-    float *arr;     ///< Array data.
-}
-psFloatArray;
-
-/** An array of doubles.
- *
- * Struct for maintaining an array of double precision floating point numbers.
- *
- */
-typedef struct
-{
-    psType type;    ///< Type of data.
-    int nalloc;     ///< Total number of elements available.
-    int n;          ///< Number of elements in use.
-    double *arr;    ///< Array data.
-}
-psDoubleArray;
-
-/** An array of complex numbers.
- *
- * Struct for maintaining an array of single precision floating point complex numbers.
- *
- */
-typedef struct
-{
-    psType type;        ///< Type of data.
-    int nalloc;         ///< Total number of elements available.
-    int n;              ///< Number of elements in use
-    complex float *arr; ///< Array data.
-}
-psComplexArray;
-
-/** An array of void pointers.
- *
- * Struct for maintaining an array of void pointers. This struct needs a deallocation function that accepts
- * deallocation of the array elements.
- *
- */
-typedef struct
-{
-    psType type;    ///< Type of data.
-    int nalloc;     ///< Number of total elements.
-    int n;          ///< Number of elements in use.
-    void **arr;     ///< Aray data.
-}
-psVoidPtrArray;
-
+psArray;
 
 /*****************************************************************************/
@@ -155,6 +104,8 @@
  * Uses psLib memory allocation functions to create an array of integers as defined by the psIntArray struct. 
  *
- */
-psIntArray *psIntArrayAlloc(
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psIntArrayAlloc(
     int nalloc  ///< Total number of elements to make available.
 );
@@ -165,7 +116,9 @@
  * struct. 
  *
- */
-psIntArray *psIntArrayRealloc(
-    psIntArray *myArray,    ///< Array to reallocate.
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psIntArrayRealloc(
+    psArray *myArray,       ///< Array to reallocate.
     int nalloc              ///< Total number of elements to make available.
 );
@@ -177,7 +130,9 @@
  * struct. 
  *
+ * @return void
+ *
  */
 void psIntArrayFree(
-    psIntArray *restrict psArr  ///< Array to free.
+    psArray *restrict psArr  ///< Array to free.
 );
 
@@ -186,6 +141,8 @@
  * Uses psLib memory allocation functions to create an array of floats as defined by the psFloatArray struct. 
  *
- */
-psFloatArray *psFloatArrayAlloc(
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psFloatArrayAlloc(
     int nalloc  ///< Total number of elements to make available.
 );
@@ -196,7 +153,9 @@
  * struct. 
  *
- */
-psFloatArray *psFloatArrayRealloc(
-    psFloatArray *psArr,    ///< Array to reallocate.
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psFloatArrayRealloc(
+    psArray *psArr,         ///< Array to reallocate.
     int nalloc              ///< Total number of elements to make available.
 );
@@ -207,7 +166,9 @@
  * struct. 
  *
+ * @return void
+ *
  */
 void psFloatArrayFree(
-    psFloatArray *restrict myArray  ///< Array to free.
+    psArray *restrict myArray  ///< Array to free.
 );
 
@@ -217,6 +178,8 @@
  * struct. 
  *
- */
-psDoubleArray *psDoubleArrayAlloc(
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psDoubleArrayAlloc(
     int nalloc  ///< Total number of elements to make available.
 );
@@ -227,7 +190,9 @@
  * struct. 
  *
- */
-psDoubleArray *psDoubleArrayRealloc(
-    psDoubleArray *psArr,   ///< Array to reallocate.
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psDoubleArrayRealloc(
+    psArray *psArr,         ///< Array to reallocate.
     int nalloc              ///< Total number of elements to make available.
 );
@@ -238,7 +203,9 @@
  * struct. 
  *
+ * @return void
+ *
  */
 void psDoubleArrayFree(
-    psDoubleArray *restrict psArr  ///< Array to free.
+    psArray *restrict psArr  ///< Array to free.
 );
 
@@ -248,6 +215,8 @@
  * numbers as defined by the psComplexArray struct.
  *
- */
-psComplexArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available.
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available.
 ;
 
@@ -257,7 +226,9 @@
  * numbers as defined by the psComplexArray struct.
  *
- */
-psComplexArray *psComplexArrayRealloc(
-    psComplexArray *myArray,    ///< Array to reallocate.
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psComplexArrayRealloc(
+    psArray *psArr,            ///< Array to reallocate.
     int nalloc                  ///< Total number of elements to make available.
 );
@@ -268,7 +239,9 @@
  * numbers as defined by the psComplexArray struct.
  *
+ * @return void
+ *
  */
 void psComplexArrayFree(
-    psComplexArray *restrict psArr  ///< Array to free.
+    psArray *restrict psArr  ///< Array to free.
 );
 
@@ -278,6 +251,8 @@
  * struct.
  *
- */
-psVoidPtrArray *psVoidPtrArrayAlloc(
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psVoidPtrArrayAlloc(
     int nalloc  ///< Number of elements to use.
 );
@@ -286,11 +261,13 @@
  *
  * Uses psLib memory allocation functions to reallocate an array of void pointers as defined by the 
- * psVoidPtrArray struct.
- *
- */
-psVoidPtrArray *psVoidPtrArrayRealloc(
-    psVoidPtrArray *restrict psArr, ///< Array to reallocate.
-    int nalloc,                     ///< Number of elements.
-    void (*elemFree)(void *)        ///< Callback function responsible for removing array data.
+ * psVoidPtrArray struct. If the array size is increased or decreased, this function does not allocate or 
+ * deallocate the contents of individual array elements. The user must do this after calling this function.
+ *
+ * @return psArray* Pointer to psArray.
+ *
+ */
+psArray *psVoidPtrArrayRealloc(
+    psArray *restrict psArr,        ///< Void pointer array to destroy.
+    int nalloc                      ///< Number of elements.
 );
 
@@ -298,10 +275,15 @@
  *
  * Uses psLib memory allocation functions to deallocate an array of void pointers as defined by the 
- * psVoidPtrArray struct.
+ * psVoidPtrArray struct. This function does not free the array elements unless the user provides a callback 
+ * function. NULL may be passed as an alternative to supplying a callback, but the user must remember to 
+ * delete the array elements afterwards. The user must not delete or deallocate the array elements prior to 
+ * calling this function, as it requires valid elements for memory reference decrementation operations.
+ *
+ * @return void
  *
  */
 void psVoidPtrArrayFree(
-    psVoidPtrArray *restrict psArr,     ///< Array to destroy.
-    void (*elemFree)(void *)            ///< Callback function responsible for removing array data.
+    psArray *restrict psArr,            ///< Void pointer array to destroy.
+    void (*elemFree)(void *)            ///< Optional callback function to remove array elements.
 );
 
