00001 #ifndef _TABLE_H
00002 #define _TABLE_H
00003
00004 #include "jsoc.h"
00005
00006 typedef struct Entry_struct {
00007 const void *key;
00008 const void *value;
00009 } Entry_t;
00010
00011 typedef struct Table_struct {
00012 int (*not_equal)(const void *, const void *);
00013 int size;
00014 int maxsize;
00015 Entry_t *data;
00016 } Table_t;
00017
00018 void table_free(Table_t *S);
00019 void table_init(int maxsize, Table_t *S, int (*not_equal)(const void *, const void *));
00020 void table_copy(Table_t *dst, Table_t *src);
00021 void table_insert(Table_t *S, const void *key, const void *value);
00022 int table_remove(Table_t *S, const void *key);
00023 void table_map(Table_t *S, void (*f)(const void *, const void *));
00024 void table_map_data(Table_t *S, void (*f)(const void *key, const void *value, const void *data), const void *data);
00025 int table_member(Table_t *S, const void *key);
00026 const void *table_lookup(Table_t *S, const void *key);
00027 int table_len(Table_t *S);
00028
00029 #endif
00030