00001 #ifndef _CP_MTAB_H
00002 #define _CP_MTAB_H
00003
00004 #include "common.h"
00005 #include "collection.h"
00006
00007 __BEGIN_DECLS
00008
00009 #include "config.h"
00010
00011
00012
00013
00014
00015
00016 typedef struct _mtab_node
00017 {
00018 unsigned char key;
00019 void *value;
00020 void *attr;
00021 struct _mtab_node *next;
00022 } mtab_node;
00023
00024 mtab_node *mtab_node_new(unsigned char key, void *value, void *attr);
00025
00026
00027
00028
00029
00030 typedef void *(*mtab_dtr)(void *owner, mtab_node *node);
00031
00032
00033
00034
00035
00036 typedef struct _mtab
00037 {
00038 int size;
00039 int items;
00040 mtab_node **table;
00041 } mtab;
00042
00043 mtab *mtab_new(int size);
00044
00045 void mtab_delete(mtab *t);
00046 void mtab_delete_custom(mtab *t,
00047 void *owner,
00048 mtab_dtr dtr);
00049 mtab_node *mtab_put(mtab *t, unsigned char key, void *value, void *attr);
00050 mtab_node *mtab_get(mtab *t, unsigned char key);
00051 void *mtab_remove(mtab *t, unsigned char key);
00052
00053 int mtab_count(mtab *t);
00054
00055 int mtab_callback(mtab *t, cp_callback_fn fn, void *prm);
00056
00057 __END_DECLS
00058
00059 #endif