home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 November
/
VPR9611B.ISO
/
vabasic
/
ntclnt.exe
/
DISK8
/
data.8
/
datab
/
INCLUDE
/
IHASH.HH
< prev
next >
Wrap
Text File
|
1996-07-29
|
3KB
|
81 lines
/*------------------------------------------------------------------------
* $Source: /rcs/crcs/general/ihash.hh,v $
* $Date: 1995/11/10 23:55:16 $ $Revision: 1.7 $
*
* Copyright 1990, Visual Edge Software Ltd.
* -----------------------------------------
* ALL RIGHTS RESERVED. This notice is intended as a precaution against
* inadvertent publication, and shall not be deemed to constitute an
* acknowledgment that publication has occurred nor to imply any waiver
* of confidentiality. The year included in the notice is the year
* of the creation of the work.
*------------------------------------------------------------------------
* Class VeIHashTable: Integer-keyed hash table <ItemT>
*------------------------------------------------------------------------*/
#ifndef VIHash_HH
#define VIHash_HH
/*------------------------------------------------------------------------
* You can define a VeIHashTable over any pointer type.
* This template class defines a thin typed-access layer over
* VeIPHashTable. No template repository code should be needed.
*-----------------------------------------------------------------------*/
#include <visedge.hh>
#include <ptrarray.hh>
#include <iptrhash.hh>
#ifndef NOTEMPLATES
template<class ItemT>
class VeIHashTable : public VeIPHashTable
{
public:
VeIHashTable () {}
VeIHashTable (int hashsize) : VeIPHashTable(hashsize) {}
VeIHashTable (const VeIPHashTable& other) : VeIPHashTable(other) {}
~VeIHashTable() {}
/*--------------------------------------------------
* Explicit insertion of entries.
*--------------------------------------------------*/
ItemT& PutAt (VIHashKey k, ItemT i) { return (ItemT&)
VeIPHashTable::PutAt(k,(PVoid) i);}
/*--------------------------------------------------
* Extraction of entries - adding unfound ones!
*--------------------------------------------------*/
ItemT& Get (VIHashKey k) { return (ItemT&) VeIPHashTable::Get(k); }
ItemT& operator[] (VIHashKey k) { return Get(k); }
ItemT FindElement (int &i, PVoid &aCell, VIHashKey *aKey = 0) { return (ItemT) VeIPHashTable::FindElement(i, aCell, aKey); }
/*--------------------------------------------------
* Extraction of entries - (without adding new ones)
*--------------------------------------------------*/
ItemT Query(VIHashKey k) { return (ItemT) VeIPHashTable::Query(k); }
bool_t Query(VIHashKey k, ItemT &item)
{
bool_t found;
PVoid pvitem;
found = VeIPHashTable::Query(k, pvitem);
item = (ItemT)pvitem;
return found;
}
/*--------------------------------------------------
* Shrinking. Remove() returns the removed element.
*--------------------------------------------------*/
ItemT Remove (VIHashKey k) { return (ItemT) VeIPHashTable::Remove(k); }
};
#endif // NOTEMPLATES
#endif