DBRHash< KT > Class Template Reference

Direct hash with base type keys only. It is NOT thread-safe! It has remove() and getAll() functions. More...

#include <dbr_hash.h>

Inheritance diagram for DBRHash< KT >:
DHashBase< KT, struct dbr_hash_slot< KT > > zmm::Object

Public Member Functions

 DBRHash (int hashCapacity, int realCapacity, KT emptyKey, KT deletedKey)
virtual ~DBRHash ()
virtual int hashCode (KT key)
virtual bool match (KT key, struct dbr_hash_slot< KT > *slot)
virtual bool isEmptySlot (struct dbr_hash_slot< KT > *slot)
virtual bool isDeletedSlot (struct dbr_hash_slot< KT > *slot)
void clear ()
bool remove (KT key)
void put (KT key)
void getAll (hash_data_array_t< KT > *hash_data_array)
 returns all keys as an array. After the deletion of the DBRHash object, the array is invalid!
zmm::String debugGetAll ()
bool exists (KT key)
void zero ()
int size ()
int baseTypeHashCode (unsigned int key)
int secondaryHashCode (int primary)
bool search (KTkey, struct dbr_hash_slot< KT > **retSlot)
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

static void * operator new (size_t size)
static void operator delete (void *ptr)

Protected Attributes

KT emptyKey
KT deletedKey
KT * data_array
int capacity
int count
struct dbr_hash_slot< KT > * data
mt_atomic_t _ref_count
pthread_mutex_t mutex

Detailed Description

template<typename KT>
class DBRHash< KT >

Direct hash with base type keys only. It is NOT thread-safe! It has remove() and getAll() functions.

Definition at line 52 of file dbr_hash.h.


Constructor & Destructor Documentation

template<typename KT>
DBRHash< KT >::DBRHash ( int  hashCapacity,
int  realCapacity,
KT  emptyKey,
KT  deletedKey 
) [inline]
Parameters:
hashCapacity the size of the hashtable
realCapacityKT maximum number of elements "you" will store in this instance (has to be < than hashCapacity!) WARNING: the number of stored entries MUST be <= realCapacity at all times!

Definition at line 65 of file dbr_hash.h.

template<typename KT>
virtual DBRHash< KT >::~DBRHash (  )  [inline, virtual]

Definition at line 82 of file dbr_hash.h.


Member Function Documentation

int DHashBase< KT , struct dbr_hash_slot< KT > >::baseTypeHashCode ( unsigned int  key  )  [inline, inherited]

Definition at line 74 of file direct_hash_base.h.

Referenced by DBRHash< int >::hashCode().

template<typename KT>
void DBRHash< KT >::clear (  )  [inline]

Definition at line 108 of file dbr_hash.h.

Referenced by DBRHash< int >::DBRHash().

template<typename KT>
zmm::String DBRHash< KT >::debugGetAll (  )  [inline]

Definition at line 168 of file dbr_hash.h.

template<typename KT>
bool DBRHash< KT >::exists ( KT  key  )  [inline]

Definition at line 194 of file dbr_hash.h.

template<typename KT>
void DBRHash< KT >::getAll ( hash_data_array_t< KT > *  hash_data_array  )  [inline]

returns all keys as an array. After the deletion of the DBRHash object, the array is invalid!

Definition at line 162 of file dbr_hash.h.

int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

References zmm::Object::_ref_count, and atomic_get().

template<typename KT>
virtual int DBRHash< KT >::hashCode ( KT  key  )  [inline, virtual]

Implements DHashBase< KT, struct dbr_hash_slot< KT > >.

Definition at line 88 of file dbr_hash.h.

template<typename KT>
virtual bool DBRHash< KT >::isDeletedSlot ( struct dbr_hash_slot< KT > *  slot  )  [inline, virtual]

Reimplemented from DHashBase< KT, struct dbr_hash_slot< KT > >.

Definition at line 103 of file dbr_hash.h.

template<typename KT>
virtual bool DBRHash< KT >::isEmptySlot ( struct dbr_hash_slot< KT > *  slot  )  [inline, virtual]

Implements DHashBase< KT, struct dbr_hash_slot< KT > >.

Definition at line 98 of file dbr_hash.h.

template<typename KT>
virtual bool DBRHash< KT >::match ( KT  key,
struct dbr_hash_slot< KT > *  slot 
) [inline, virtual]

Implements DHashBase< KT, struct dbr_hash_slot< KT > >.

Definition at line 93 of file dbr_hash.h.

void Object::operator delete ( void *  ptr  )  [static, inherited]

Definition at line 87 of file object.cc.

References FREE.

void * Object::operator new ( size_t  size  )  [static, inherited]

Definition at line 83 of file object.cc.

References MALLOC.

template<typename KT>
void DBRHash< KT >::put ( KT  key  )  [inline]

Definition at line 146 of file dbr_hash.h.

void Object::release (  )  [inherited]
template<typename KT>
bool DBRHash< KT >::remove ( KT  key  )  [inline]

Definition at line 124 of file dbr_hash.h.

void Object::retain (  )  [inherited]
bool DHashBase< KT , struct dbr_hash_slot< KT > >::search ( KT  key,
struct dbr_hash_slot< KT > **  retSlot 
) [inline, inherited]
int DHashBase< KT , struct dbr_hash_slot< KT > >::secondaryHashCode ( int  primary  )  [inline, inherited]

Definition at line 103 of file direct_hash_base.h.

int DHashBase< KT , struct dbr_hash_slot< KT > >::size (  )  [inline, inherited]

Definition at line 60 of file direct_hash_base.h.

void DHashBase< KT , struct dbr_hash_slot< KT > >::zero (  )  [inline, inherited]

Definition at line 55 of file direct_hash_base.h.

Referenced by DBRHash< int >::clear().


Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]
int DHashBase< KT , struct dbr_hash_slot< KT > >::capacity [protected, inherited]

Definition at line 41 of file direct_hash_base.h.

Referenced by DBRHash< int >::clear().

int DHashBase< KT , struct dbr_hash_slot< KT > >::count [protected, inherited]
struct dbr_hash_slot< KT > * DHashBase< KT , struct dbr_hash_slot< KT > >::data [protected, inherited]

Definition at line 43 of file direct_hash_base.h.

Referenced by DBRHash< int >::clear().

template<typename KT>
KT* DBRHash< KT >::data_array [protected]
template<typename KT>
KT DBRHash< KT >::deletedKey [protected]

Definition at line 56 of file dbr_hash.h.

Referenced by DBRHash< int >::isDeletedSlot(), and DBRHash< int >::remove().

template<typename KT>
KT DBRHash< KT >::emptyKey [protected]

Definition at line 55 of file dbr_hash.h.

Referenced by DBRHash< int >::clear(), and DBRHash< int >::isEmptySlot().

pthread_mutex_t zmm::Object::mutex [protected, inherited]

The documentation for this class was generated from the following file:

Generated on Fri Mar 26 20:16:56 2010 for MediaTomb by  doxygen 1.6.1