API Reference

type Handle (Max_Size : Positive)

  
   type Handle (Max_Size : Positive) is limited private;  

procedure Clear

   procedure Clear (Queue : in out Handle);   

Makes Queue empty.

Contents of Queue are lost. All queues are initially empty.

Time: O(1).

procedure Assign

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

Makes To a copy of From.

Raises Too_Short if To.Max_Size < Length (From). To is unchanged if Too_Short is Raised.

Time: O(N).

procedure Put

   procedure Put (Into : in out Handle; Item : in Element); -- raise Full.   

Adds Item to Into.

Raises Full if Into is already full. Into is unchanged if Full is raised.

Time: O(1).

Precondition: not Is_Full (Into) raise Full if violated.

procedure Get

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

Removes the next Element from From and puts it in Item. Raises Empty if From is empty.

From is unchanged if Empty is raised.

Contents of Item are undefined if Empty is raised.

Time: O(1).

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

function Is_Full

   function Is_Full (Queue : Handle) return Boolean;   

Returns True if Queue is full; False otherwise.

function Is_Empty

   function Is_Empty (Queue : Handle) return Boolean;   

Returns True if Queue is empty; False otherwise.

function Length

   function Length (Queue : Handle) return Natural;   

Returns the number of Elements in Queue.

function Peek

   function Peek (Queue : Handle) return Element;   

Returnss 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);  

Applies Action to each Element in Over, from head to tail. Iterate terminates immediately if Continue is set to False (remainder of Over is not processed).