Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

dsHashTable Class Reference

Just a hash table, not superfast but relable and convenient. More...

#include <dsHashTable.h>

Inheritance diagram for dsHashTable:

dsHashTableGeneric dsDataAccessor List of all members.

Public Methods

 dsHashTable (int numEntries, DACleanupMode purge=cmPURGE)
char * seek (const char *key, char *defval=0)
dsDataPairseek (dsDataPair *dp)
void * insert (const char *key, void *value, bool replace=false)
void * insert (const char *key, const void *value, size_t size, bool replace=false)
char * insert (const char *key, const char *value, bool replace=false)
long insert (const char *key, long value, bool replace=false)
dsDataPairinsert (dsDataPair *dp, bool replace=false)
virtual void * insert (void *a, bool replace=false)
virtual void * remove (void *a)
virtual void * seek (void *a)
void clear ()
void * walk (int i)
int HSize (void)
int NumEntries (void)

Protected Types

enum  DACleanupMode { cmPASSIVE, cmPURGE }

Protected Methods

virtual int cf (void *a, void *b)
virtual int primary_hash_func (void *a)
virtual int secondary_hash_func (void *a)
virtual void * walk ()

Protected Attributes

DACleanupMode _purge

Detailed Description

This class provide method to store dat in to hashed array and access them by key. You can choise from one of two different hash function and compute hash performance statistic if necessary. For large namber of keys bintree provide better performance and memory usage

See also:
dsBintree

Todo:
Convert defines into enum


Member Enumeration Documentation

enum dsDataAccessor::DACleanupMode [protected, inherited]
 

Enumeration values:
cmPASSIVE  don't delete data body
cmPURGE  delete data body on replace or cleanup


Constructor & Destructor Documentation

dsHashTable::dsHashTable int    numEntries,
DACleanupMode    purge = cmPURGE
[inline]
 


Member Function Documentation

virtual int dsHashTable::cf void *    a,
void *    b
[inline, protected, virtual]
 

Implements dsHashTableGeneric.

void dsHashTableGeneric::clear   [inherited]
 

Reinit table, keep current size

int dsHashTableGeneric::HSize void    [inline, inherited]
 

Function returns curren table size

void * dsHashTableGeneric::insert void *    a,
bool    replace = false
[virtual, inherited]
 

Insert object a into data storage, if replace flag is set existing object will be replaced. Return pointer to existsing object or NULL if new object was inserted.

Implements dsDataAccessor.

dsDataPair * dsHashTable::insert dsDataPair   dp,
bool    replace = false
[inline]
 

long dsHashTable::insert const char *    key,
long    value,
bool    replace = false
[inline]
 

char * dsHashTable::insert const char *    key,
const char *    value,
bool    replace = false
[inline]
 

void * dsHashTable::insert const char *    key,
const void *    value,
size_t    size,
bool    replace = false
[inline]
 

void * dsHashTable::insert const char *    key,
void *    value,
bool    replace = false
[inline]
 

int dsHashTableGeneric::NumEntries void    [inline, inherited]
 

Function returns number of non-empty records in the table

virtual int dsHashTable::primary_hash_func void *    a [inline, protected, virtual]
 

Implements dsHashTableGeneric.

void * dsHashTableGeneric::remove void *    a [virtual, inherited]
 

Remove object a from data storage. Return pointer to removed object or NULL if object doesn't exist

Implements dsDataAccessor.

virtual int dsHashTable::secondary_hash_func void *    a [inline, protected, virtual]
 

Implements dsHashTableGeneric.

void * dsHashTableGeneric::seek void *    a [virtual, inherited]
 

Find object matching a in tree and return pointer to found one or NULL if seek can't be done.

Implements dsDataAccessor.

dsDataPair * dsHashTable::seek dsDataPair   dp [inline]
 

char * dsHashTable::seek const char *    key,
char *    defval = 0
[inline]
 

virtual void* dsDataAccessor::walk   [inline, protected, virtual, inherited]
 

Walk throuph storage behavioure details depends of storage nature

void * dsHashTableGeneric::walk int    i [inline, inherited]
 

Function returns table i'th table record even it is empty


Member Data Documentation

DACleanupMode dsDataAccessor::_purge [protected, inherited]
 

Cleanup mode flag. See DACleanupMode


The documentation for this class was generated from the following files:
Generated on Mon May 16 18:27:00 2005 for libdms4 by doxygen1.3-rc2