diff options
Diffstat (limited to 'utils')
-rw-r--r-- | utils/HashTable.h | 17 |
1 files changed, 12 insertions, 5 deletions
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 ITEM> class CcuHashCellRefOf : public CcuHashCellRef { -friend class CcuHashTableOf<ITEM>; -friend class CcuDictionnaryOf<ITEM>; -protected: +public: inline CcuHashCellRefOf (const CcuHashTableOf<ITEM>& t, const void* key) : CcuHashCellRef (t, key) {} #ifdef CPLUS_BUG1 inline CcuHashCellRefOf (const CcuHashCellRefOf<ITEM>& 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<ITEM>& () const { return *(const CcuHashTa inline CcuHashCellRefOf<ITEM> operator [] (const char* key) const { return CcuHashCellRefOf<ITEM> (*(const CcuHashTableOf<ITEM>*)this, key); } }; +template <class ITEM> class CcuHashedArrayOf : public CcuHashTable { +public: +inline CcuHashedArrayOf (unsigned int size, HASH_F hash = 0) : CcuHashTable (size, hash) {} +inline ~CcuHashedArrayOf () {} +inline CcuHashCellOf<ITEM>* Add (int key, int* found = 0) { return (CcuHashCellOf<ITEM>*) CcuHashTable::Add ((void*)key, found); } +inline CcuHashCellOf<ITEM>* Get (int key) { return (CcuHashCellOf<ITEM>*) CcuHashTable::Get ((void*)key); } +inline ITEM* Remove (int key, int* found = 0) { return (ITEM*) CcuHashTable::Remove ((void*) key, found); } +inline operator const CcuHashTableOf<ITEM>& () const { return *(const CcuHashTableOf<ITEM>*) this; } +inline CcuHashCellRefOf<ITEM> operator [] (int key) const { return CcuHashCellRefOf<ITEM> (*(const CcuHashTableOf<ITEM>*)this, (void*)key); } +}; template <class ITEM> class CcuHashIterOf : public CcuHashIter { public: |