API Reference

type Handle , procedure Clear

  
   type Handle is limited private; -- Initial value: empty.  
  
   procedure Clear (Queue : in out Handle);  

Makes Queue empty.

Time: O(N).

procedure Assign

   procedure Assign (To : out Handle; From : in Handle);   

Makes To a copy of From.

May raise Storage_Exhausted.

The state of To is unknown if Storage_Exhausted is raised.

procedure Put

   procedure Put (Onto : in out Handle; Item : in Element);   

raise Storage_Exhausted.

Adds Item to the tail of Onto.

Raises Storage_Exhausted if no more storage is available for Onto. Nothing is changed if Storage_Exhausted is raised.

Time: O(1).

procedure Get

   procedure Get (From : in out Handle; Item : in out Element); -- raise Empty.   

Removes the Element at the head of From and assigns it to Item. Raises Empty if From is empty.

Time: O(1).

Precondition: not Is_Empty (From) raise Empty if violated.

function Length

   function Length (Queue : Handle) return Natural;   

Returns a count of the number of Elements in Queue.

function Is_Empty

   function Is_Empty (Queue : Handle) return Boolean;   

Returns True if Queue is empty; False otherwise.

function Peek

   function Peek (Queue : Handle) return Element;   

Return the Element at the head of Queue without altering Queue. Raises Empty if Queue is empty.

Time: O(1).

type Context_Data (<>) , with procedure Action , procedure Iterate

   generic -- Iterate   
      type Context_Data (<>) is limited private;  
  
      with procedure Action (Item     : in out Element;  
                             Context  : in out Context_Data;  
                             Continue :    out Boolean);  
   procedure Iterate (Over : in out Handle; Context : in out Context_Data);  

Calls Action with each Element in Over in turn, from head to tail. Returns immediately if Continue is set to False (remainder of Over is not processed).