+#include "types.h"
+
+/// A simple fixed size hash table used to store pawns and material
+/// configurations. It is basically just an array of Entry objects.
+/// Without cluster concept or overwrite policy.
+
+template<class Entry, int HashSize>
+class SimpleHash {
+
+ SimpleHash(const SimpleHash&);
+ SimpleHash& operator=(const SimpleHash&);
+
+public:
+ SimpleHash() {
+
+ entries = new (std::nothrow) Entry[HashSize];
+ if (!entries)
+ {
+ std::cerr << "Failed to allocate " << HashSize * sizeof(Entry)
+ << " bytes for material hash table." << std::endl;
+ exit(EXIT_FAILURE);
+ }
+ memset(entries, 0, HashSize * sizeof(Entry));
+ }
+
+ virtual ~SimpleHash() { delete [] entries; }