From 7c46d309b87819162c450bb757a4b10aaa4471dc Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 28 Nov 2000 14:19:33 +0000 Subject: Added HashedArray --- utils/HashTable.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'utils/HashTable.h') diff --git a/utils/HashTable.h b/utils/HashTable.h index 92a70ce..6cfda82 100644 --- a/utils/HashTable.h +++ b/utils/HashTable.h @@ -3,7 +3,7 @@ * * by Stephane Chatty * - * Copyright 1991-1996 + * Copyright 1991-1997 * Laboratoire de Recherche en Informatique (LRI) * Centre d'Etudes de la Navigation Aerienne (CENA) * @@ -166,14 +166,11 @@ inline ITEM* GetInfo () const { return (ITEM*) CcuHashCell::GetInfo (); } }; template class CcuHashCellRefOf : public CcuHashCellRef { -friend class CcuHashTableOf; -friend class CcuDictionnaryOf; -protected: +public: inline CcuHashCellRefOf (const CcuHashTableOf& t, const void* key) : CcuHashCellRef (t, key) {} #ifdef CPLUS_BUG1 inline CcuHashCellRefOf (const CcuHashCellRefOf& t) : CcuHashCellRef (t) {} #endif -public: inline ITEM* operator = (ITEM* it) { return (ITEM*) (CcuHashCellRef::operator = (it)); } inline operator ITEM* () { return (ITEM*) (CcuHashCellRef::operator CcuHashItem* ()); } }; @@ -200,6 +197,16 @@ inline operator const CcuHashTableOf& () const { return *(const CcuHashTa inline CcuHashCellRefOf operator [] (const char* key) const { return CcuHashCellRefOf (*(const CcuHashTableOf*)this, key); } }; +template class CcuHashedArrayOf : public CcuHashTable { +public: +inline CcuHashedArrayOf (unsigned int size, HASH_F hash = 0) : CcuHashTable (size, hash) {} +inline ~CcuHashedArrayOf () {} +inline CcuHashCellOf* Add (int key, int* found = 0) { return (CcuHashCellOf*) CcuHashTable::Add ((void*)key, found); } +inline CcuHashCellOf* Get (int key) { return (CcuHashCellOf*) CcuHashTable::Get ((void*)key); } +inline ITEM* Remove (int key, int* found = 0) { return (ITEM*) CcuHashTable::Remove ((void*) key, found); } +inline operator const CcuHashTableOf& () const { return *(const CcuHashTableOf*) this; } +inline CcuHashCellRefOf operator [] (int key) const { return CcuHashCellRefOf (*(const CcuHashTableOf*)this, (void*)key); } +}; template class CcuHashIterOf : public CcuHashIter { public: -- cgit v1.1