Changeset 493 for trunk/psLib/src/collections/psArray.h
- Timestamp:
- Apr 21, 2004, 8:53:10 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psArray.h (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psArray.h
r486 r493 8 8 * @author Ross Harman, MHPCC 9 9 * 10 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-04-21 00:40:32$10 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-04-21 18:53:10 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 35 35 */ 36 36 typedef enum { 37 PS_TYPE_CHAR, ///< Character.38 PS_TYPE_SHORT, ///< Short integer.39 PS_TYPE_INT, ///< Integer.40 PS_TYPE_LONG, ///< Long integer.41 PS_TYPE_UCHAR, ///< Unsigned character.42 PS_TYPE_USHORT, ///< Unsigned short integer.43 PS_TYPE_UINT, ///< Unsigned integer.44 PS_TYPE_ULONG, ///< Unsigned long integer.45 PS_TYPE_FLOAT, ///< Floating point.46 PS_TYPE_DOUBLE, ///< Double-precision floating point.47 PS_TYPE_COMPLEX, ///< Complex numbers consisting of floating point.48 PS_TYPE_OTHER, ///< Something else that's not supported for arithmetic.37 PS_TYPE_CHAR, ///< Character. 38 PS_TYPE_SHORT, ///< Short integer. 39 PS_TYPE_INT, ///< Integer. 40 PS_TYPE_LONG, ///< Long integer. 41 PS_TYPE_UCHAR, ///< Unsigned character. 42 PS_TYPE_USHORT, ///< Unsigned short integer. 43 PS_TYPE_UINT, ///< Unsigned integer. 44 PS_TYPE_ULONG, ///< Unsigned long integer. 45 PS_TYPE_FLOAT, ///< Floating point. 46 PS_TYPE_DOUBLE, ///< Double-precision floating point. 47 PS_TYPE_COMPLEX, ///< Complex numbers consisting of floating point. 48 PS_TYPE_OTHER, ///< Something else that's not supported for arithmetic. 49 49 } psElemType; 50 50 … … 55 55 */ 56 56 typedef enum { 57 PS_DIMEN_SCALAR, ///< Scalar.58 PS_DIMEN_VECTOR, ///< Vector.59 PS_DIMEN_TRANSV, ///< Transposed vector.60 PS_DIMEN_IMAGE, ///< Image.61 PS_DIMEN_OTHER ///< Something else that's not supported for arithmetic.57 PS_DIMEN_SCALAR, ///< Scalar. 58 PS_DIMEN_VECTOR, ///< Vector. 59 PS_DIMEN_TRANSV, ///< Transposed vector. 60 PS_DIMEN_IMAGE, ///< Image. 61 PS_DIMEN_OTHER ///< Something else that's not supported for arithmetic. 62 62 } psDimen; 63 63 … … 70 70 typedef struct 71 71 { 72 psElemType type; ///< Primitive type.73 psDimen dimen; ///< Dimensionality.72 psElemType type; ///< Primitive type. 73 psDimen dimen; ///< Dimensionality. 74 74 } 75 75 psType; … … 78 78 * 79 79 * Struct for maintaining an array of integer numbers. 80 *81 */82 typedef struct83 {84 psType type; ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!85 int nalloc; ///< Total number of elements available.86 int n; ///< Number of elements in use.87 int *arr; ///< Array data.88 }89 psIntArray;90 91 /** An array of floats.92 *93 * Struct for maintaining an array of floating point numbers.94 80 * 95 81 */ … … 99 85 int nalloc; ///< Total number of elements available. 100 86 int n; ///< Number of elements in use. 87 int *arr; ///< Array data. 88 } 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 101 float *arr; ///< Array data. 102 102 } … … 110 110 typedef struct 111 111 { 112 psType type; ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT!112 psType type; ///< Type of data. 113 113 int nalloc; ///< Total number of elements available. 114 114 int n; ///< Number of elements in use. … … 117 117 psDoubleArray; 118 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 148 119 149 /*****************************************************************************/ 120 150 /* FUNCTION PROTOTYPES */ … … 127 157 */ 128 158 psIntArray *psIntArrayAlloc( 129 int nalloc ///< Total number of elements to make available 159 int nalloc ///< Total number of elements to make available. 130 160 ); 131 161 … … 149 179 */ 150 180 void psIntArrayFree( 151 psIntArray *restrict myArray ///< Array to free181 psIntArray *restrict psArr ///< Array to free. 152 182 ); 153 183 … … 168 198 */ 169 199 psFloatArray *psFloatArrayRealloc( 170 psFloatArray * myArray, ///< Array to reallocate.200 psFloatArray *psArr, ///< Array to reallocate. 171 201 int nalloc ///< Total number of elements to make available. 172 202 ); 173 203 174 /** Deallocate a float array 204 /** Deallocate a float array. 175 205 * 176 206 * Uses psLib memory allocation functions to deallocate an array of floats as defined by the psFloatArray … … 179 209 */ 180 210 void psFloatArrayFree( 181 psFloatArray *restrict myArray ///< Array to free 182 ); 183 184 /** Allocate a Double array.211 psFloatArray *restrict myArray ///< Array to free. 212 ); 213 214 /** Allocate a double array. 185 215 * 186 216 * Uses psLib memory allocation functions to create an array of doubles as defined by the psDoubleArray … … 192 222 ); 193 223 194 /** Reallocate a Double array.224 /** Reallocate a double array. 195 225 * 196 226 * Uses psLib memory allocation functions to reallocate an array of Doubles as defined by the psDoubleArray … … 199 229 */ 200 230 psDoubleArray *psDoubleArrayRealloc( 201 psDoubleArray * myArray, ///< Array to reallocate.231 psDoubleArray *psArr, ///< Array to reallocate. 202 232 int nalloc ///< Total number of elements to make available. 203 233 ); 204 234 205 /** Deallocate a Double array235 /** Deallocate a double array. 206 236 * 207 237 * Uses psLib memory allocation functions to deallocate an array of doubles as defined by the psDoubleArray … … 210 240 */ 211 241 void psDoubleArrayFree( 212 psDoubleArray *restrict myArray ///< Array to free 213 ); 214 215 216 217 218 219 220 221 222 /** An array of complex numbers. 223 * 224 * Struct for maintaining an array of complex numbers. 225 * 226 */ 227 typedef struct 228 { 229 psType type; ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 230 int size; ///< Total number of elements available. 231 int n; ///< Number of elements in use 232 complex float *arr; ///< Array data. 233 } 234 psComplexArray; 235 236 /** Constructor \ingroup DataGroup */ 237 psComplexArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available 242 psDoubleArray *restrict psArr ///< Array to free. 243 ); 244 245 /** Allocate a complex array. 246 * 247 * Uses psLib memory allocation functions to create an array of single precision floating point complex 248 * numbers as defined by the psComplexArray struct. 249 * 250 */ 251 psComplexArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available. 238 252 ; 239 253 240 /** Reallocator \ingroup DataGroup */ 241 psComplexArray *psComplexArrayRealloc(psComplexArray *myArray, ///< Array to reallocate 242 int nalloc) ///< Total number of elements to make available 243 ; 244 245 /** Destructor \ingroup DataGroup */ 246 void psComplexArrayFree(psComplexArray *restrict myArray) ///< Array to free 247 ; 248 249 250 251 252 /** Array of pointers to void. 253 * psVoidPtrArray is special, as it needs to have a destructor that 254 * accepts a destructor for the array elements 255 */ 256 typedef struct 257 { 258 int n; ///< Number of elements in use 259 int nalloc; ///< Number of total elements 260 void **arr; ///< The elements 261 } 262 psVoidPtrArray; 263 264 /** Constructor \ingroup DataGroup */ 265 psVoidPtrArray *psVoidPtrArrayAlloc(int nalloc) ///< Number of elements to use 266 ; 267 268 /** Reallocate \ingroup DataGroup */ 269 psVoidPtrArray *psVoidPtrArrayRealloc(psVoidPtrArray *arr, ///< Array to reallocate 270 int nalloc) ///< Number of elements 271 ; 272 273 /** Destructor \ingroup DataGroup */ 274 void psVoidPtrArrayFree(psVoidPtrArray *arr, ///< array to destroy 275 void (*elemFree)(void *)) ///< destructor for array data 276 ; 254 /** Reallocate a complex array. 255 * 256 * Uses psLib memory allocation functions to reallocate an array of single precision floating point complex 257 * numbers as defined by the psComplexArray struct. 258 * 259 */ 260 psComplexArray *psComplexArrayRealloc( 261 psComplexArray *myArray, ///< Array to reallocate. 262 int nalloc ///< Total number of elements to make available. 263 ); 264 265 /** Deallocate a complex array. 266 * 267 * Uses psLib memory allocation functions to deallocate an array of single precision floating point complex 268 * numbers as defined by the psComplexArray struct. 269 * 270 */ 271 void psComplexArrayFree( 272 psComplexArray *restrict psArr ///< Array to free. 273 ); 274 275 /** Allocate a void pointer array. 276 * 277 * Uses psLib memory allocation functions to create an array of void pointers as defined by the psVoidPtrArray 278 * struct. 279 * 280 */ 281 psVoidPtrArray *psVoidPtrArrayAlloc( 282 int nalloc ///< Number of elements to use. 283 ); 284 285 /** Reallocate a void pointer array. 286 * 287 * 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 *psArr, ///< Array to reallocate. 293 int nalloc ///< Number of elements. 294 ); 295 296 /** Deallocate a void pointer array. 297 * 298 * Uses psLib memory allocation functions to deallocate an array of void pointers as defined by the 299 * psVoidPtrArray struct. 300 * 301 */ 302 void psVoidPtrArrayFree( 303 psVoidPtrArray *restrict psArr, ///< Array to destroy. 304 void (*elemFree)(void *) ///< Callback function responsible for removing array data. 305 ); 277 306 278 307 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
