Changeset 373
- Timestamp:
- Apr 1, 2004, 12:09:15 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psStdArrays.h (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psStdArrays.h
r344 r373 74 74 typedef struct { 75 75 psType type; ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 76 int size; ///< Total number of elements available76 int nalloc; ///< Total number of elements available 77 77 int n; ///< Number of elements in use 78 78 float *arr; ///< The array data … … 80 80 81 81 /** Constructor \ingroup DataGroup */ 82 psFloatArray *psFloatArrayAlloc(int s,///< Total number of elements to make available83 int n ///< Number of elements that will be used 84 ); 82 psFloatArray *psFloatArrayAlloc(int nalloc) ///< Total number of elements to make available 83 ; 84 85 85 /** Reallocator \ingroup DataGroup */ 86 86 psFloatArray *psFloatArrayRealloc(psFloatArray *myArray, ///< Array to reallocate 87 int s ///< Total number of elements to make available 88 ); 89 /** Destructor \ingroup DataGroup */ 90 void psFloatArrayFree(psFloatArray *restrict myArray ///< Array to free 91 ); 87 int nalloc) ///< Total number of elements to make available 88 ; 89 90 /** Destructor \ingroup DataGroup */ 91 void psFloatArrayFree(psFloatArray *restrict myArray) ///< Array to free 92 ; 92 93 93 94 /************************************************************************************************************/ … … 95 96 /** Define a vector as an array of real numbers */ 96 97 typedef psFloatArray psVector; 97 #define psVectorAlloc( S,N) psFloatArrayAlloc(S,N) ///< Constructor98 #define psVectorRealloc(A, S) psFloatArrayRealloc(A,S) ///< Reallocator98 #define psVectorAlloc(N) psFloatArrayAlloc(N) ///< Constructor 99 #define psVectorRealloc(A,N) psFloatArrayRealloc(A,N) ///< Reallocator 99 100 #define psVectorFree(A) psFloatArrayFree(A) ///< Destructor 100 101 101 102 /** Transpose a vector. Changes the type to a PS_DIMEN_TRANSV */ 102 103 psVector *psVectorTranspose(psVector *out, ///< Output vector, or NULL 103 psVector *myVector ///< Vector to be transposed104 );104 psVector *myVector) ///< Vector to be transposed 105 ; 105 106 106 107 /************************************************************************************************************/ … … 109 110 typedef struct { 110 111 psType type; ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 111 int size; ///< Total number of elements available112 int nalloc; ///< Total number of elements available 112 113 int n; ///< Number of elements in use 113 114 complex float *arr; ///< The array data … … 115 116 116 117 /** Constructor \ingroup DataGroup */ 117 psComplexArray *psComplexArrayAlloc(int s,///< Total number of elements to make available118 int n ///< Number of elements that will be used 119 ); 118 psComplexArray *psComplexArrayAlloc(int nalloc) ///< Total number of elements to make available 119 ; 120 120 121 /** Reallocator \ingroup DataGroup */ 121 122 psComplexArray *psComplexArrayRealloc(psComplexArray *myArray, ///< Array to reallocate 122 int s ///< Total number of elements to make available 123 ); 124 /** Destructor \ingroup DataGroup */ 125 void psComplexArrayFree(psComplexArray *restrict myArray ///< Array to free 126 ); 123 int nalloc) ///< Total number of elements to make available 124 ; 125 126 /** Destructor \ingroup DataGroup */ 127 void psComplexArrayFree(psComplexArray *restrict myArray) ///< Array to free 128 ; 127 129 128 130 /************************************************************************************************************/ … … 131 133 typedef struct { 132 134 psType type; ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 133 int size; ///< Total number of elements available135 int nalloc; ///< Total number of elements available 134 136 int n; ///< Number of elements in use 135 137 int *arr; ///< The array data … … 137 139 138 140 /** Constructor \ingroup DataGroup */ 139 psIntArray *psIntArrayAlloc(int s,///< Total number of elements to make available140 int n ///< Number of elements that will be used 141 ); 141 psIntArray *psIntArrayAlloc(int nalloc) ///< Total number of elements to make available 142 ; 143 142 144 /** Reallocator \ingroup DataGroup */ 143 145 psIntArray *psIntArrayRealloc(psIntArray *myArray, ///< Array to reallocate 144 int s ///< Total number of elements to make available 145 ); 146 /** Destructor \ingroup DataGroup */ 147 void psIntArrayFree(psIntArray *restrict myArray ///< Array to free 148 ); 146 int nalloc) ///< Total number of elements to make available 147 ; 148 149 /** Destructor \ingroup DataGroup */ 150 void psIntArrayFree(psIntArray *restrict myArray) ///< Array to free 151 ; 149 152 150 153 /************************************************************************************************************/ … … 153 156 typedef struct { 154 157 psType type; ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 155 int size; ///< Total number of elements available158 int nalloc; ///< Total number of elements available 156 159 int n; ///< Number of elements in use 157 160 double *arr; ///< The array data … … 159 162 160 163 /** Constructor \ingroup DataGroup */ 161 psDoubleArray *psDoubleArrayAlloc(int s,///< Total number of elements to make available162 int n ///< Number of elements that will be used 163 ); 164 psDoubleArray *psDoubleArrayAlloc(int nalloc) ///< Total number of elements to make available 165 ; 166 164 167 /** Reallocator \ingroup DataGroup */ 165 168 psDoubleArray *psDoubleArrayRealloc(psDoubleArray *myArray, ///< Array to reallocate 166 int s ///< Total number of elements to make available 167 ); 168 /** Destructor \ingroup DataGroup */ 169 void psDoubleArrayFree(psDoubleArray *restrict myArray ///< Array to free 170 ); 169 int nalloc) ///< Total number of elements to make available 170 ; 171 172 /** Destructor \ingroup DataGroup */ 173 void psDoubleArrayFree(psDoubleArray *restrict myArray) ///< Array to free 174 ; 171 175 172 176 /************************************************************************************************************/ … … 175 179 typedef struct { 176 180 psType type; ///< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 177 int size; ///< Total number of elements available181 int nalloc; ///< Total number of elements available 178 182 int n; ///< Number of elements in use 179 183 psFloatArray *arr; ///< The array data … … 181 185 182 186 /** Constructor \ingroup DataGroup */ 183 psVectorArray *psVectorArrayAlloc(int s, ///< Total number of elements to make available 184 int n ///< Number of elements that will be used 185 ); 186 /** Reallocator \ingroup DataGroup */ 187 psVectorArray *psVectorArrayRealloc(psVectorArray *myArray, ///< Array to reallocate 188 int s ///< Total number of elements to make available 189 ); 190 /** Destructor \ingroup DataGroup */ 191 void psVectorArrayFree(psVectorArray *restrict myArray ///< Array to free 192 ); 187 psVectorArray *psVectorArrayAlloc(int nalloc) ///< Total number of elements to make available 188 ; 189 190 /** Reallocator \ingroup DataGroup */ 191 psVectorArray *psVectorArrayRealloc(psVectorArray *myArray ///< Array to reallocate 192 int nalloc) ///< Total number of elements to make available 193 ; 194 195 /** Destructor \ingroup DataGroup */ 196 void psVectorArrayFree(psVectorArray *restrict myArray) ///< Array to free 197 ; 193 198 194 199 /************************************************************************************************************/ … … 201 206 typedef struct { 202 207 int n; ///< Number of elements in use 203 int size; ///< Number of total elements208 int nalloc; ///< Number of total elements 204 209 void **arr; ///< The elements 205 210 } psVoidPtrArray; 206 211 207 212 /** Constructor \ingroup DataGroup */ 208 psVoidPtrArray *psVoidPtrArrayAlloc(int n ,///< Number of elements to use209 int s ///< Total number of elements 210 ); 213 psVoidPtrArray *psVoidPtrArrayAlloc(int nalloc) ///< Number of elements to use 214 ; 215 211 216 /** Reallocate \ingroup DataGroup */ 212 217 psVoidPtrArray *psVoidPtrArrayRealloc(psVoidPtrArray *arr, ///< Array to reallocate 213 int n ///< Number of elements 214 ); 218 int nalloc) ///< Number of elements 219 ; 220 215 221 /** Destructor \ingroup DataGroup */ 216 222 void psVoidPtrArrayFree(psVoidPtrArray *arr, ///< array to destroy 217 void (*elemFree)(void *) ///< destructor for array data 218 ); 219 223 void (*elemFree)(void *)) ///< destructor for array data 224 ; 220 225 221 226 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
