comp.lang.ada
 help / color / mirror / Atom feed
From: mheaney@on2.com (Matthew Heaney)
Subject: Re: Persistence of limited tagged types
Date: 9 Apr 2003 18:12:18 -0700
Date: 2003-04-10T01:12:18+00:00	[thread overview]
Message-ID: <1ec946d1.0304091712.65224f9@posting.google.com> (raw)
In-Reply-To: oprm9kpdkkbqmqul@news.cis.dfn.de

Nick Roberts <nickroberts@blueyonder.co.uk> wrote in message news:<oprm9kpdkkbqmqul@news.cis.dfn.de>...
> 
> If you really intend to be serialising limited types, I suspect that (both 
> theoretically and practically) you need to have intermediate non-limited 
> types to help you. Serialisation of a limited type will then involve: 
> conversion to and from a suitable non-limited type; serialisation of the 
> non-limited type.

All types ultimately comprise primitive scalar types (as integer,
float, etc) and simple composite types (string, etc), so yes there
will be non-limited types involved.

What you'll probably have to do is "default construct" an instance,
and then call read as a post-initialization step, e.g.

function Input (Stream : access Root_Stream_Type'Class)
  return T_Class_Access is

  Key : constant String := String'Input (Stream);

  I : constant Iterator := Find (Map, Key);

  Factory : constant Factory_Type := Element (I);
begin
  return Factory (Stream);
end;

The factory for T would look something like:

function New_T (Stream : access Root_Stream_Type'Class)
  return T_Class_Access is

  O : constant T_Access := new T; --default value
begin
  Read (Stream, O.all);  --post-initialization
  return T_Class_Access (O);
end;



  parent reply	other threads:[~2003-04-10  1:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-07 12:47 Persistence of limited tagged types Jano
2003-04-07 14:47 ` Nick Roberts
2003-04-09 10:05   ` Nick Roberts
2003-04-10  3:32     ` tmoran
2003-04-09 23:09   ` Matthew Heaney
2003-04-10 14:40     ` Nick Roberts
2003-04-10 23:37       ` Robert A Duff
2003-04-11 16:39         ` Nick Roberts
2003-04-10 18:49     ` Randy Brukardt
2003-04-10  1:12   ` Matthew Heaney [this message]
2003-04-07 18:11 ` Stephen Leake
2003-04-07 19:07   ` Hyman Rosen
2003-04-07 22:09     ` Jano
2003-04-08 13:58       ` Matthew Heaney
2003-04-10 11:41         ` Julio Cano
2003-04-10 19:14           ` Jano
2003-04-11 12:54             ` Julio Cano
2003-04-07 20:17   ` Robert Spooner
2003-04-07 21:14     ` Stephen Leake
2003-04-08 12:56       ` Robert Spooner
2003-04-08 13:41         ` Jano
replies disabled

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