Hosted by
|
package body String_Hash_Tables is
procedure Put
(This : in out Hash_Table_Access;
Key : in String;
Item : in Item_Type)
is
Pair : Inner_Tables.Pair_Access := new Inner_Tables.Pair;
begin
To_String_Access(Key, Pair.Key);
Pair.Item := Item;
Inner_Tables.Put(This, Pair);
end Put;
pragma Inline(Put);
procedure Get
(This : access Hash_Table;
Key : in String;
Item : out Item_Type;
Found : out Boolean)
is
Index : Positive;
begin
Get_Index(This, Key, Index, Found);
if not Found then return; end if;
Item := Get_Item(This, Index);
end Get;
pragma Inline(Get);
function Get
(This : access Hash_Table;
Key : in String)
return Item_Type is
begin
return Get_Item(This, Get_Index(This, Key));
end Get;
pragma Inline(Get);
procedure Get_Index
(This : access Hash_Table;
Key : in String;
Index : out Positive;
Found : out Boolean)
is
Temp : String_Access;
begin
To_String_Access(Key, Temp);
Inner_Tables.Get_Index(This, Temp, Index, Found);
Free(Temp);
end Get_Index;
pragma Inline(Get_Index);
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);
end String_Hash_Tables;
|