Changeset 196 for trunk/archive/pslib/include/psArray.h
- Timestamp:
- Mar 9, 2004, 5:19:15 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psArray.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psArray.h
r181 r196 3 3 4 4 #include <stdlib.h> 5 /* 5 /** 6 6 * Declare TYPEArray 7 7 */ … … 19 19 20 20 /*****************************************************************************/ 21 /* 21 /** 22 22 * Generate the code TYPEArray's constructors/destructors 23 23 */ … … 78 78 79 79 /*****************************************************************************/ 80 /* 81 * Support for pointer types80 /** 81 * Declare array of pointers 82 82 */ 83 83 #define PS_DECLARE_ARRAY_PTR_TYPE(TYPE) \ … … 85 85 PS_DECLARE_ARRAY_TYPE(PS_CONCAT(TYPE, Ptr)) 86 86 87 /** 88 * Create constructors/destructors for array of pointers 89 */ 87 90 #define PS_CREATE_ARRAY_PTR_TYPE(TYPE); \ 88 91 P_PS_CREATE_ARRAY_TYPE(static, my_, P_PS_CONCAT(TYPE, Ptr)) \ … … 117 120 118 121 /*****************************************************************************/ 119 /* 120 * Declare some common types of arrays122 /** 123 * Array of pointers to void. 121 124 * 122 125 * psVoidPtrArray is special, as it needs to have a destructor that … … 125 128 */ 126 129 typedef struct { 127 int n, size; 128 void **arr; 130 int n; //!< Number of elements in use 131 int size; //!< Number of total elements 132 void **arr; //!< The elements 129 133 } psVoidPtrArray; 130 134 131 psVoidPtrArray *psVoidPtrArrayAlloc(int n, int s); 132 psVoidPtrArray *psVoidPtrArrayRealloc(psVoidPtrArray *arr, int n); 133 void psVoidPtrArrayFree(psVoidPtrArray *arr, 134 void (*elemFree)(void *)); // destructor for array data 135 /** Constructor */ 136 psVoidPtrArray *psVoidPtrArrayAlloc(int n, //!< Number of elements to use 137 int s //!< Total number of elements 138 ); 139 /** Reallocate */ 140 psVoidPtrArray *psVoidPtrArrayRealloc(psVoidPtrArray *arr, //!< Array to reallocate 141 int n //!< Number of elements 142 ); 143 /** Destructor */ 144 void psVoidPtrArrayFree(psVoidPtrArray *arr, //!< array to destroy 145 void (*elemFree)(void *) //!< destructor for array data 146 ); 135 147 136 148
Note:
See TracChangeset
for help on using the changeset viewer.
