/* Simple trie implementation - header
 * Copyright (C) 2008 Daniel Collins <solemnwarning@solemnwarning.net>
 * Version 1.0 (2008-03-18)
 *
 * I wrote this as a why-not thing, it's probably got a bug somewhere, if you
 * find/fix a bug please email me anyway.
 *
 * This is released to public domain, you may do anything you please with this
 * code, but if you submit it as your own in a class.... $DEITY will know!
*/

#ifndef SOLEMN_TRIE_H
#define SOLEMN_TRIE_H
#include <stdlib.h>

typedef struct trie trie_t;
typedef struct trie_node trie_node_t;

struct trie {
	size_t size;
	trie_node_t *root;
};

struct trie_node {
	trie_node_t *node;
	void *value;
};

trie_t *trie_init(void);
void trie_free(trie_t *hash);

int trie_set(trie_t *hash, char *key, size_t klen, void *value);
int trie_set_str(trie_t *hash, char *key, void *value);

void *trie_get(trie_t *hash, char *key, size_t klen);
void *trie_get_str(trie_t *hash, char *key);

#endif /* !SOLEMN_HTABLE_H */
