00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00026 #ifndef CACHE_PQUEUE_H
00027 #define CACHE_PQUEUE_H
00028
00029 #include <apr.h>
00030 #include <apr_errno.h>
00031
00032 #if APR_HAVE_STDIO_H
00033 #include <stdio.h>
00034 #endif
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00041 typedef struct cache_pqueue_t cache_pqueue_t;
00042
00048 typedef long (*cache_pqueue_set_priority)(long queue_clock, void *a);
00049 typedef long (*cache_pqueue_get_priority)(void *a);
00050
00052 typedef apr_ssize_t (*cache_pqueue_getpos)(void *a);
00053
00059 typedef void (*cache_pqueue_setpos)(void *a, apr_ssize_t pos);
00060
00062 typedef void (*cache_pqueue_print_entry)(FILE *out, void *a);
00063
00075 cache_pqueue_t *cache_pq_init(apr_ssize_t n,
00076 cache_pqueue_get_priority pri,
00077 cache_pqueue_getpos get,
00078 cache_pqueue_setpos set);
00083 void cache_pq_free(cache_pqueue_t *q);
00088 apr_ssize_t cache_pq_size(cache_pqueue_t *q);
00089
00096 apr_status_t cache_pq_insert(cache_pqueue_t *q, void *d);
00097
00098
00099
00100
00101
00102
00103
00104 void cache_pq_change_priority(cache_pqueue_t *q,
00105 long old_priority,
00106 long new_priority,
00107 void *d);
00108
00115 void *cache_pq_pop(cache_pqueue_t *q);
00116
00123 apr_status_t cache_pq_remove(cache_pqueue_t *q, void *d);
00124
00131 void *cache_pq_peek(cache_pqueue_t *q);
00132
00141 void cache_pq_print(cache_pqueue_t *q,
00142 FILE *out,
00143 cache_pqueue_print_entry print);
00144
00153 void cache_pq_dump(cache_pqueue_t *q,
00154 FILE *out,
00155 cache_pqueue_print_entry print);
00156
00163 int cache_pq_is_valid(cache_pqueue_t *q);
00164
00165 #ifdef __cplusplus
00166 }
00167 #endif
00168
00169 #endif
00170