// Copyright 1996 by Jon Dart.  All Rights Reserved.

#ifndef _GINFO_H
#define _GINFO_H

#include "hashable.h"
#include "move.h"
#include "pool.h"
#include <stddef.h>

class Game_Info : public Hashable
{
    // this class represents one entry in the hash table.

    public:

    Game_Info();

    Game_Info( const hash_t hashcode)
    : my_hashcode(hashcode)
    {
    }

    Game_Info &operator = (const Game_Info &p)
    {
        if (this != &p)
        {
           my_hashcode = p.my_hashcode;
        }
        return *this;
    }
           
    Game_Info( const Game_Info &p)
      : my_hashcode(p.my_hashcode)
    {
    }
    
    void *operator new (size_t size)
    {
	return allocator.allocate(size);
    }
    
    void *operator new (size_t, void *p)
    {
	return p;    
    }

    void operator delete( void *p )
    {
	allocator.free(p);    
    }
    
    static void freeAll( BOOL final )
    {
	allocator.freeAll(final);
    }

    // methods of class Hashable

    BOOL is_equal( const Hashable &c) const
    {
        Game_Info *p = (Game_Info*)&c;
        return (my_hashcode == p->my_hashcode);
    }
    
    hash_t hash_code() const
    {
        return my_hashcode;
    }

    private:

    hash_t my_hashcode;
    static Pool allocator;
};

//unsigned long hash_code(const Game_Info &p);

#endif
