Generic package: Ada.Containers.Indefinite_Doubly_Linked_Lists

Dependencies

with Ada.Finalization;
with Ada.Streams;

Description

AI-302 Reference Implementation

Copyright (C) 2003-2004 Matthew J Heaney

The AI-302 Reference Implementation is free software; you can redistribute it and/or modify it under terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. Charles is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License distributed with Charles; see file COPYING.TXT. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

As a special exception, if other files instantiate generics from this unit, or you link this unit with other files to produce an executable, this unit does not by itself cause the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU Public License.

The AI-302 Reference Implementation is maintained by Matthew J Heaney.

mailto:matthewjheaney@earthlink.net http://home.earthlink.net/~matthewjheaney/index.html http://charles.tigris.org/


Header

generic

   type Element_Type (<>) is private;

   with function "=" (Left, Right : Element_Type)
      return Boolean is <>;

package Ada.Containers.Indefinite_Doubly_Linked_Lists is
 
pragma Preelaborate (Indefinite_Doubly_Linked_Lists);

Type Summary

Cursor
Primitive Operations:  Delete, Element, Find, First, Has_Element, Insert, Insert, Last, Next, Next, Previous, Previous, Replace_Element, Reverse_Find, Splice, Splice, Splice, Swap, Update_Element
Iterate_Process
List
Primitive Operations:  "=", Append, Clear, Delete, Delete_First, Delete_Last, Find, First, First_Element, Insert, Insert, Is_Empty, Is_In, Iterate, Last, Last_Element, Length, Move, Prepend, Reverse_Find, Reverse_Iterate, Reverse_List, Splice, Splice, Splice, Swap
Reverse_Iterate_Process derived from Iterate_Process
Update_Element_Process

Constants and Named Numbers

Empty_List : constant List;
No_Element : constant Cursor;

Other Items:

type List is tagged private;

type Cursor is private;

function "=" (Left, Right : List) return Boolean;

function Length (Container : List) return Count_Type;

function Is_Empty (Container : List) return Boolean;

procedure Clear (Container : in out List);

function Element (Position : Cursor)
   return Element_Type;

type Update_Element_Process is
   access procedure (Element : in out Element_Type);

procedure Update_Element
  (Position : in Cursor;
   Process  : Update_Element_Process);
Ada0Y not null access procedure (Element : in out Element_Type));

The best we can do in Ada95 is to generate a run-time error, so if Process is null a Program_Error is raised.


procedure Replace_Element (Position : in Cursor;
                           By       : in Element_Type);

procedure Move (Target : in out List;
                Source : in out List);

procedure Prepend (Container : in out List;
                   New_Item  : in     Element_Type;
                   Count     : in     Count_Type := 1);

procedure Append (Container : in out List;
                  New_Item  : in     Element_Type;
                  Count     : in     Count_Type := 1);

procedure Insert (Container : in out List;
                  Before    : in     Cursor;
                  New_Item  : in     Element_Type;
                  Count     : in     Count_Type := 1);

procedure Insert (Container : in out List;
                  Before    : in     Cursor;
                  New_Item  : in     Element_Type;
                  Position  :    out Cursor;
                  Count     : in     Count_Type := 1);

procedure Delete (Container : in out List;
                  Position  : in out Cursor;
                  Count     : in     Count_Type := 1);

procedure Delete_First (Container : in out List;
                        Count     : in     Count_Type := 1);

procedure Delete_Last (Container : in out List;
                       Count     : in     Count_Type := 1);

generic
   with function "<" (Left, Right : Element_Type)
      return Boolean is <>;
procedure Generic_Sort (Container : in out List);

generic
   with function "<" (Left, Right : Element_Type)
      return Boolean is <>;
procedure Generic_Merge (Target : in out List;
                         Source : in out List);

procedure Reverse_List (Container : in out List);

procedure Swap (Container : in List;
                I, J      : in Cursor);

procedure Splice (Target : in out List;
                  Before : in     Cursor;
                  Source : in out List);

procedure Splice (Target   : in out List;
                  Before   : in     Cursor;
                  Position : in     Cursor);

procedure Splice (Target   : in out List;
                  Before   : in     Cursor;
                  Source   : in out List;
                  Position : in     Cursor);

function First (Container : List) return Cursor;

function First_Element (Container : List) return Element_Type;

function Last (Container : List) return Cursor;

function Last_Element (Container : List) return Element_Type;

function Is_In (Item      : Element_Type;
                Container : List)
  return Boolean;

function Find (Container : List;
               Item      : Element_Type;
               Position  : Cursor := No_Element)
  return Cursor;

function Reverse_Find (Container : List;
                       Item      : Element_Type;
                       Position  : Cursor := No_Element)
  return Cursor;

function Next (Position : Cursor) return Cursor;

function Previous (Position : Cursor) return Cursor;

procedure Next (Position : in out Cursor);

procedure Previous (Position : in out Cursor);

function Has_Element (Position : Cursor) return Boolean;

type Iterate_Process is
   access procedure (Position : in Cursor);

procedure Iterate
  (Container : in List;
   Process   :    Iterate_Process);
Ada0Y not null access procedure (Position : in Cursor));

The best we can do in Ada95 is to generate a run-time error, so if Process is null a Program_Error is raised.


type Reverse_Iterate_Process is
   new Iterate_Process;

procedure Reverse_Iterate
  (Container : in List;
   Process   :    Reverse_Iterate_Process);
Ada0Y not null access procedure (Position : in Cursor));

The best we can do in Ada95 is to generate a run-time error, so if Process is null a Program_Error is raised.


private

   --  Implementation-defined ...
end Ada.Containers.Indefinite_Doubly_Linked_Lists;