------------------------------------------------------------------------------
--                                                                          --
--                   AI-302 Reference Implementation                        --
--                                                                          --
--              Copyright (C) 2003-2004 Matthew J Heaney                    --
--                                                                          --
-- The AI-302 Reference Implementation ("AI-302") is free software; you can --
-- redistribute it and/or modify it under terms of the GNU General Public   --
-- License as published by the Free Software Foundation; either version 2,  --
-- or (at your option) any later version.  AI-302 is distributed in the     --
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even the  --
-- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- See the GNU General Public License for more details.  You should have    --
-- received a copy of the GNU General Public License distributed with       --
-- AI-302;  see file COPYING.TXT.  If not, write to the Free Software       --
-- Foundation,  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.    --
--                                                                          --
-- As a special exception, if other files instantiate generics from this    --
-- unit, or you link this unit with other files to produce an executable,   --
-- this unit does not by itself cause the resulting executable to be        --
-- covered by the GNU General Public License.  This exception does not      --
-- however invalidate any other reasons why the executable file might be    --
-- covered by the GNU Public License.                                       --
--                                                                          --
-- The AI-302 Reference Implementation is maintained by Matthew J Heaney.   --
--                                                                          --
-- mailto:matthewjheaney@earthlink.net                                      --
-- http://home.earthlink.net/~matthewjheaney/index.html                     --
-- http://charles.tigris.org/                                               --
--                                                                          --
------------------------------------------------------------------------------

with Ada.Streams;

generic

   with package HT_Types is
     new Generic_Hash_Table_Types (<>);

   use HT_Types;

   with function Hash_Node (Node : Node_Access) return Hash_Type;

   with function Next (Node : Node_Access) return Node_Access;

   with procedure Set_Next
     (Node : Node_Access;
      Next : Node_Access);

    with function Copy_Node (Source : Node_Access) return Node_Access;

   with procedure Free (X : in out Node_Access);

package Ada.Containers.Hash_Tables.Generic_Operations is
   pragma Preelaborate;

   procedure Free_Hash_Table (Buckets : in out Buckets_Access);

   function Index
     (Buckets : Buckets_Type;
      Node    : Node_Access) return Hash_Type;
   pragma Inline (Index);

   function Index
     (Hash_Table : Hash_Table_Type;
      Node       : Node_Access) return Hash_Type;
   pragma Inline (Index);


   procedure Adjust (HT : in out Hash_Table_Type);

   procedure Finalize (HT : in out Hash_Table_Type);


   generic
      with function Find
        (HT  : Hash_Table_Type;
         Key : Node_Access) return Boolean;
   function Generic_Equal
     (L, R : Hash_Table_Type) return Boolean;


   procedure Clear (HT : in out Hash_Table_Type);


   procedure Move (Target, Source : in out Hash_Table_Type);


   function Capacity (HT : Hash_Table_Type)
      return Count_Type;

   procedure Reserve_Capacity
     (HT : in out Hash_Table_Type;
      N  : in     Count_Type);


   procedure Delete_Node_Sans_Free
     (HT : in out Hash_Table_Type;
      X  : in     Node_Access);


   function First (HT : Hash_Table_Type)
     return Node_Access;


   function Next (HT   : Hash_Table_Type;
                  Node : Node_Access)
     return Node_Access;


   generic
      with procedure Process (Node : in Node_Access);
   procedure Generic_Iteration (HT : in Hash_Table_Type);


   generic
      use Ada.Streams;
      with procedure Write
        (Stream : access Root_Stream_Type'Class;
         Node   : in     Node_Access);
   procedure Generic_Write
     (Stream : access Root_Stream_Type'Class;
      HT     : in     Hash_Table_Type);


   generic
      use Ada.Streams;
      with function New_Node (Stream : access Root_Stream_Type'Class)
         return Node_Access;
   procedure Generic_Read
     (Stream : access Root_Stream_Type'Class;
      HT     :    out Hash_Table_Type);



end Ada.Containers.Hash_Tables.Generic_Operations;


