Unicorn XML Toolkit
Version 1.50.00

Namespace Core
Class XHashTable

template<class TYPE> class XHashTable {
public:
    XHashTable(int nSize);
    XHashTable(const XHashTable &source);
    ~XHashTable();
public:
    int GetCount();
    TYPE *Enter(const WCHAR *pszKey);
    TYPE *Find(const WCHAR *pszKey);
    void Remove(const WCHAR *pszKey);
    };

The simple hash table template.

Since:
1.50.00
Version:
1.50.00
Author:
Alexey Gokhberg
Constructor/Destructor Summary
XHashTable (int nSize);
����������Constructs the empty hash table with the given initial size.
XHashTable (const XHashTable &source);
����������Constructs the hash table copying all entries from the specified source hash table.
~XHashTable ();
����������Destroys the hash table.

Function Summary
int GetCount ();
����������Returns a number of keys in this hash table.
TYPE�* Enter (const WCHAR *pszKey);
����������Enters a new key in this hash table, returns pointer to a storage area allocated to keep corresponding data.
TYPE�* Find (const WCHAR *pszKey);
����������Looks up the specified key in this hash table.
void Remove (const WCHAR *pszKey);
����������Removes the specified key from this hash table.

Constructor/Destructor Detail

XHashTable

XHashTable(int nSize);

Constructs the empty hash table with the given initial size.

Parameters:
nSize - the initial table size

XHashTable

XHashTable(const XHashTable &source);

Constructs the hash table copying all entries from the specified source hash table.

Parameters:
source - the hash table to copy

~XHashTable

~XHashTable();

Destroys the hash table.

Function Detail

GetCount

int GetCount();

Returns a number of keys in this hash table.

Returns:
the number of keys in this hash table

Enter

TYPE *Enter(const WCHAR *pszKey);

Enters a new key in this hash table, returns pointer to a storage area allocated to keep corresponding data.

If the specified key is already present in this hash table, no changes is made and the pointer to the previously allocated storage is returned; otherwise the specified key is added to the hash table and the new data storage area is allocated.

Parameters:
pszKey - the key
Returns:
the pointer to a storage area allocated to keep data corresponding to the given key

Find

TYPE *Find(const WCHAR *pszKey);

Looks up the specified key in this hash table.

Parameters:
pszKey - the key to look up
Returns:
the pointer to the storage area allocated to keep data correesponding to the given key; NULL if the key is not found in this hash table

Remove

void Remove(const WCHAR *pszKey);

Removes the specified key from this hash table.

The function has no effect is the specified key is not found in this hash table.

Parameters:
pszKey - the key to remove

Unicorn XML Toolkit
Version 1.50.00


This document was created using Unicorn DOC++.

Copyright 1999-2001 Unicorn Enterprises SA.
All Rights Reserved.