Go to the documentation of this file.
55 struct skip_list_cursor;
64 struct skip_list *
skip_list_create(
unsigned priority_size,
double probability);
142 bool skip_list_tell(
struct skip_list_cursor *cur,
unsigned *index);
176 #define skip_list_cursor_move_to_priority(cur, ...) \
177 skip_list_cursor_move_to_priority_arr(cur, (double[]){__VA_ARGS__})
185 bool skip_list_get(
struct skip_list_cursor *cur,
void **item);
199 bool skip_list_set(
struct skip_list_cursor *cur,
void *item);
232 #define skip_list_remove_by_priority(sl, ...) \
233 skip_list_remove_by_priority_arr(sl, (double[]){__VA_ARGS__})
258 #define skip_list_insert(lst, item, ...) \
259 skip_list_insert_arr(lst, item, (double[]){__VA_ARGS__})
296 #define SKIP_LIST_ITERATE(cursor, item) \
297 for(; skip_list_get(cursor, (void **)&item); skip_list_next(cursor))
const double * skip_list_get_priority(struct skip_list_cursor *cur)
Get the priority tuple of the item under a cursor.
bool skip_list_next(struct skip_list_cursor *cur)
Move a cursor to the next item.
void skip_list_reset(struct skip_list_cursor *cur)
Reset the position of a cursor.
bool skip_list_prev(struct skip_list_cursor *cur)
Move a cursor to the previous item.
void skip_list_cursor_move(struct skip_list_cursor *to_move, struct skip_list_cursor *destination)
Move a cursor's position to match another cursor.
struct skip_list_cursor * skip_list_cursor_create(struct skip_list *sl)
Create a cursor for traversing a skip list.
bool skip_list_cursor_move_to_priority_arr(struct skip_list_cursor *cur, double *priority)
Move a cursor to the first item with the given priority tuple (internal function).
bool skip_list_set(struct skip_list_cursor *cur, void *item)
Set the value under the cursor.
int skip_list_size(struct skip_list *sl)
Get the number of items in a skip list.
void * skip_list_pop_head(struct skip_list *sl)
Remove and return the first item in the skip list.
bool skip_list_get(struct skip_list_cursor *cur, void **item)
Get the item under a cursor.
const void * skip_list_peek_head(struct skip_list *sl)
Get the first item in the skip list without removing it.
bool skip_list_remove(struct skip_list *sl, void *data)
Remove the first node found with the given data pointer.
bool skip_list_remove_by_priority_arr(struct skip_list *sl, double *priority)
Remove the first node found with the given priority tuple.
struct skip_list * skip_list_create(unsigned priority_size, double probability)
Create an empty skip list with priority-based sorting.
bool skip_list_delete(struct skip_list *sl)
Delete a skip list.
void skip_list_insert_arr(struct skip_list *lst, void *item, double *priority)
Insert an item with priority into the skip list (internal function).
struct skip_list_cursor * skip_list_cursor_clone(struct skip_list_cursor *cur)
Get a copy of an existing cursor.
bool skip_list_tell(struct skip_list_cursor *cur, unsigned *index)
Get the position of a cursor within a skip list.
void skip_list_cursor_delete(struct skip_list_cursor *cur)
Delete a previously created cursor.
bool skip_list_seek(struct skip_list_cursor *cur, int index)
Move a cursor to an item by index.
bool skip_list_remove_here(struct skip_list_cursor *cur)
Remove the item under the cursor.
const double * skip_list_peek_head_priority(struct skip_list *sl)
Get the priority tuple of the first item in the skip list.