2015-04-05 20:27:02 +02:00
|
|
|
#ifndef __STRHEAP_H
|
|
|
|
#define __STRHEAP_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2015-04-11 19:00:51 +02:00
|
|
|
#include "strlist.h"
|
2015-04-05 20:27:02 +02:00
|
|
|
#include "avltree.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct avltree * cw_strheap_t;
|
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
|
2015-04-05 20:27:02 +02:00
|
|
|
extern cw_strheap_t cw_strheap_create();
|
2015-10-18 09:49:14 +02:00
|
|
|
extern int cw_strheap_register_strings(cw_strheap_t h, struct cw_strlist_elem *s);
|
2015-04-05 20:27:02 +02:00
|
|
|
|
|
|
|
static inline const char * cw_strheap_get(cw_strheap_t h, int id) {
|
2015-10-18 09:49:14 +02:00
|
|
|
struct cw_strlist_elem s;
|
2015-04-05 20:27:02 +02:00
|
|
|
s.id=id;
|
2015-10-18 09:49:14 +02:00
|
|
|
struct cw_strlist_elem *r = avltree_get(h,&s);
|
2015-04-07 07:42:36 +02:00
|
|
|
if (r)
|
|
|
|
return r->str;
|
|
|
|
return NULL;
|
2015-04-05 20:27:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|