IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 5, 2004, 10:43:57 AM (22 years ago)
Author:
harman
Message:

Updated per SDR documentation bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psArray.h

    r511 r578  
    88 *  @author Ross Harman, MHPCC
    99 *   
    10  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2004-04-23 21:33:59 $
     10 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2004-05-05 20:43:57 $
    1212 *
    1313 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575psType;
    7676
    77 /** An array of integers.
    78  *
    79  * Struct for maintaining an array of integer numbers.
     77/** An array of generic primitive types.
     78 *
     79 * Struct for maintaining an array of frequently used primitive types.
    8080 *
    8181 */
    8282typedef struct
    8383{
    84     psType type;    ///< Type of data.
    85     int nalloc;     ///< Total number of elements available.
    86     int n;          ///< Number of elements in use.
    87     int *arr;       ///< Array data.
     84    psType type;                ///< Type of data.
     85    int nalloc;                 ///< Total number of elements available.
     86    int n;                      ///< Number of elements in use.
     87
     88    union {
     89        int *intArr;            ///< Integer array.
     90        float *fltArr;          ///< Single precision floating point array.
     91        double *dblArr;         ///< Double precision floating point array.
     92        complex float *cFltArr; ///< Single precision floating pont complex array.
     93        void **ptrArr;          ///< Void pointer array.
     94    }arr;                       ///< Union with array data.
    8895}
    89 psIntArray;
    90 
    91 /** An array of floats.
    92  *
    93  * Struct for maintaining an array of single precision floating point numbers.
    94  *
    95  */
    96 typedef struct
    97 {
    98     psType type;    ///< Type of data.
    99     int nalloc;     ///< Total number of elements available.
    100     int n;          ///< Number of elements in use.
    101     float *arr;     ///< Array data.
    102 }
    103 psFloatArray;
    104 
    105 /** An array of doubles.
    106  *
    107  * Struct for maintaining an array of double precision floating point numbers.
    108  *
    109  */
    110 typedef struct
    111 {
    112     psType type;    ///< Type of data.
    113     int nalloc;     ///< Total number of elements available.
    114     int n;          ///< Number of elements in use.
    115     double *arr;    ///< Array data.
    116 }
    117 psDoubleArray;
    118 
    119 /** An array of complex numbers.
    120  *
    121  * Struct for maintaining an array of single precision floating point complex numbers.
    122  *
    123  */
    124 typedef struct
    125 {
    126     psType type;        ///< Type of data.
    127     int nalloc;         ///< Total number of elements available.
    128     int n;              ///< Number of elements in use
    129     complex float *arr; ///< Array data.
    130 }
    131 psComplexArray;
    132 
    133 /** An array of void pointers.
    134  *
    135  * Struct for maintaining an array of void pointers. This struct needs a deallocation function that accepts
    136  * deallocation of the array elements.
    137  *
    138  */
    139 typedef struct
    140 {
    141     psType type;    ///< Type of data.
    142     int nalloc;     ///< Number of total elements.
    143     int n;          ///< Number of elements in use.
    144     void **arr;     ///< Aray data.
    145 }
    146 psVoidPtrArray;
    147 
     96psArray;
    14897
    14998/*****************************************************************************/
     
    155104 * Uses psLib memory allocation functions to create an array of integers as defined by the psIntArray struct.
    156105 *
    157  */
    158 psIntArray *psIntArrayAlloc(
     106 * @return psArray* Pointer to psArray.
     107 *
     108 */
     109psArray *psIntArrayAlloc(
    159110    int nalloc  ///< Total number of elements to make available.
    160111);
     
    165116 * struct.
    166117 *
    167  */
    168 psIntArray *psIntArrayRealloc(
    169     psIntArray *myArray,    ///< Array to reallocate.
     118 * @return psArray* Pointer to psArray.
     119 *
     120 */
     121psArray *psIntArrayRealloc(
     122    psArray *myArray,       ///< Array to reallocate.
    170123    int nalloc              ///< Total number of elements to make available.
    171124);
     
    177130 * struct.
    178131 *
     132 * @return void
     133 *
    179134 */
    180135void psIntArrayFree(
    181     psIntArray *restrict psArr  ///< Array to free.
     136    psArray *restrict psArr  ///< Array to free.
    182137);
    183138
     
    186141 * Uses psLib memory allocation functions to create an array of floats as defined by the psFloatArray struct.
    187142 *
    188  */
    189 psFloatArray *psFloatArrayAlloc(
     143 * @return psArray* Pointer to psArray.
     144 *
     145 */
     146psArray *psFloatArrayAlloc(
    190147    int nalloc  ///< Total number of elements to make available.
    191148);
     
    196153 * struct.
    197154 *
    198  */
    199 psFloatArray *psFloatArrayRealloc(
    200     psFloatArray *psArr,    ///< Array to reallocate.
     155 * @return psArray* Pointer to psArray.
     156 *
     157 */
     158psArray *psFloatArrayRealloc(
     159    psArray *psArr,         ///< Array to reallocate.
    201160    int nalloc              ///< Total number of elements to make available.
    202161);
     
    207166 * struct.
    208167 *
     168 * @return void
     169 *
    209170 */
    210171void psFloatArrayFree(
    211     psFloatArray *restrict myArray  ///< Array to free.
     172    psArray *restrict myArray  ///< Array to free.
    212173);
    213174
     
    217178 * struct.
    218179 *
    219  */
    220 psDoubleArray *psDoubleArrayAlloc(
     180 * @return psArray* Pointer to psArray.
     181 *
     182 */
     183psArray *psDoubleArrayAlloc(
    221184    int nalloc  ///< Total number of elements to make available.
    222185);
     
    227190 * struct.
    228191 *
    229  */
    230 psDoubleArray *psDoubleArrayRealloc(
    231     psDoubleArray *psArr,   ///< Array to reallocate.
     192 * @return psArray* Pointer to psArray.
     193 *
     194 */
     195psArray *psDoubleArrayRealloc(
     196    psArray *psArr,         ///< Array to reallocate.
    232197    int nalloc              ///< Total number of elements to make available.
    233198);
     
    238203 * struct.
    239204 *
     205 * @return void
     206 *
    240207 */
    241208void psDoubleArrayFree(
    242     psDoubleArray *restrict psArr  ///< Array to free.
     209    psArray *restrict psArr  ///< Array to free.
    243210);
    244211
     
    248215 * numbers as defined by the psComplexArray struct.
    249216 *
    250  */
    251 psComplexArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available.
     217 * @return psArray* Pointer to psArray.
     218 *
     219 */
     220psArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available.
    252221;
    253222
     
    257226 * numbers as defined by the psComplexArray struct.
    258227 *
    259  */
    260 psComplexArray *psComplexArrayRealloc(
    261     psComplexArray *myArray,    ///< Array to reallocate.
     228 * @return psArray* Pointer to psArray.
     229 *
     230 */
     231psArray *psComplexArrayRealloc(
     232    psArray *psArr,            ///< Array to reallocate.
    262233    int nalloc                  ///< Total number of elements to make available.
    263234);
     
    268239 * numbers as defined by the psComplexArray struct.
    269240 *
     241 * @return void
     242 *
    270243 */
    271244void psComplexArrayFree(
    272     psComplexArray *restrict psArr  ///< Array to free.
     245    psArray *restrict psArr  ///< Array to free.
    273246);
    274247
     
    278251 * struct.
    279252 *
    280  */
    281 psVoidPtrArray *psVoidPtrArrayAlloc(
     253 * @return psArray* Pointer to psArray.
     254 *
     255 */
     256psArray *psVoidPtrArrayAlloc(
    282257    int nalloc  ///< Number of elements to use.
    283258);
     
    286261 *
    287262 * Uses psLib memory allocation functions to reallocate an array of void pointers as defined by the
    288  * psVoidPtrArray struct.
    289  *
    290  */
    291 psVoidPtrArray *psVoidPtrArrayRealloc(
    292     psVoidPtrArray *restrict psArr, ///< Array to reallocate.
    293     int nalloc,                     ///< Number of elements.
    294     void (*elemFree)(void *)        ///< Callback function responsible for removing array data.
     263 * psVoidPtrArray struct. If the array size is increased or decreased, this function does not allocate or
     264 * deallocate the contents of individual array elements. The user must do this after calling this function.
     265 *
     266 * @return psArray* Pointer to psArray.
     267 *
     268 */
     269psArray *psVoidPtrArrayRealloc(
     270    psArray *restrict psArr,        ///< Void pointer array to destroy.
     271    int nalloc                      ///< Number of elements.
    295272);
    296273
     
    298275 *
    299276 * Uses psLib memory allocation functions to deallocate an array of void pointers as defined by the
    300  * psVoidPtrArray struct.
     277 * psVoidPtrArray struct. This function does not free the array elements unless the user provides a callback
     278 * function. NULL may be passed as an alternative to supplying a callback, but the user must remember to
     279 * delete the array elements afterwards. The user must not delete or deallocate the array elements prior to
     280 * calling this function, as it requires valid elements for memory reference decrementation operations.
     281 *
     282 * @return void
    301283 *
    302284 */
    303285void psVoidPtrArrayFree(
    304     psVoidPtrArray *restrict psArr,     ///< Array to destroy.
    305     void (*elemFree)(void *)            ///< Callback function responsible for removing array data.
     286    psArray *restrict psArr,            ///< Void pointer array to destroy.
     287    void (*elemFree)(void *)            ///< Optional callback function to remove array elements.
    306288);
    307289
Note: See TracChangeset for help on using the changeset viewer.