Generic package: Ahven.SList

Dependencies

with Ada.Finalization;

Description

Copyright (c) 2008-2009 Tero Koskinen <tero.koskinen@iki.fi>

Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


Header

generic
   type Element_Type is private;
package Ahven.SList is
 

Exceptions

Invalid_Cursor

Type Summary

Cursor
Primitive Operations:  Data, First, Is_Valid, Next
List derived from Controlled
New Operations:  Append, First, Length, Remove_All
Inherited Operations:  Adjust, Finalize, Initialize

Constants and Named Numbers

Empty_List : constant List;

Other Items:

type List is new Ada.Finalization.Controlled with private;

type Cursor is private;

subtype Count_Type is Natural;

procedure Append (Target : in out List; Node_Data : Element_Type);
Append an element at the end of the list.

procedure Remove_All (Target : in out List);
Remove all elements from the list.

function First (Target : List) return Cursor;
Return a cursor to the first element of the list.

function Next (Position : Cursor) return Cursor;
Move the cursor to point to the next element on the list.

function Data (Position : Cursor) return Element_Type;
Return element pointed by the cursor.

function Is_Valid (Position : Cursor) return Boolean;

function Length (Target : List) return Count_Type;

private

   --  Implementation-defined ...
end Ahven.SList;