wtrie.h File Reference

#include "common.h"
#include "config.h"
#include <string.h>
#include <errno.h>
#include "hashtable.h"
#include "vector.h"
#include "wtab.h"
#include "mempool.h"

Go to the source code of this file.

Data Structures

struct  _cp_wtrie_node
struct  _cp_wtrie

Defines

#define WNODE_MATCH(n, i)   ((n)->others ? wtab_get((n)->others, *i) : NULL)
#define BRANCH_COUNT(node)   wtab_count((node)->others)
#define cp_wtrie_rdlock(grp)   (cp_wtrie_lock(grp, COLLECTION_LOCK_READ))
#define cp_wtrie_wrlock(grp)   (cp_wtrie_lock(grp, COLLECTION_LOCK_WRITE))

Typedefs

typedef int(*) cp_wtrie_match_fn (void *leaf)
typedef CPROPS_DLL struct
_cp_wtrie_node 
cp_wtrie_node
typedef CPROPS_DLL struct
_cp_wtrie 
cp_wtrie

Functions

CPROPS_DLL cp_wtrie_node * cp_wtrie_node_new (void *leaf, cp_mempool *pool)
CPROPS_DLL void * cp_wtrie_node_delete (struct _cp_wtrie *grp, cp_wtrie_node *node)
CPROPS_DLL void cp_wtrie_delete_mapping (struct _cp_wtrie *grp, wtab_node *map_node)
CPROPS_DLL void cp_wtrie_node_unmap (struct _cp_wtrie *grp, cp_wtrie_node **node)
CPROPS_DLL cp_wtrie * cp_wtrie_create_wtrie (int mode, cp_copy_fn copy_leaf, cp_destructor_fn delete_leaf)
CPROPS_DLL cp_wtrie * cp_wtrie_create (int mode)
CPROPS_DLL int cp_wtrie_destroy (cp_wtrie *grp)
CPROPS_DLL int cp_wtrie_add (cp_wtrie *grp, wchar_t *key, void *leaf)
CPROPS_DLL int cp_wtrie_remove (cp_wtrie *grp, wchar_t *key, void **leaf)
CPROPS_DLL int cp_wtrie_prefix_match (cp_wtrie *grp, wchar_t *key, void **leaf)
CPROPS_DLL void * cp_wtrie_exact_match (cp_wtrie *grp, wchar_t *key)
CPROPS_DLL cp_vector * cp_wtrie_fetch_matches (cp_wtrie *grp, wchar_t *key)
CPROPS_DLL cp_vector * cp_wtrie_submatch (cp_wtrie *grp, wchar_t *key)
CPROPS_DLL int cp_wtrie_count (cp_wtrie *grp)
CPROPS_DLL void cp_wtrie_set_root (cp_wtrie *grp, void *leaf)
CPROPS_DLL int cp_wtrie_lock (cp_wtrie *grp, int type)
CPROPS_DLL int cp_wtrie_unlock (cp_wtrie *grp)
CPROPS_DLL int cp_wtrie_get_mode (cp_wtrie *grp)
CPROPS_DLL int cp_wtrie_set_mode (cp_wtrie *grp, int mode)
CPROPS_DLL int cp_wtrie_unset_mode (cp_wtrie *grp, int mode)
CPROPS_DLL void cp_wtrie_dump (cp_wtrie *grp)
CPROPS_DLL int cp_wtrie_use_mempool (cp_wtrie *tree, cp_mempool *pool)
CPROPS_DLL int cp_wtrie_share_mempool (cp_wtrie *tree, cp_shared_mempool *pool)


Detailed Description

cp_wtrie is a wide character trie implementation. Tries allow for prefix matching with O(m) = O(1) time (m being the length of the key). Used to store key - value mappings, tries have certain advantages over hashtables in that worse case behavior is still O(1) and no hash function is needed. cp_wtrie is technically a compact trie in that collapses unused character paths.

Definition in file wtrie.h.


Generated on Mon Dec 5 23:00:22 2011 for cprops by  doxygen 1.4.7