Changeset 2204 for trunk/psLib/src/collections/psList.h
- Timestamp:
- Oct 26, 2004, 2:57:34 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/collections/psList.h (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psList.h
r1747 r2204 10 10 * @ingroup LinkedList 11 11 * 12 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004- 09-09 02:23:27$12 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-27 00:57:31 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 18 18 #include <pthread.h> // we need a mutex to make this stuff thread safe. 19 #include <stdbool.h> // we use the bool type.20 19 21 20 #include "psCompare.h" … … 46 45 struct psListElem* prev; ///< previous link in list 47 46 struct psListElem* next; ///< next link in list 48 void *data; ///< real data item47 psPtr data; ///< real data item 49 48 } 50 49 psListElem; … … 57 56 typedef struct 58 57 { 59 unsigned intsize; ///< number of elements on list58 psU32 size; ///< number of elements on list 60 59 psListElem* head; ///< first element on list (may be NULL) 61 60 psListElem* tail; ///< last element on list (may be NULL) 62 61 psListElem* iter; ///< iteration cursor 63 unsigned intiterIndex; ///< the numeric position of the iteration cursor in the list62 psU32 iterIndex; ///< the numeric position of the iteration cursor in the list 64 63 pthread_mutex_t lock; ///< mutex to lock a node during changes 65 64 } … … 71 70 */ 72 71 psList* psListAlloc( 73 void *data72 psPtr data 74 73 ///< initial data item; may be NULL if no an empty psList is desired 75 74 ) … … 81 80 * NULL, the return value will also be NULL. 82 81 */ 83 bool psListAdd(82 psBool psListAdd( 84 83 psList* restrict list, ///< list to add to (if NULL, nothing is done) 85 intlocation, ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location.86 void *data ///< data item to add. If NULL, list is not modified.84 psS32 location, ///< index, PS_LIST_HEAD, PS_LIST_TAIL, or numbered location. 85 psPtr data ///< data item to add. If NULL, list is not modified. 87 86 ); 88 87 89 88 /** Remove an item from a list. If location parameter is PS_LIST_UNKNOWN, 90 89 * 91 * @return bool TRUE if element is successfully removed, otherwise FALSE.90 * @return psBool TRUE if element is successfully removed, otherwise FALSE. 92 91 */ 93 bool psListRemove(92 psBool psListRemove( 94 93 psList* restrict list, 95 94 ///< list to remove element from 96 intlocation,95 psS32 location, 97 96 ///< index of item, or PS_LIST_UNKNOWN, PS_LIST_NEXT, PS_LIST_PREV, or numbered location. 98 void *data97 psPtr data 99 98 ///< if location is PS_LIST_UNKNOWN, data item to find and remove, otherwise this is ignored. 100 99 ); … … 102 101 /** Retrieve an item from a list. 103 102 * 104 * @return void*the item corresponding to the location parameter. If103 * @return psPtr the item corresponding to the location parameter. If 105 104 * location is invalid (e.g., a numbered index greater 106 105 * than the list size or if the list is empty), a 107 106 * NULL is returned. 108 107 */ 109 void *psListGet(108 psPtr psListGet( 110 109 psList* restrict list, ///< list to retrieve element from 111 intlocation ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN110 psS32 location ///< index number, or PS_LIST_NEXT, PS_LIST_PREV, PS_LIST_UNKNOWN 112 111 ); 113 112 … … 118 117 void psListSetIterator( 119 118 psList* restrict list, ///< list to retrieve element from 120 intlocation ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL119 psS32 location ///< index number, PS_LIST_HEAD, or PS_LIST_TAIL 121 120 ); 122 121 … … 124 123 * the next list position. 125 124 * 126 * @return void*the data item next on the list or NULL if the iterator125 * @return psPtr the data item next on the list or NULL if the iterator 127 126 * is already pointing to the last element or the list 128 127 * parameter was NULL. 129 128 */ 130 void *psListGetNext(129 psPtr psListGetNext( 131 130 psList* restrict list ///< list to retrieve element from 132 131 ); … … 135 134 * not move the iterator location. 136 135 * 137 * @return void*the data item cooresponding to current iterator136 * @return psPtr the data item cooresponding to current iterator 138 137 * cursor position of the list, or NULL if either the 139 138 * iterator is not valid or list parameter was NULL. 140 139 */ 141 void *psListGetCurrent(140 psPtr psListGetCurrent( 142 141 psList* restrict list ///< list to retrieve element from 143 142 ); … … 146 145 * iterator to the previous list position. 147 146 * 148 * @return void*the data item previous on the list or NULL if the iterator147 * @return psPtr the data item previous on the list or NULL if the iterator 149 148 * is already pointing to the first element or the list 150 149 * parameter was NULL. 151 150 */ 152 void *psListGetPrevious(151 psPtr psListGetPrevious( 153 152 psList* restrict list ///< list to retrieve element from 154 153 );
Note:
See TracChangeset
for help on using the changeset viewer.
