Changeset 210 for trunk/archive/pslib/include/psStdArrays.h
- Timestamp:
- Mar 10, 2004, 4:04:48 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psStdArrays.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psStdArrays.h
r206 r210 19 19 PS_TYPE_DOUBLE, //!< Double-precision floating point 20 20 PS_TYPE_COMPLEX //!< Complex numbers consisting of floating point 21 PS_TYPE_OTHER //!< Something else that's not supported for arithmetic 21 22 } psElemType; 22 23 … … 25 26 PS_DIMEN_SCALAR, //!< Scalar 26 27 PS_DIMEN_VECTOR, //!< A vector 27 PS_DIMEN_MATRIX //!< A matrix 28 PS_DIMEN_MATRIX, //!< A matrix 29 PS_DIMEN_OTHER //!< Something else that's not supported for arithmetic 28 30 } psDimen; 29 31 … … 34 36 } psType; 35 37 38 /************************************************************************************************************/ 39 36 40 /** 37 * ps- typedefs so that array names comply with the standard naming convention. These should NOT be used38 * g enerally.41 * ps- typedefs. These should NOT be used generally, but only where the number of bits in a type must be 42 * guaranteed, or for use in macros to preserve the standard naming conventions. 39 43 */ 40 44 typedef float psFloat; ///< BITPIX -32 (float) … … 63 67 typedef uint64_t psUlong; 64 68 69 /************************************************************************************************************/ 70 65 71 /** An array of real numbers */ 66 PS_DECLARE_ARRAY_TYPE(psFloat); 67 PS_CREATE_ARRAY_TYPE(psFloat); 72 typedef struct { 73 enum psType type; //!< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 74 int size; //!< Total number of elements available 75 int n; //!< Number of elements in use 76 float *arr; //!< The array data 77 } psFloatArray; 78 79 /** Constructor */ 80 psFloatArray *psFloatArrayAlloc(int s, //!< Total number of elements to make available 81 int n //!< Number of elements that will be used 82 ); 83 /** Reallocator */ 84 psFloatArray *psFloatArrayRealloc(psFloatArray *myArray, //!< Array to reallocate 85 int s //!< Total number of elements to make available 86 ); 87 /** Destructor */ 88 void psFloatArrayFree(psFloatArray *restrict myArray //!< Array to free 89 ); 90 91 /************************************************************************************************************/ 68 92 69 93 /** Define a vector as an array of real numbers */ 70 94 typedef psFloatArray psVector; 95 #define psVectorAlloc(S,N) psFloatArrayAlloc(S,N) //!< Constructor 96 #define psVectorRealloc(A,S) psFloatArrayRealloc(A,S) //!< Reallocator 97 #define psVectorFree(A) psFloatArrayFree(A) //!< Destructor 98 99 /************************************************************************************************************/ 71 100 72 101 /** An array of complex numbers */ 73 PS_DECLARE_ARRAY_TYPE(psComplex); 102 typedef struct { 103 enum psType type; //!< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 104 int size; //!< Total number of elements available 105 int n; //!< Number of elements in use 106 complex float *arr; //!< The array data 107 } psComplexArray; 108 109 /** Constructor */ 110 psComplexArray *psComplexArrayAlloc(int s, //!< Total number of elements to make available 111 int n //!< Number of elements that will be used 112 ); 113 /** Reallocator */ 114 psComplexArray *psComplexArrayRealloc(psComplexArray *myArray, //!< Array to reallocate 115 int s //!< Total number of elements to make available 116 ); 117 /** Destructor */ 118 void psComplexArrayFree(psComplexArray *restrict myArray //!< Array to free 119 ); 120 121 /************************************************************************************************************/ 74 122 75 123 /** An array of integers */ 76 PS_DECLARE_ARRAY_TYPE(psInt); 124 typedef struct { 125 enum psType type; //!< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 126 int size; //!< Total number of elements available 127 int n; //!< Number of elements in use 128 int *arr; //!< The array data 129 } psIntArray; 130 131 /** Constructor */ 132 psIntArray *psIntArrayAlloc(int s, //!< Total number of elements to make available 133 int n //!< Number of elements that will be used 134 ); 135 /** Reallocator */ 136 psIntArray *psIntArrayRealloc(psIntArray *myArray, //!< Array to reallocate 137 int s //!< Total number of elements to make available 138 ); 139 /** Destructor */ 140 void psIntArrayFree(psIntArray *restrict myArray //!< Array to free 141 ); 142 143 /************************************************************************************************************/ 77 144 78 145 /** An array of double-precision real numbers */ 79 PS_DECLARE_ARRAY_TYPE(psDouble); 146 typedef struct { 147 enum psType type; //!< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 148 int size; //!< Total number of elements available 149 int n; //!< Number of elements in use 150 double *arr; //!< The array data 151 } psDoubleArray; 80 152 81 PS_DECLARE_ARRAY_TYPE(psFloatArray); ///< Declare an array of real vectors (psFloatArrayArray). 153 /** Constructor */ 154 psDoubleArray *psDoubleArrayAlloc(int s, //!< Total number of elements to make available 155 int n //!< Number of elements that will be used 156 ); 157 /** Reallocator */ 158 psDoubleArray *psDoubleArrayRealloc(psDoubleArray *myArray, //!< Array to reallocate 159 int s //!< Total number of elements to make available 160 ); 161 /** Destructor */ 162 void psDoubleArrayFree(psDoubleArray *restrict myArray //!< Array to free 163 ); 164 165 /************************************************************************************************************/ 166 167 /** An array of real vectors */ 168 typedef struct { 169 enum psType type; //!< Type of data. THIS STRUCT ELEMENT MUST BE FIRST IN THE STRUCT! 170 int size; //!< Total number of elements available 171 int n; //!< Number of elements in use 172 psFloatArray *arr; //!< The array data 173 } psVectorArray; 174 175 /** Constructor */ 176 psVectorArray *psVectorArrayAlloc(int s, //!< Total number of elements to make available 177 int n //!< Number of elements that will be used 178 ); 179 /** Reallocator */ 180 psVectorArray *psVectorArrayRealloc(psVectorArray *myArray, //!< Array to reallocate 181 int s //!< Total number of elements to make available 182 ); 183 /** Destructor */ 184 void psVectorArrayFree(psVectorArray *restrict myArray //!< Array to free 185 ); 186 187 /************************************************************************************************************/ 82 188 83 189 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
