simple.cc - generated code example
[prop.git] / prop-src / functortab.h
blob41bbf61598ca1a60a001e33123f0bdedf5b9ab8b
1 ///////////////////////////////////////////////////////////////////////////////
2 // A very simple hash table class.
3 ///////////////////////////////////////////////////////////////////////////////
4 #ifndef functor_hash_table_h
5 #define functor_hash_table_h
7 #include "hashtab.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
14 public:
15 typedef TreeGrammar::Functor Functor;
17 public:
19 ////////////////////////////////////////////////////////////////////////////
20 // Constructor and destructor
21 ////////////////////////////////////////////////////////////////////////////
22 FunctorTable(HashFunction, Equality, int = 32);
23 ~FunctorTable();
25 ////////////////////////////////////////////////////////////////////////////
26 // Operations.
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(); }
41 #endif