Index: trunk/psLib/src/collections/psArray.h
===================================================================
--- trunk/psLib/src/collections/psArray.h	(revision 433)
+++ trunk/psLib/src/collections/psArray.h	(revision 485)
@@ -1,15 +1,235 @@
-/* remove this file when there is a valid psArray.h */
-
-typedef struct {
-    int n;
-    float *arr;
-} psFloatArray;
-
-typedef struct {
-    int n;
-    int *arr;
-} psIntArray;
-
-psFloatArray *psFloatArrayAlloc(int nalloc);
-int psFreeFloatArray(psFloatArray *inArray);
-psIntArray *psIntArrayAlloc(int nalloc);
+/** @file  psArray.h
+ *
+ *  @brief Contains support for basic array types
+ *
+ *  The types of basic one dimensional arrays defined include: int, float, double, complex float, and
+ *  void *.
+ *
+ *  @author Ross Harman, MHPCC
+ *   
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-04-21 00:18:05 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ */
+
+#ifndef PS_ARRAY_H
+#define PS_ARRAY_H
+
+#include <complex.h>
+
+/******************************************************************************/
+/*  DEFINE STATEMENTS                                                         */
+/******************************************************************************/
+
+// None
+
+/******************************************************************************/
+/*  TYPE DEFINITIONS                                                          */
+/******************************************************************************/
+
+/** Types of the elements of vectors, images, etc.
+ *
+ * The basic types of the primitives used by psLib are defined within this enum. This enum is used by the psType struct.
+ *
+ */
+typedef enum {
+    PS_TYPE_CHAR,   ///< Character.
+    PS_TYPE_SHORT,   ///< Short integer.
+    PS_TYPE_INT,   ///< Integer.
+    PS_TYPE_LONG,   ///< Long integer.
+    PS_TYPE_UCHAR,   ///< Unsigned character.
+    PS_TYPE_USHORT,   ///< Unsigned short integer.
+    PS_TYPE_UINT,   ///< Unsigned integer.
+    PS_TYPE_ULONG,   ///< Unsigned long integer.
+    PS_TYPE_FLOAT,   ///< Floating point.
+    PS_TYPE_DOUBLE,   ///< Double-precision floating point.
+    PS_TYPE_COMPLEX,  ///< Complex numbers consisting of floating point.
+    PS_TYPE_OTHER,   ///< Something else that's not supported for arithmetic.
+} psElemType;
+
+/** Dimensions of a data type.
+ *
+ * The dimensions of containers used by psLib are defined within this enum. This enum is used by the psType struct.
+ *
+ */
+typedef enum {
+    PS_DIMEN_SCALAR,  ///< Scalar.
+    PS_DIMEN_VECTOR,  ///< Vector.
+    PS_DIMEN_TRANSV,  ///< Transposed vector.
+    PS_DIMEN_IMAGE,   ///< Image.
+    PS_DIMEN_OTHER   ///< Something else that's not supported for arithmetic.
+} psDimen;
+
+/** The type of a data type.
+ *
+ * All psLib complex types consist of primitive components. This struct provides the description of those 
+ * primitives.
+ *
+ */
+typedef struct
+{
+    psElemType type;  ///< Primitive type.
+    psDimen dimen;   ///< Dimensionality.
+}
+psType;
+
+/** An array of integers.
+ *
+ * Struct for maintaining an array of integer numbers.
+ *
+ */
+typedef struct
+{
+    psType type;    ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
+    int nalloc;  ///< Total number of elements available.
+    int n;   ///< Number of elements in use.
+    int *arr;  ///< Array data.
+}
+psIntArray;
+
+/** An array of floats.
+ *
+ * Struct for maintaining an array of floating point numbers.
+ *
+ */
+typedef struct
+{
+    psType type; ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
+    int nalloc;  ///< Total number of elements available.
+    int n;   ///< Number of elements in use.
+    float *arr;  ///< Array data.
+}
+psFloatArray;
+
+/*****************************************************************************/
+/* FUNCTION PROTOTYPES                                                       */
+/*****************************************************************************/
+
+/** Allocate an integer array */
+psIntArray *psIntArrayAlloc(
+    int nalloc  ///< Total number of elements to make available
+);
+
+/** Reallocate an integer array */
+psIntArray *psIntArrayRealloc(
+    psIntArray *myArray,    ///< Array to reallocate.
+    int nalloc              ///< Total number of elements to make available.
+);
+
+
+/** Deallocate an integer array */
+void psIntArrayFree(
+    psIntArray *restrict myArray    ///< Array to free
+);
+
+/** Allocate a float array.
+ *
+ * Uses psLib memory allocation functions to create an array of floats as defined by the psFloatArray struct. 
+ *
+ */
+psFloatArray *psFloatArrayAlloc(
+    int nalloc  ///< Total number of elements to make available.
+);
+
+/** Reallocate a float array.
+ *
+ * Uses psLib memory allocation functions to reallocate an array of floats as defined by the psFloatArray 
+ * struct. 
+ *
+ */
+psFloatArray *psFloatArrayRealloc(
+    psFloatArray *myArray,  ///< Array to reallocate.
+    int nalloc              ///< Total number of elements to make available.
+);
+
+/** Deallocate a float array
+ *
+ * Uses psLib memory allocation functions to deallocate an array of floats as defined by the psFloatArray 
+ * struct. 
+ *
+ */
+void psFloatArrayFree(
+    psFloatArray *restrict myArray  ///< Array to free
+);
+
+/** An array of complex numbers.
+ *
+ * Struct for maintaining an array of complex numbers.
+ *
+ */
+typedef struct
+{
+    psType type;  ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
+    int size;   ///< Total number of elements available.
+    int n;    ///< Number of elements in use
+    complex float *arr; ///< Array data.
+}
+psComplexArray;
+
+/** Constructor \ingroup DataGroup */
+psComplexArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available
+;
+
+/** Reallocator \ingroup DataGroup */
+psComplexArray *psComplexArrayRealloc(psComplexArray *myArray, ///< Array to reallocate
+                                      int nalloc) ///< Total number of elements to make available
+;
+
+/** Destructor \ingroup DataGroup */
+void psComplexArrayFree(psComplexArray *restrict myArray) ///< Array to free
+;
+
+
+/************************************************************************************************************/
+
+/** An array of double-precision real numbers */
+typedef struct
+{
+    psType type;  ///< Type of data.  THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!
+    int nalloc;   ///< Total number of elements available
+    int n;    ///< Number of elements in use
+    double *arr;  ///< The array data
+}
+psDoubleArray;
+
+/** Constructor \ingroup DataGroup */
+psDoubleArray *psDoubleArrayAlloc(int nalloc) ///< Total number of elements to make available
+;
+
+/** Reallocator \ingroup DataGroup */
+psDoubleArray *psDoubleArrayRealloc(psDoubleArray *myArray, ///< Array to reallocate
+                                    int nalloc) ///< Total number of elements to make available
+;
+
+/** Destructor \ingroup DataGroup */
+void psDoubleArrayFree(psDoubleArray *restrict myArray) ///< Array to free
+;
+
+/** Array of pointers to void.
+ *  psVoidPtrArray is special, as it needs to have a destructor that
+ *  accepts a destructor for the array elements
+ */
+typedef struct
+{
+    int n;    ///< Number of elements in use
+    int nalloc;    ///< Number of total elements
+    void **arr;    ///< The elements
+}
+psVoidPtrArray;
+
+/** Constructor \ingroup DataGroup */
+psVoidPtrArray *psVoidPtrArrayAlloc(int nalloc) ///< Number of elements to use
+;
+
+/** Reallocate \ingroup DataGroup */
+psVoidPtrArray *psVoidPtrArrayRealloc(psVoidPtrArray *arr, ///< Array to reallocate
+                                      int nalloc) ///< Number of elements
+;
+
+/** Destructor \ingroup DataGroup */
+void psVoidPtrArrayFree(psVoidPtrArray *arr, ///< array to destroy
+                        void (*elemFree)(void *)) ///< destructor for array data
+;
+
+#endif
