Apache Portable Runtime
|
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more 00002 * contributor license agreements. See the NOTICE file distributed with 00003 * this work for additional information regarding copyright ownership. 00004 * The ASF licenses this file to You under the Apache License, Version 2.0 00005 * (the "License"); you may not use this file except in compliance with 00006 * the License. You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef _APR_SKIPLIST_P_H 00018 #define _APR_SKIPLIST_P_H 00019 00020 #include "apr.h" 00021 #include "apr_portable.h" 00022 #include <stdlib.h> 00023 00024 00025 /* This is the function type that must be implemented per object type 00026 that is used in a skiplist for comparisons to maintain order */ 00027 typedef int (*apr_skiplist_compare) (void *, void *); 00028 typedef void (*apr_skiplist_freefunc) (void *); 00029 00030 struct apr_skiplist; 00031 struct apr_skiplistnode; 00032 00033 typedef struct apr_skiplistnode apr_skiplistnode; 00034 typedef struct apr_skiplist apr_skiplist; 00035 00036 APR_DECLARE(void *) apr_skiplist_alloc(apr_skiplist *sl, size_t size); 00037 00038 APR_DECLARE(void) apr_skiplist_free(apr_skiplist *sl, void *mem); 00039 00040 APR_DECLARE(apr_status_t) apr_skiplist_init(apr_skiplist **sl, apr_pool_t *p); 00041 00042 APR_DECLARE(void) apr_skiplist_set_compare(apr_skiplist *sl, apr_skiplist_compare, 00043 apr_skiplist_compare); 00044 00045 APR_DECLARE(void) apr_skiplist_add_index(apr_skiplist *sl, apr_skiplist_compare, 00046 apr_skiplist_compare); 00047 00048 APR_DECLARE(apr_skiplistnode *) apr_skiplist_getlist(apr_skiplist *sl); 00049 00050 APR_DECLARE(void *) apr_skiplist_find_compare(apr_skiplist *sl, 00051 void *data, 00052 apr_skiplistnode **iter, 00053 apr_skiplist_compare func); 00054 00055 APR_DECLARE(void *) apr_skiplist_find(apr_skiplist *sl, void *data, apr_skiplistnode **iter); 00056 00057 APR_DECLARE(void *) apr_skiplist_next(apr_skiplist *sl, apr_skiplistnode **iter); 00058 00059 APR_DECLARE(void *) apr_skiplist_previous(apr_skiplist *sl, apr_skiplistnode **iter); 00060 00061 00062 APR_DECLARE(apr_skiplistnode *) apr_skiplist_insert_compare(apr_skiplist *sl, 00063 void *data, apr_skiplist_compare comp); 00064 00065 APR_DECLARE(apr_skiplistnode *) apr_skiplist_insert(apr_skiplist* sl, void *data); 00066 00067 APR_DECLARE(int) apr_skiplist_remove_compare(apr_skiplist *sl, void *data, 00068 apr_skiplist_freefunc myfree, apr_skiplist_compare comp); 00069 00070 APR_DECLARE(int) apr_skiplist_remove(apr_skiplist *sl, void *data, apr_skiplist_freefunc myfree); 00071 00072 APR_DECLARE(void) apr_skiplist_remove_all(apr_skiplist *sl, apr_skiplist_freefunc myfree); 00073 00074 APR_DECLARE(void) apr_skiplist_destroy(apr_skiplist *sl, apr_skiplist_freefunc myfree); 00075 00076 APR_DECLARE(void *) apr_skiplist_pop(apr_skiplist *a, apr_skiplist_freefunc myfree); 00077 00078 APR_DECLARE(void *) apr_skiplist_peek(apr_skiplist *a); 00079 00080 APR_DECLARE(apr_skiplist *) apr_skiplist_merge(apr_skiplist *sl1, apr_skiplist *sl2); 00081 00082 #endif