Hosted by
|
with Ada.Text_IO;
with Primes; use Primes;
with Messages; use Messages;
package body String_String_Hash_Tables is
procedure Put
(This : in out Hash_Table_Access;
Key : in String;
Item : in String)
is
Pair : Inner_Tables.Pair_Access := new Inner_Tables.Pair;
begin
To_String_Access(Key, Pair.Key);
To_String_Access(Item, Pair.Item);
Inner_Tables.Put(This, Pair);
end Put;
pragma Inline(Put);
function Get
(This : access Hash_Table;
Key : in String)
return String is
begin
return Get_Item(This, Get_Index(This, Key));
end Get;
pragma Inline(Get);
function Get_Index
(This : access Hash_Table;
Key : in String)
return Positive
is
Temp : String_Access;
Index : Positive;
begin
To_String_Access(Key, Temp);
Index := Inner_Tables.Get_Index(This, Temp);
Free(Temp);
return Index;
end Get_Index;
pragma Inline(Get_Index);
function Get_Key
(This : access Hash_Table;
Index : in Positive)
return String is
begin
return To_String(Inner_Tables.Get_Key(This, Index));
end Get_Key;
pragma Inline(Get_Key);
function Get_Item
(This : access Hash_Table;
Index : in Positive)
return String is
begin
return To_String(Inner_Tables.Get_Item(This, Index));
end Get_Item;
pragma Inline(Get_Key);
end String_String_Hash_Tables;
|