From: Hacid <chadi.alkurdi@gmail.com>
Subject: Re: limited /non-limited tagged type
Date: Fri, 4 Mar 2011 13:55:26 -0800 (PST)
Date: 2011-03-04T13:55:26-08:00 [thread overview]
Message-ID: <9e7a23dd-883c-46fa-88a4-b0ce9aab529d@r4g2000vbq.googlegroups.com> (raw)
In-Reply-To: 4d714736$0$6979$9b4e6d93@newsspool4.arcor-online.net
On 4 mar, 21:10, Georg Bauhaus <rm-host.bauh...@maps.futureapps.de>
wrote:
> On 3/4/11 7:56 PM, Hacid wrote:
>
> > I understand why I can't define my type limited in the public part and
> > not limited in the private part. But is there a way to do what I
> > want ?
>
> > Something like :
>
> > package Foo is
>
> > type Object is tagged private;
>
> > function ":=" (Left : out Object,; Right : in Object) is abstract;
> > -- I know this looks strange
>
> > end Foo;
>
> Maybe something along these lines?
>
> package Foo_3 is
>
> type Object is tagged limited private;
>
> private
>
> type Wrapped is record
> null; -- ...
> end record;
>
> procedure Copy_Constructor
> (Source : in Object;
> Target : out Object );
>
> type Object is tagged limited
> record
> Data : Wrapped;
> end record;
>
> end Foo_3;
>
> package body Foo_3 is
>
> procedure Copy_Constructor
> (Source : in Object;
> Target : out Object )
> is
> begin
> Target.Data := Source.Data;
> end Copy_Constructor;
>
> end Foo_3;
This solution works but if I extend my package with some addons, I am
blocked :
generic
type Element is new Object with private;
package Foo_3.Pools is
type Pool is limited private;
-- Some services
procedure Copy (From : in Pool; To : out Pool);
private
type Pool is array (1 .. 1_000) of Element;
end Foo_3.Pools;
--
package body Foo_3.Pools is
procedure Copy (From : in Pool; To : out Pool) is
begin
for I in To'Range loop
Copy (From => From (I), To => To (I));
-- This call copy just a part of Element !!!
end loop;
end Copy;
end Foo_3.Pools;
Do you see how to resolve this second problem ?
Thanks.
next prev parent reply other threads:[~2011-03-04 21:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 18:56 limited /non-limited tagged type Hacid
2011-03-04 19:54 ` Edward Fish
2011-03-04 21:18 ` Hacid
2011-03-05 0:17 ` Edward Fish
2011-03-04 20:10 ` Georg Bauhaus
2011-03-04 21:55 ` Hacid [this message]
2011-03-04 22:21 ` Hacid
2011-03-05 1:20 ` Randy Brukardt
2011-03-04 22:22 ` Georg Bauhaus
2011-03-04 22:40 ` Hacid
2011-03-05 1:29 ` Georg Bauhaus
2011-03-04 23:34 ` Adam Beneschan
2011-03-05 3:26 ` Adam Beneschan
2011-03-05 16:48 ` Hacid
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox