Changeset 578 for trunk/psLib/src/collections/psArray.h
- Timestamp:
- May 5, 2004, 10:43:57 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psArray.h (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psArray.h
r511 r578 8 8 * @author Ross Harman, MHPCC 9 9 * 10 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-0 4-23 21:33:59$10 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-05-05 20:43:57 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 75 75 psType; 76 76 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. 80 80 * 81 81 */ 82 82 typedef struct 83 83 { 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. 88 95 } 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 96 psArray; 148 97 149 98 /*****************************************************************************/ … … 155 104 * Uses psLib memory allocation functions to create an array of integers as defined by the psIntArray struct. 156 105 * 157 */ 158 psIntArray *psIntArrayAlloc( 106 * @return psArray* Pointer to psArray. 107 * 108 */ 109 psArray *psIntArrayAlloc( 159 110 int nalloc ///< Total number of elements to make available. 160 111 ); … … 165 116 * struct. 166 117 * 167 */ 168 psIntArray *psIntArrayRealloc( 169 psIntArray *myArray, ///< Array to reallocate. 118 * @return psArray* Pointer to psArray. 119 * 120 */ 121 psArray *psIntArrayRealloc( 122 psArray *myArray, ///< Array to reallocate. 170 123 int nalloc ///< Total number of elements to make available. 171 124 ); … … 177 130 * struct. 178 131 * 132 * @return void 133 * 179 134 */ 180 135 void psIntArrayFree( 181 ps IntArray *restrict psArr ///< Array to free.136 psArray *restrict psArr ///< Array to free. 182 137 ); 183 138 … … 186 141 * Uses psLib memory allocation functions to create an array of floats as defined by the psFloatArray struct. 187 142 * 188 */ 189 psFloatArray *psFloatArrayAlloc( 143 * @return psArray* Pointer to psArray. 144 * 145 */ 146 psArray *psFloatArrayAlloc( 190 147 int nalloc ///< Total number of elements to make available. 191 148 ); … … 196 153 * struct. 197 154 * 198 */ 199 psFloatArray *psFloatArrayRealloc( 200 psFloatArray *psArr, ///< Array to reallocate. 155 * @return psArray* Pointer to psArray. 156 * 157 */ 158 psArray *psFloatArrayRealloc( 159 psArray *psArr, ///< Array to reallocate. 201 160 int nalloc ///< Total number of elements to make available. 202 161 ); … … 207 166 * struct. 208 167 * 168 * @return void 169 * 209 170 */ 210 171 void psFloatArrayFree( 211 ps FloatArray *restrict myArray ///< Array to free.172 psArray *restrict myArray ///< Array to free. 212 173 ); 213 174 … … 217 178 * struct. 218 179 * 219 */ 220 psDoubleArray *psDoubleArrayAlloc( 180 * @return psArray* Pointer to psArray. 181 * 182 */ 183 psArray *psDoubleArrayAlloc( 221 184 int nalloc ///< Total number of elements to make available. 222 185 ); … … 227 190 * struct. 228 191 * 229 */ 230 psDoubleArray *psDoubleArrayRealloc( 231 psDoubleArray *psArr, ///< Array to reallocate. 192 * @return psArray* Pointer to psArray. 193 * 194 */ 195 psArray *psDoubleArrayRealloc( 196 psArray *psArr, ///< Array to reallocate. 232 197 int nalloc ///< Total number of elements to make available. 233 198 ); … … 238 203 * struct. 239 204 * 205 * @return void 206 * 240 207 */ 241 208 void psDoubleArrayFree( 242 ps DoubleArray *restrict psArr ///< Array to free.209 psArray *restrict psArr ///< Array to free. 243 210 ); 244 211 … … 248 215 * numbers as defined by the psComplexArray struct. 249 216 * 250 */ 251 psComplexArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available. 217 * @return psArray* Pointer to psArray. 218 * 219 */ 220 psArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available. 252 221 ; 253 222 … … 257 226 * numbers as defined by the psComplexArray struct. 258 227 * 259 */ 260 psComplexArray *psComplexArrayRealloc( 261 psComplexArray *myArray, ///< Array to reallocate. 228 * @return psArray* Pointer to psArray. 229 * 230 */ 231 psArray *psComplexArrayRealloc( 232 psArray *psArr, ///< Array to reallocate. 262 233 int nalloc ///< Total number of elements to make available. 263 234 ); … … 268 239 * numbers as defined by the psComplexArray struct. 269 240 * 241 * @return void 242 * 270 243 */ 271 244 void psComplexArrayFree( 272 ps ComplexArray *restrict psArr ///< Array to free.245 psArray *restrict psArr ///< Array to free. 273 246 ); 274 247 … … 278 251 * struct. 279 252 * 280 */ 281 psVoidPtrArray *psVoidPtrArrayAlloc( 253 * @return psArray* Pointer to psArray. 254 * 255 */ 256 psArray *psVoidPtrArrayAlloc( 282 257 int nalloc ///< Number of elements to use. 283 258 ); … … 286 261 * 287 262 * 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 */ 269 psArray *psVoidPtrArrayRealloc( 270 psArray *restrict psArr, ///< Void pointer array to destroy. 271 int nalloc ///< Number of elements. 295 272 ); 296 273 … … 298 275 * 299 276 * 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 301 283 * 302 284 */ 303 285 void psVoidPtrArrayFree( 304 ps VoidPtrArray *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. 306 288 ); 307 289
Note:
See TracChangeset
for help on using the changeset viewer.
