Generic package: Ada.Containers.Indefinite_Hashed_Maps

Dependencies

with Ada.Containers.Hash_Tables;
with Ada.Streams;

Description

AI-302 Reference Implementation

Copyright (C) 2003-2004 Matthew J Heaney

The AI-302 Reference Implementation 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


Header

generic

   type Key_Type (<>) is private;

   type Element_Type (<>) is private;

   with function Hash (Key : Key_Type)
      return Hash_Type is <>;

   with function Is_Equal_Key (Left, Right : Key_Type)
      return Boolean is "=";

   with function "=" (Left, Right : Element_Type)
      return Boolean is <>;

package Ada.Containers.Indefinite_Hashed_Maps is
 
pragma Preelaborate (Indefinite_Hashed_Maps);
For description, See Ada.Containers.Hashed_Maps

Type Summary

Cursor
Primitive Operations:  Delete, Element, Find, First, Has_Element, Insert, Is_Equal_Key, Is_Equal_Key, Is_Equal_Key, Key, Next, Next, Replace_Element, Update_Element
Iterate_Process
Map
Primitive Operations:  "=", Capacity, Clear, Delete, Delete, Element, Find, First, Insert, Is_Empty, Is_In, Iterate, Length, Move, Replace, Set_Capacity
Update_Element_Process

Constants and Named Numbers

Empty_Map : constant Map;
No_Element : constant Cursor;

Other Items:

type Map is tagged private;

type Cursor is private;

function "=" (Left, Right : Map) return Boolean;

function Length (Container : Map) return Count_Type;

function Is_Empty (Container : Map) return Boolean;

procedure Clear (Container : in out Map);

function Element (Position : Cursor)
  return Element_Type;

type Update_Element_Process is
   access procedure (Element : in out Element_Type);

procedure Update_Element
  (Position : in Cursor;
   Process  :    Update_Element_Process);
Ada0Y not null access procedure (Element : in out Element_Type));

The best we can do in Ada95 is to generate a run-time error, so if Process is null a Program_Error is raised.


procedure Replace_Element (Position : in Cursor;
                           By       : in Element_Type);

procedure Move (Target : in out Map;
                Source : in out Map);

procedure Insert (Container : in out Map;
                  Key       : in     Key_Type;
                  New_Item  : in     Element_Type;
                  Position  :    out Cursor;
                  Success   :    out Boolean);

procedure Replace (Container : in out Map;
                   Key       : in     Key_Type;
                   New_Item  : in     Element_Type);

procedure Delete (Container : in out Map;
                  Key       : in     Key_Type);

procedure Delete (Container : in out Map;
                  Position  : in out Cursor);

function Is_In (Key       : Key_Type;
                Container : Map)
   return Boolean;

function Find (Container : Map;
               Key       : Key_Type)
   return Cursor;

function Element (Container : Map;
                  Key       : Key_Type)
  return Element_Type;

function Capacity (Container : Map) return Count_Type;

procedure Set_Capacity (Container : in out Map;
                        Capacity  : in     Count_Type);

function First (Container : Map) return Cursor;

function Next (Position : Cursor) return Cursor;

procedure Next (Position : in out Cursor);

function Has_Element (Position : Cursor) return Boolean;

function Key (Position : Cursor) return Key_Type;

function Is_Equal_Key (Left, Right : Cursor)
  return Boolean;

function Is_Equal_Key (Left  : Cursor;
                       Right : Key_Type)
  return Boolean;

function Is_Equal_Key (Left  : Key_Type;
                       Right : Cursor)
  return Boolean;

type Iterate_Process is
   access procedure (Position : in Cursor);

procedure Iterate
  (Container : in Map;
   Process   :    Iterate_Process);
Ada0Y not null access procedure (Position : in Cursor));

The best we can do in Ada95 is to generate a run-time error, so if Process is null a Program_Error is raised.


private

   --  Implementation-defined ...
end Ada.Containers.Indefinite_Hashed_Maps;