comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Spooner <rls19@psu.edu>
To: Stephen Leake <Stephen.A.Leake@nasa.gov>
Subject: Re: Persistence of limited tagged types
Date: Mon, 07 Apr 2003 16:17:46 -0400
Date: 2003-04-07T16:17:46-04:00	[thread overview]
Message-ID: <3E91DCEA.5030006@psu.edu> (raw)
In-Reply-To: ullymi3ea.fsf@nasa.gov

Stephen Leake wrote:
> Jano <nono@celes.unizar.es> writes:
> 
> 
>>Hello,
>>
>>I've read several past threads about this, but to reassure me I want to 
>>bring it back again, or at least to know the typical workaround.
>>
>>I have a heterogeneous collection by means of class wide access types, 
>>where the accessed types itself are descendants of a 
>>
>>type Object is abstract tagged limited private;
>>
>>These objects are kind of state-dependent, and I have an abstract method 
>>which serializes an Object to disk. So far, so good.
>>
>>The problem comes when I want to reconstruct the collection from disk. I 
>>can't think of a mean to obtain a valid allocated pointer initialized 
>>with some dispatching call.
>>
>>A neat solution could be a function that returned an allocated pointer 
>>given a tag, but AFAIK there is not such a function.
> 
> 
> The external representation of the type needs to be significantly
> different than the internal representation. In particular, the
> external representation needs to have a "readable" representation of
> the tag.
> 
> You will have to write a function that reads the external
> representation of the tag, allocates an object of the appropriate
> type, and returns the pointer. Yes, this function must be changed
> every time you add a new tag.
> 

I think that if you use 'output to put the object onto the disk, it will 
put the external representation of the tag out with it. Then if you use 
'imput to read it back in as an object of type Object'class you will get 
what you're looking for.

Bob
-- 
                             Robert L. Spooner
                      Registered Professional Engineer
                        Associate Research Engineer
                   Intelligent Control Systems Department

          Applied Research Laboratory        Phone: (814) 863-4120
          The Pennsylvania State University  FAX:   (814) 863-7841
          P. O. Box 30
          State College, PA 16804-0030       rls19@psu.edu




  parent reply	other threads:[~2003-04-07 20:17 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
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 [this message]
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