Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

hash::TinyTable Class Reference

#include <TinyTable.h>

List of all members.

Public Member Functions

 TinyTable (uint32_t *mem, size_t max)
 Constructor:.
bool add (const void *ptr)
 Add a pointer = wrap for int.
bool add (uint32_t val)
 Add an int.

Static Public Member Functions

static size_t intsizeFor (size_t n)

Private Attributes

uint32_t * table
 hash table
uint32_t mask
 binary mask = size-1 where size is a power of 2


Constructor & Destructor Documentation

hash::TinyTable::TinyTable uint32_t *  mem,
size_t  max
[inline]
 

Constructor:.

Parameters:
max,: size of the table
mem,: the table itself.
Precondition:
max is a power of 2


Member Function Documentation

bool hash::TinyTable::add uint32_t  val  )  [inline]
 

Add an int.

You should add at max n items as used in hash_sizeofTinyTable(n).

Returns:
true if it was accepted, or false if it was refused, ie, already present in the table.
Parameters:
val,: int to add.
Precondition:
val != 0 -- special value.

bool hash::TinyTable::add const void *  ptr  )  [inline]
 

Add a pointer = wrap for int.

static size_t hash::TinyTable::intsizeFor size_t  n  )  [inline, static]
 

Returns:
size needed in uint32_t to store n items. Use a power of 2 for speed, and use larger table to reduce collisions.
Precondition:
n != 0


Member Data Documentation

uint32_t hash::TinyTable::mask [private]
 

binary mask = size-1 where size is a power of 2

uint32_t* hash::TinyTable::table [private]
 

hash table


The documentation for this class was generated from the following file:
Generated on Fri Jun 30 00:03:00 2006 for Module hash by  doxygen 1.4.2