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

trie.c File Reference

#include "sys.h"
#include "errors.h"
#include "util.h"
#include "trie.h"

Defines

#define make_trie()   (aw_trie_t *)aw_malloc(sizeof(aw_trie_t))
#define OHT_DEFAULT_MODMASK   1 /* implies initialsize == 2 */

Functions

void aw_trie_clear (aw_trie_t *trie)
 Leave the nodes, clear the buckets.

void * aw_trie_delete (const byte_t *s, aw_trie_t *trie)
 Remove a value associated with string from a trie
Returns:
Return the pointer in the bin.


void aw_trie_destroy (aw_trie_t *trie)
 Free memory used by trie.

void * aw_trie_fetch (const byte_t *s, const aw_trie_t *trie)
int32_t aw_trie_insert (const byte_t *s, void *value_ptr, aw_trie_t *trie)
 Insert a string into a trie with a pointer to an associated value.
Returns:
Returns 0 on success, on error: -AW_OUTOFMEMORY_ERROR.


aw_trie_t * aw_trie_make (void)
 Constructor for a trie dictionary structure
Returns:
Returns a pointer to a trie structure.


void aw_trie_thin (aw_trie_t *trie, void *user_ptr, u_int32_t(*eval)(void *user_ptr, void *value_ptr))
 Free the memory for those nodes that eval( user_ptr, value_ptr ) returns non-zero . Can be used to map all elements.

int32_t aw_trie_uincr (const byte_t *s, u_int32_t uincr, aw_trie_t *trie)
 Interpret the user pointer as a 32bit unsigned int and increment by 'incr' .
Returns:
Return 0 on success , non-0 on failure.



Define Documentation

 
#define make_trie (   )     (aw_trie_t *)aw_malloc(sizeof(aw_trie_t))
 

#define OHT_DEFAULT_MODMASK   1 /* implies initialsize == 2 */
 


Function Documentation

void aw_trie_clear (  aw_trie_t *  trie  ) 
 

Leave the nodes, clear the buckets.

aw_trie_clear

void* aw_trie_delete (  const byte_t *  s,
aw_trie_t *  trie
) 
 

Remove a value associated with string from a trie

Returns:
Return the pointer in the bin.

aw_trie_delete

void aw_trie_destroy (  aw_trie_t *  trie  ) 
 

Free memory used by trie.

aw_trie_destroy

void* aw_trie_fetch (  const byte_t *  s,
const aw_trie_t *  trie
) 
 

aw_trie_fetch

Returns:
Returns the value associated with the string

int32_t aw_trie_insert (  const byte_t *  s,
void *  value_ptr,
aw_trie_t *  trie
) 
 

Insert a string into a trie with a pointer to an associated value.

Returns:
Returns 0 on success, on error: -AW_OUTOFMEMORY_ERROR.

aw_trie_insert

aw_trie_t* aw_trie_make (  void   ) 
 

Constructor for a trie dictionary structure

Returns:
Returns a pointer to a trie structure.

aw_trie_make

void aw_trie_thin (  aw_trie_t *  trie,
void *  user_ptr,
u_int32_t(*  eval)(void *user_ptr, void *value_ptr)
) 
 

Free the memory for those nodes that eval( user_ptr, value_ptr ) returns non-zero . Can be used to map all elements.

aw_trie_thin

int32_t aw_trie_uincr (  const byte_t *  s,
u_int32_t  uincr,
aw_trie_t *  trie
) 
 

Interpret the user pointer as a 32bit unsigned int and increment by 'incr' .

Returns:
Return 0 on success , non-0 on failure.

aw_trie_uincr

Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)