1 ///////////////////////////////////////////////////////////////////////////////
2 // A very simple hash table class.
3 ///////////////////////////////////////////////////////////////////////////////
4 #ifndef functor_hash_table_h
5 #define functor_hash_table_h
8 #include <AD/automata/treegram.h>
10 class FunctorTable
: public HashTable
{
11 FunctorTable(const FunctorTable
&); // no copy constructor
12 void operator = (const FunctorTable
&); // no assignment
15 typedef TreeGrammar::Functor Functor
;
19 ////////////////////////////////////////////////////////////////////////////
20 // Constructor and destructor
21 ////////////////////////////////////////////////////////////////////////////
22 FunctorTable(HashFunction
, Equality
, int = 32);
25 ////////////////////////////////////////////////////////////////////////////
27 ////////////////////////////////////////////////////////////////////////////
28 inline Functor
value(const Entry
* e
) const
29 { return (Functor
)(long)(e
->v
); }
30 Functor
operator [] (Key k
) const;
31 inline void insert (Key key
, Functor value
)
32 { HashTable::insert(key
,(Value
)((long)value
)); }
33 inline Bool
contains (Key k
) const { return HashTable::contains(k
); }
34 inline Entry
* lookup (Key k
) const { return HashTable::lookup(k
); }
35 inline Key
key (Entry
* e
) { return e
->k
; }
36 inline Entry
* first () { return HashTable::first(); }
37 inline Entry
* next (Entry
* e
) { return HashTable::next(e
); }
38 inline int size () const { return HashTable::size(); }