Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

sfghash.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "sfghash.h"

Go to the source code of this file.

Functions

static void * s_malloc (int n)
static void s_free (void *p)
static int isPrime (int num)
static int calcNextPrime (int num)
SFGHASHsfghash_new (int nrows, int keysize, int userkeys, void(*userfree)(void *p))
void sfghash_splaymode (SFGHASH *t, int n)
SFDICTsfdict_new (int nitems)
void sfdict_delete (SFDICT *h)
void sfghash_delete (SFGHASH *h)
int sfghash_count (SFGHASH *t)
int sfdict_count (SFDICT *t)
int sfghash_add (SFGHASH *t, void *key, void *data)
int sfdict_add (SFGHASH *t, char *key, void *data)
static void movetofront (SFGHASH *t, int index, SFGHASH_NODE *n)
static SFGHASH_NODEsfghash_find_node (SFGHASH *t, void *key)
void * sfghash_find (SFGHASH *t, void *key)
static int sfghash_free_node (SFGHASH *t, unsigned index, SFGHASH_NODE *hnode)
int sfghash_remove (SFGHASH *t, void *key)
int sfdict_remove (SFGHASH *t, char *key)
SFGHASH_NODEsfghash_findfirst1 (SFGHASH *t)
SFGHASH_NODEsfghash_findnext1 (SFGHASH *t)
static void sfghash_next (SFGHASH *t)
SFGHASH_NODEsfghash_findfirst (SFGHASH *t)
SFGHASH_NODEsfghash_findnext (SFGHASH *t)
int sfatom_setsize (int n)
int sfatom_init ()
int sfatom_reset ()
int sfatom_add (char *str, void *data)
int sfatom_remove (char *str)
void * sfatom_find (char *str)
int sfatom_count ()
SFGHASH_NODEsfatom_findfirst ()
SFGHASH_NODEsfatom_findnext ()

Variables

static SFGHASHg_atom = 0
static int atom_first = 1
static int natoms = 1000


Function Documentation

static int calcNextPrime int  num  )  [static]
 

Definition at line 89 of file sfghash.c.

References isPrime().

Referenced by sfghash_new(), sfhashfcn_new(), and sfxhash_new().

static int isPrime int  num  )  [static]
 

Definition at line 75 of file sfghash.c.

Referenced by calcNextPrime().

static void movetofront SFGHASH t,
int  index,
SFGHASH_NODE n
[static]
 

Definition at line 362 of file sfghash.c.

References _sfghash_node::next, _sfghash_node::prev, and _sfghash::table.

Referenced by sfghash_find_node(), and sfxhash_find_node_row().

static void s_free void *  p  )  [static]
 

Definition at line 58 of file sfghash.c.

static void* s_malloc int  n  )  [static]
 

Definition at line 49 of file sfghash.c.

int sfatom_add char *  str,
void *  data
 

Definition at line 700 of file sfghash.c.

References sfatom_init(), sfghash_add(), SFGHASH_ERR, and SFGHASH_OK.

int sfatom_count  ) 
 

Definition at line 736 of file sfghash.c.

References _sfghash::count.

void* sfatom_find char *  str  ) 
 

Definition at line 729 of file sfghash.c.

References sfghash_find().

SFGHASH_NODE* sfatom_findfirst  ) 
 

Definition at line 743 of file sfghash.c.

References NULL, and sfghash_findfirst().

SFGHASH_NODE* sfatom_findnext  ) 
 

Definition at line 754 of file sfghash.c.

References NULL, and sfghash_findnext().

int sfatom_init  ) 
 

Definition at line 665 of file sfghash.c.

References GH_COPYKEYS, NULL, SFGHASH_ERR, sfghash_new(), and SFGHASH_OK.

Referenced by sfatom_add(), and sfatom_reset().

int sfatom_remove char *  str  ) 
 

Definition at line 722 of file sfghash.c.

References sfghash_remove().

int sfatom_reset  ) 
 

Definition at line 684 of file sfghash.c.

References sfatom_init(), sfghash_delete(), SFGHASH_ERR, and SFGHASH_OK.

int sfatom_setsize int  n  ) 
 

Definition at line 657 of file sfghash.c.

int sfdict_add SFGHASH t,
char *  key,
void *  data
 

Definition at line 355 of file sfghash.c.

References sfghash_add().

int sfdict_count SFDICT t  ) 
 

Definition at line 230 of file sfghash.c.

References _sfghash::count.

void sfdict_delete SFDICT h  ) 
 

Definition at line 178 of file sfghash.c.

References sfghash_delete().

SFDICT* sfdict_new int  nitems  ) 
 

Definition at line 173 of file sfghash.c.

References GH_COPYKEYS, NULL, and sfghash_new().

int sfdict_remove SFGHASH t,
char *  key
 

Definition at line 519 of file sfghash.c.

References sfghash_remove().

int sfghash_add SFGHASH t,
void *  key,
void *  data
 

Definition at line 257 of file sfghash.c.

References _sfghash::cnode, _sfghash::count, _sfghash_node::data, _SFHASHFCN::hash_fcn, index, _sfghash_node::key, _SFHASHFCN::keycmp_fcn, _sfghash::keysize, memcpy, _sfghash_node::next, _sfghash::nrows, _sfghash_node::prev, s_malloc(), SFGHASH_INTABLE, SFGHASH_NOMEM, SFGHASH_OK, _sfghash::sfhashfcn, _sfghash::table, and _sfghash::userkey.

Referenced by FlowBitsParse(), sfatom_add(), sfdict_add(), and sfthd_create_threshold_local().

int sfghash_count SFGHASH t  ) 
 

Definition at line 225 of file sfghash.c.

References _sfghash::count.

void sfghash_delete SFGHASH h  ) 
 

Definition at line 188 of file sfghash.c.

References _sfghash_node::data, _sfghash_node::key, _sfghash_node::next, _sfghash::nrows, s_free(), _sfghash::sfhashfcn, sfhashfcn_free(), _sfghash::table, _sfghash::userfree, and _sfghash::userkey.

Referenced by sfatom_reset(), and sfdict_delete().

void* sfghash_find SFGHASH t,
void *  key
 

Definition at line 429 of file sfghash.c.

References _sfghash_node::data, NULL, and sfghash_find_node().

Referenced by FlowBitsParse(), sfatom_find(), sfthd_create_threshold_local(), and sfthd_test_threshold().

static SFGHASH_NODE* sfghash_find_node SFGHASH t,
void *  key
[static]
 

Definition at line 380 of file sfghash.c.

References _SFHASHFCN::hash_fcn, index, _sfghash_node::key, _SFHASHFCN::keycmp_fcn, _sfghash::keysize, movetofront(), _sfghash_node::next, _sfghash::nrows, NULL, _sfghash::sfhashfcn, _sfghash::splay, and _sfghash::table.

Referenced by sfghash_find().

SFGHASH_NODE* sfghash_findfirst SFGHASH t  ) 
 

Definition at line 595 of file sfghash.c.

References _sfghash::cnode, _sfghash::crow, _sfghash::nrows, NULL, sfghash_next(), and _sfghash::table.

Referenced by FlowBitsVerify(), print_thd_local(), sfatom_findfirst(), and sfthd_show_objects().

SFGHASH_NODE* sfghash_findfirst1 SFGHASH t  ) 
 

Definition at line 527 of file sfghash.c.

References _sfghash::cnode, _sfghash::crow, _sfghash::nrows, NULL, and _sfghash::table.

SFGHASH_NODE* sfghash_findnext SFGHASH t  ) 
 

Definition at line 620 of file sfghash.c.

References _sfghash::cnode, NULL, and sfghash_next().

Referenced by FlowBitsVerify(), print_thd_local(), sfatom_findnext(), and sfthd_show_objects().

SFGHASH_NODE* sfghash_findnext1 SFGHASH t  ) 
 

Definition at line 543 of file sfghash.c.

References _sfghash::cnode, _sfghash::crow, _sfghash_node::next, _sfghash::nrows, NULL, and _sfghash::table.

static int sfghash_free_node SFGHASH t,
unsigned  index,
SFGHASH_NODE hnode
[static]
 

Definition at line 443 of file sfghash.c.

References _sfghash::count, _sfghash_node::data, _sfghash_node::key, _sfghash_node::next, _sfghash_node::prev, s_free(), SFGHASH_OK, _sfghash::table, _sfghash::userfree, and _sfghash::userkey.

Referenced by sfghash_remove().

SFGHASH* sfghash_new int  nrows,
int  keysize,
int  userkeys,
void(*)(void *p)  userfree
 

Definition at line 116 of file sfghash.c.

References calcNextPrime(), _sfghash::cnode, _sfghash::count, _sfghash::crow, _sfghash::keysize, memset, _sfghash::nrows, s_malloc(), _sfghash::sfhashfcn, sfhashfcn_new(), _sfghash::table, _sfghash::userfree, and _sfghash::userkey.

Referenced by SetupFlowBits(), sfatom_init(), sfdict_new(), and sfthd_create_threshold_local().

static void sfghash_next SFGHASH t  )  [static]
 

Definition at line 569 of file sfghash.c.

References _sfghash::cnode, _sfghash::crow, _sfghash_node::next, _sfghash::nrows, and _sfghash::table.

Referenced by sfghash_findfirst(), and sfghash_findnext().

int sfghash_remove SFGHASH t,
void *  key
 

Definition at line 476 of file sfghash.c.

References _SFHASHFCN::hash_fcn, index, _sfghash_node::key, _SFHASHFCN::keycmp_fcn, _sfghash::keysize, _sfghash_node::next, _sfghash::nrows, SFGHASH_ERR, sfghash_free_node(), _sfghash::sfhashfcn, and _sfghash::table.

Referenced by sfatom_remove(), and sfdict_remove().

void sfghash_splaymode SFGHASH t,
int  n
 

Definition at line 167 of file sfghash.c.

References _sfghash::splay.


Variable Documentation

int atom_first = 1 [static]
 

Definition at line 651 of file sfghash.c.

SFGHASH* g_atom = 0 [static]
 

Definition at line 650 of file sfghash.c.

int natoms = 1000 [static]
 

Definition at line 652 of file sfghash.c.


Generated on Sun May 14 14:51:26 2006 by  doxygen 1.4.2