Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

Cp_trie


Files

file  trie.h

Data Structures

struct  _cp_trie_node
struct  _cp_trie

Defines

#define NODE_MATCH(n, i)   ((n)->others ? mtab_get((n)->others, *i) : NULL)
#define BRANCH_COUNT(node)   mtab_count((node)->others)
#define cp_trie_rdlock(grp)   (cp_trie_lock(grp, COLLECTION_LOCK_READ))
#define cp_trie_wrlock(grp)   (cp_trie_lock(grp, COLLECTION_LOCK_WRITE))

Typedefs

typedef int(* cp_trie_match_fn )(void *leaf)
typedef CPROPS_DLL struct
_cp_trie_node 
cp_trie_node
typedef CPROPS_DLL struct
_cp_trie 
cp_trie

Functions

CPROPS_DLL cp_trie_node * cp_trie_node_new (void *leaf, cp_mempool *pool)
CPROPS_DLL void * cp_trie_node_delete (struct _cp_trie *grp, cp_trie_node *node)
CPROPS_DLL void cp_trie_delete_mapping (struct _cp_trie *grp, mtab_node *map_node)
CPROPS_DLL void cp_trie_node_unmap (struct _cp_trie *grp, cp_trie_node **node)
CPROPS_DLL cp_trie * cp_trie_create_trie (int mode, cp_copy_fn copy_leaf, cp_destructor_fn delete_leaf)
CPROPS_DLL cp_trie * cp_trie_create (int mode)
CPROPS_DLL int cp_trie_destroy (cp_trie *grp)
CPROPS_DLL int cp_trie_add (cp_trie *grp, char *key, void *leaf)
CPROPS_DLL int cp_trie_remove (cp_trie *grp, char *key, void **leaf)
CPROPS_DLL int cp_trie_prefix_match (cp_trie *grp, char *key, void **leaf)
CPROPS_DLL void * cp_trie_exact_match (cp_trie *grp, char *key)
CPROPS_DLL cp_vector * cp_trie_fetch_matches (cp_trie *grp, char *key)
CPROPS_DLL cp_vector * cp_trie_submatch (cp_trie *grp, char *key)
CPROPS_DLL int cp_trie_count (cp_trie *grp)
CPROPS_DLL void cp_trie_set_root (cp_trie *grp, void *leaf)
CPROPS_DLL int cp_trie_lock (cp_trie *grp, int type)
CPROPS_DLL int cp_trie_unlock (cp_trie *grp)
CPROPS_DLL int cp_trie_get_mode (cp_trie *grp)
CPROPS_DLL int cp_trie_set_mode (cp_trie *grp, int mode)
CPROPS_DLL int cp_trie_unset_mode (cp_trie *grp, int mode)
CPROPS_DLL void cp_trie_dump (cp_trie *grp)
CPROPS_DLL int cp_trie_use_mempool (cp_trie *tree, cp_mempool *pool)
CPROPS_DLL int cp_trie_share_mempool (cp_trie *tree, cp_shared_mempool *pool)

Function Documentation

CPROPS_DLL int cp_trie_add cp_trie *  grp,
char *  key,
void *  leaf
 

add a mapping to a trie

Definition at line 356 of file trie.c.

References COLLECTION_LOCK_WRITE.

Referenced by cp_httpsocket_register_service().

CPROPS_DLL int cp_trie_count cp_trie *  grp  ) 
 

return the number of stored items

Definition at line 700 of file trie.c.

CPROPS_DLL cp_trie* cp_trie_create int  mode  ) 
 

create a new cp_trie object with the specified collection mode

Definition at line 242 of file trie.c.

References cp_trie_create_trie().

CPROPS_DLL cp_trie* cp_trie_create_trie int  mode,
cp_copy_fn  copy_leaf,
cp_destructor_fn  delete_leaf
 

create a new cp_trie object with the specified collection mode and leaf management functions

Definition at line 203 of file trie.c.

Referenced by cp_httpclient_init(), cp_httpsocket_register_service(), and cp_trie_create().

CPROPS_DLL int cp_trie_destroy cp_trie *  grp  ) 
 

delete a cp_trie object

Definition at line 250 of file trie.c.

Referenced by cp_httpclient_init(), cp_httpclient_shutdown(), and cp_httpsocket_delete().

CPROPS_DLL void* cp_trie_exact_match cp_trie *  grp,
char *  key
 

return the mapping for the given key if any

Definition at line 535 of file trie.c.

References COLLECTION_LOCK_READ.

CPROPS_DLL cp_vector* cp_trie_fetch_matches cp_trie *  grp,
char *  key
 

return a vector containing exact match and any prefix matches

Definition at line 568 of file trie.c.

References COLLECTION_LOCK_READ.

CPROPS_DLL int cp_trie_prefix_match cp_trie *  grp,
char *  key,
void **  leaf
 

return the mapping for the longest prefix of the given key

Definition at line 664 of file trie.c.

References COLLECTION_LOCK_READ.

CPROPS_DLL int cp_trie_remove cp_trie *  grp,
char *  key,
void **  leaf
 

remove a mapping from a trie

Definition at line 433 of file trie.c.

References COLLECTION_LOCK_READ.

Referenced by cp_httpsocket_unregister_service().

CPROPS_DLL cp_vector* cp_trie_submatch cp_trie *  grp,
char *  key
 

return a vector containing all entries in subtree under path given by key

Definition at line 627 of file trie.c.

References COLLECTION_LOCK_READ.


Generated on Sat Dec 1 10:25:30 2007 for cprops by  doxygen 1.3.9.1