| User's Guide: A Framework for Object Persistency for GNAT; Version 0.6.1; Document Revision $Revision: 1.17 $ | ||
|---|---|---|
| Prev | Chapter 30. Util.Hash_Table | Next |
type Key_Type is private ;
procedure Put(
This : in out Table_Type;
Key : in Key_Type;
Value : out Natural );
Table_Full : exception; Key_Already_Used : exception; Key_Not_Existing : exception;
This method stores the key and the container element in the keyed container.
P.1 - Item /= null
P.2 - Number of stored keys < capacity.
P.3 - Key not already stored
C.1 - An additional key/value pair has been added to the
container.
Table_Full - P.2 violated
function Get(
This : in Table_Type;
Key : in Key_Type ) return Natural;
Retrieve a container element from the container.
P.1 - Key exisits in container
C.1 - Funtion yield handle to copy of the container element
Key_Not_Existing - P.1 violated
None
function Key(
This : in Table_Type;
Hash : in Natural ) return Key_Type;
Get the key associated with the hash code
P.1 - Hash code is used
C.1 - The yields key
Key_Not_Existing - P.1 violated
None
procedure Remove(
This : in out Table_Type;
Key : in Key_Type );
Remove a key from the container
P.1 - Key exists in container
C.1 - The container_element held by the container is deallocated
Key_Not_Existing - P.1 violated
procedure Clear(
This : in out Table_Type);
Clear the container
None
C.1 - All objects held by the container are destroyed. The
nbr of free entries = capacity.
None
None
function Is_Empty(
This : in Table_Type) return Boolean;
Check if empty
None
C.1 - return true if nbr_of_entries = 0
None
function Contains(
This : in Table_Type;
Key : in Key_Type ) return Boolean;
check if key or a element is in the container
None
C.1 - either true or false or the key handle.
None
Both procedures are not optimized for speed. In case of large tables this might be a real problem for the performance of your application code.
procedure Dictionary(
This : in Table_Type;
Keys : out Dictionary_Table;
Length : out Natural );
Dictionary_Overflow : exception;
Returns the list of all keys in the container
P.1 - The number of entries in the container is not larger then
the provided dictionary table
C.1 - length is set to the actual number of entries in the
dictionary.
Dictionary_Overflow - P.1 violated.
None