79 void *(*at)(cx_list_s *list, size_t index); |
79 void *(*at)(cx_list_s *list, size_t index); |
80 |
80 |
81 /** |
81 /** |
82 * Member function for finding an element. |
82 * Member function for finding an element. |
83 */ |
83 */ |
84 size_t (*find)(cx_list_s *list, void *elem); |
84 size_t (*find)( |
|
85 cx_list_s *list, |
|
86 void *elem |
|
87 ); |
85 |
88 |
86 /** |
89 /** |
87 * Member function for sorting the list in place. |
90 * Member function for sorting the list in place. |
88 */ |
91 */ |
89 void (*sort)(cx_list_s *list); |
92 void (*sort)(cx_list_s *list); |
|
93 |
|
94 /** |
|
95 * Member function for comparing this list to another list of the same type. |
|
96 */ |
|
97 int (*compare)( |
|
98 cx_list_s *list, |
|
99 cx_list_s *other |
|
100 ); |
90 } cx_list_class; |
101 } cx_list_class; |
91 |
102 |
92 /** |
103 /** |
93 * Structure for holding the base data of a list. |
104 * Structure for holding the base data of a list. |
94 */ |
105 */ |
203 */ |
214 */ |
204 static inline void cxListSort(CxList list) { |
215 static inline void cxListSort(CxList list) { |
205 list->cl->sort(list); |
216 list->cl->sort(list); |
206 } |
217 } |
207 |
218 |
|
219 /** |
|
220 * Compares a list to another list of the same type. |
|
221 * |
|
222 * First, the list sizes are compared. If they match, the lists are compared element-wise. |
|
223 * |
|
224 * @param list the list |
|
225 * @param other the list to compare to |
|
226 * @return zero, if both lists are equal element wise, negative if the first list is smaller, zero if the first list is larger |
|
227 */ |
|
228 static inline int cxListCompare( |
|
229 CxList list, |
|
230 CxList other |
|
231 ) { |
|
232 return list->cl->compare(list, other); |
|
233 } |
|
234 |
208 #ifdef __cplusplus |
235 #ifdef __cplusplus |
209 } /* extern "C" */ |
236 } /* extern "C" */ |
210 #endif |
237 #endif |
211 |
238 |
212 #endif /* UCX_LIST_H */ |
239 #endif /* UCX_LIST_H */ |