summaryrefslogtreecommitdiff
path: root/utils/HashTable.h
diff options
context:
space:
mode:
authorchatty2000-11-28 14:19:33 +0000
committerchatty2000-11-28 14:19:33 +0000
commit7c46d309b87819162c450bb757a4b10aaa4471dc (patch)
tree5b1dc555dd2d3c6ab611534a63bcea1aed04e003 /utils/HashTable.h
parentf498bba5c7191d62776a2ed91497afa611849030 (diff)
downloadivy-league-7c46d309b87819162c450bb757a4b10aaa4471dc.zip
ivy-league-7c46d309b87819162c450bb757a4b10aaa4471dc.tar.gz
ivy-league-7c46d309b87819162c450bb757a4b10aaa4471dc.tar.bz2
ivy-league-7c46d309b87819162c450bb757a4b10aaa4471dc.tar.xz
Added HashedArray
Diffstat (limited to 'utils/HashTable.h')
-rw-r--r--utils/HashTable.h17
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: