Download Source Code

CHList Class Reference

Hashed linked list. More...

#include <HList.h>

Inheritance diagram for CHList:

Inheritance graph
[legend]
Collaboration diagram for CHList:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual const void * SetKey (void *ptr, const void *pKey, DWORD dwKeySize=0)
 Sets the key on a linked list element.
virtual void DeleteAllItems ()
 Removes all elements from the list.
BOOL RemoveHash (LPLLISTINFO plli)
 Removes the hash for the specified element from the hash table.
void * Find (DWORD dwKey)
 Finds an element in the list by its hash value.
void * Find (LPCTSTR pKey)
 Finds an element in a list by hashing a string value.
virtual void * Find (const void *pKey, DWORD dwKey=0)
 Finds an element in the list by hashing a binary buffer.
BOOL AddHash (LPLLISTINFO plli)
 Adds a hash for a list element to the hash table.
void ReleaseHashList ()
 Deletes the entire hash table.
BOOL Create (DWORD size=8)
 Creates an initial hash table.
virtual void Destroy ()
 Releases the hash table and all list elements.
virtual BOOL InitObject (void *node)
 Initializes a single list element and adds to hash table.
virtual void DeleteObject (void *node)
 Deletes a single list element and removes from hash table.
 CHList ()
 Constructor.
virtual ~CHList ()
 Destructor.
DWORD GetHash (LPLLISTINFO plli)
 Calculates the hash value of a list element.
DWORD GetHash (const void *buf, DWORD size)
 Calculates the hash value of a binary buffer.
DWORD GetHash (DWORD dw)
 Gets the hash value of a DWORD value.

Static Public Member Functions

static DWORD Crc32 (DWORD crc, LPVOID vbuf, DWORD size)
 Calculates a 32-bit CRC that is used as a hash.

Static Public Attributes

static DWORD crc_table [256]
 Static CRC table.

Detailed Description

Hashed linked list.

This class encapsulates a hashed linked list. Though used extensively in this library, this class is very old. I suggest you use ATL7 classes if available.


Member Function Documentation

BOOL CHList::AddHash LPLLISTINFO  plli  ) 
 

Adds a hash for a list element to the hash table.

Parameters:
[in] plli - Pointer to a list element
Returns:
Non-zero if success
See also:

DWORD CHList::Crc32 DWORD  crc,
LPVOID  vbuf,
DWORD  size
[static]
 

Calculates a 32-bit CRC that is used as a hash.

Parameters:
[in] crc - Initial CRC value
[in] vbuf - Buffer to hash
[in] size - Number of bytes in vbuf
Returns:
Updated CRC value
See also:

BOOL CHList::Create DWORD  size = 8  ) 
 

Creates an initial hash table.

Parameters:
[in] size - Initial size of hash table
Returns:
Non-zero if success
See also:

void CHList::DeleteObject void *  node  )  [virtual]
 

Deletes a single list element and removes from hash table.

Parameters:
[in] node - Pointer to list element

Reimplemented from CLList.

Reimplemented in CReg, CRKey, THList< H, T >, TStrList< T >, TLList< T >, THList< DWORD, CStack >, THList< GUID, THList< DWORD, THList< GUID, CTimeout > > >, THList< GUID, CNetCom >, THList< GUID, CCallbackTarget >, THList< GUID, CMsgTarget >, and TLList< CFrame >.

void * CHList::Find const void *  pKey,
DWORD  dwKey = 0
[virtual]
 

Finds an element in the list by hashing a binary buffer.

Parameters:
[in] pKey - Pointer to key data
[in] dwKey - Number of bytes in pKey
Returns:
Pointer to list element if found, otherwise NULL
See also:

Reimplemented from CLList.

void* CHList::Find LPCTSTR  pKey  )  [inline]
 

Finds an element in a list by hashing a string value.

Parameters:
[in] pKey - String to hash
Returns:
Pointer to list element if found, otherwise NULL
See also:

void* CHList::Find DWORD  dwKey  )  [inline, virtual]
 

Finds an element in the list by its hash value.

Parameters:
[in] dwKey - Hash
Returns:
Pointer to list element if found, otherwise NULL
See also:

Reimplemented from CLList.

DWORD CHList::GetHash DWORD  dw  )  [inline]
 

Gets the hash value of a DWORD value.

Parameters:
[in] dw - DWORD value
Returns:
Hash value
See also:

DWORD CHList::GetHash const void *  buf,
DWORD  size
[inline]
 

Calculates the hash value of a binary buffer.

Parameters:
[in] buf - Buffer pointer
[in] size - Number of bytes in buf
Returns:
Hash value
See also:

DWORD CHList::GetHash LPLLISTINFO  plli  )  [inline]
 

Calculates the hash value of a list element.

Parameters:
[in] plli - Pointer to a list element
Returns:
List element hash
See also:

BOOL CHList::InitObject void *  node  )  [virtual]
 

Initializes a single list element and adds to hash table.

Parameters:
[in] node - Pointer to list element
Returns:
Non-zero if success
See also:

Reimplemented from CLList.

Reimplemented in CReg, THList< H, T >, TStrList< T >, TLList< T >, THList< DWORD, CStack >, THList< GUID, THList< DWORD, THList< GUID, CTimeout > > >, THList< GUID, CNetCom >, THList< GUID, CCallbackTarget >, THList< GUID, CMsgTarget >, and TLList< CFrame >.

void CHList::ReleaseHashList  ) 
 

Deletes the entire hash table.

Returns:
Non-zero if success
See also:

BOOL CHList::RemoveHash LPLLISTINFO  plli  ) 
 

Removes the hash for the specified element from the hash table.

Parameters:
[in] plli - Linked list element
Returns:
Non-zero if success
See also:

const void * CHList::SetKey void *  ptr,
const void *  pKey,
DWORD  dwKeySize = 0
[virtual]
 

Sets the key on a linked list element.

Parameters:
[in] ptr - Pointer to linked list element
[in] pKey - Buffer containing the key
[in] dwKeySize - Size of buffer in pKey
Returns:
Pointer to linked list element
See also:

Reimplemented from CLList.


The documentation for this class was generated from the following files:
  • inc/HList.h
  • HList.cpp
Copyright Robert Umbehant
This documentation is covered by the LGPL