22 #ifndef LIBNAGIOS_SKIPLIST_H_INCLUDED 23 #define LIBNAGIOS_SKIPLIST_H_INCLUDED 36 #define SKIPLIST_ERROR_ARGS 1 37 #define SKIPLIST_ERROR_MEMORY 2 38 #define SKIPLIST_ERROR_DUPLICATE 3 42 struct skiplist_struct;
43 typedef struct skiplist_struct skiplist;
62 skiplist *
skiplist_new(
int max_levels,
float level_probability,
int allow_duplicates,
int append_duplicates,
int (*compare_function)(
void *,
void *));
void * skiplist_find_next(skiplist *list, void *data, void **node_ptr)
Find next entry in skiplist matching data.
int skiplist_empty(skiplist *list)
Empty the skiplist of all data.
void * skiplist_peek(skiplist *list)
Get the first item in the skiplist.
int skiplist_delete(skiplist *list, void *data)
Delete all items matching 'data' from skiplist.
#define NAGIOS_END_DECL
C++ compatibility macro that avoid confusing indentation programs.
Definition: lnag-utils.h:32
void * skiplist_get_first(skiplist *list, void **node_ptr)
Get first node of skiplist.
int skiplist_insert(skiplist *list, void *data)
Insert an item into a skiplist.
skiplist * skiplist_new(int max_levels, float level_probability, int allow_duplicates, int append_duplicates, int(*compare_function)(void *, void *))
Create a new skiplist.
libnagios helper and compatibility macros that lack a "real" home.
int skiplist_delete_first(skiplist *list, void *data)
Delete first item matching 'data' from skiplist.
void * skiplist_get_next(void **node_ptr)
Get next item from node_ptr.
unsigned long skiplist_num_items(skiplist *list)
Return number of items currently in the skiplist.
void * skiplist_find_first(skiplist *list, void *data, void **node_ptr)
Find first entry in skiplist matching data.
int skiplist_delete_node(skiplist *list, void *node_ptr)
Delete a particular node from the skiplist.
int skiplist_free(skiplist **list)
Free all nodes (but not all data) in a skiplist This is similar to skiplist_empty(), but also free()'s the head node.
void * skiplist_pop(skiplist *list)
Pop the first item from the skiplist.
#define NAGIOS_BEGIN_DECL
C++ compatibility macro that avoids confusing indentation programs.
Definition: lnag-utils.h:30