00001 #pragma once
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <glib.h>
00022
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026
00027
00028 typedef struct _GSkiplist GSkiplist;
00029 typedef struct _GSkipNode GSkipNode;
00030 typedef struct _GSkipLink GSkipLink;
00031
00032
00033 const extern int max_size;
00034
00038 struct _GSkiplist{
00039 GSkipNode* head_node;
00040 GCompareFunc cmp_func;
00041 size_t length;
00042 GStaticRWLock lock;
00043 };
00044
00045
00046 struct _GSkipLink{
00047 GSkipNode* next;
00048 };
00049
00050 struct _GSkipNode{
00051 void* key;
00052 void* data;
00053 guint height;
00054 GSkipLink link[];
00055 };
00056
00057
00058 GSkiplist* gskiplist_new(GCompareFunc func);
00059
00060 void gskiplist_delete(GSkiplist* sk);
00061
00062 gboolean gskiplist_insert(GSkiplist* sk, gpointer key, gpointer value);
00063
00064
00065 size_t gskiplist_length(GSkiplist* sk);
00066
00067 gpointer gskiplist_remove(GSkiplist* sk, gpointer key);
00068
00069 gpointer gskiplist_search(GSkiplist* sk, gpointer key);
00070
00071 gpointer gskiplist_get_first_value(GSkiplist* sk);
00072
00073 void gskiplist_clean(GSkiplist* sk);
00074
00075
00076
00077 #ifdef __cplusplus
00078 }
00079 #endif
00080
00081