comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <mheaney@on2.com>
Subject: Re: Declaration of private type Containers
Date: Fri, 30 May 2008 13:27:49 -0700 (PDT)
Date: 2008-05-30T13:27:49-07:00	[thread overview]
Message-ID: <d3cb1d56-43f9-4c28-abdd-3d2a52d7b0b6@e39g2000hsf.googlegroups.com> (raw)
In-Reply-To: 6d6feee1-fe69-4d19-9745-4748d341a56e@r66g2000hsg.googlegroups.com

On May 30, 7:49 am, alexander.kle...@web.de wrote:
> The only thing I want to do is to  declare a list package, whose
> Element_Type is of a private record type:
>
> package A is
>
> type My_Type is private
>
> package My_Type_Lists is new Ada.Containers.Doubly_Linked_List
>      (Element_Type      => My_Type);
>
> private
>
> type My_Type is
> record
> ...
> end record;
>
> end A;

It's unlikely you need all of the features supported by the standard
linked list container.  If so, one alternative for you would be to
create a more high level container:

package A is
  type T is private;

  type Container is tagged limited private;

  procedure Insert
   (C : in out Container;
    Obj : T);

  procedure Remove
    (C : in out Container;
     Obj : T);

  procedure Iterate
    (C : Container;
     P : not null access procedure (Obj : T));

private
   type T is ...;

   package T_Lists is new Ada.C.DLLists (T);

   type Container is tagged limited record
     L : T_Lists.List;
   end Container;

end A;




  parent reply	other threads:[~2008-05-30 20:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 11:49 Declaration of private type Containers alexander.kleppe
2008-05-30 12:05 ` Dmitry A. Kazakov
2008-05-30 12:21 ` Jean-Pierre Rosen
2008-05-30 13:59   ` alexander.kleppe
2008-05-30 14:25     ` Jean-Pierre Rosen
2008-05-30 16:00     ` Adam Beneschan
2008-05-31  2:04     ` Steve
2008-05-31  5:28   ` Randy Brukardt
2008-05-30 20:27 ` Matthew Heaney [this message]
2008-06-04 15:40   ` alexander.kleppe
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox