From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6eac62e4f2badf3a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-07 13:23:01 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.ems.psu.edu!news.aset.psu.edu!not-for-mail From: Robert Spooner Newsgroups: comp.lang.ada Subject: Re: Persistence of limited tagged types Date: Mon, 07 Apr 2003 16:17:46 -0400 Organization: Penn State University, Center for Academic Computing Message-ID: <3E91DCEA.5030006@psu.edu> References: NNTP-Posting-Host: nat3.arl.psu.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: f04n12.cac.psu.edu 1049746666 29062 146.186.165.37 (7 Apr 2003 20:17:46 GMT) X-Complaints-To: usenet@f04n12.cac.psu.edu NNTP-Posting-Date: Mon, 7 Apr 2003 20:17:46 +0000 (UTC) To: Stephen Leake User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en,de,fr-FR Xref: archiver1.google.com comp.lang.ada:35973 Date: 2003-04-07T16:17:46-04:00 List-Id: Stephen Leake wrote: > Jano 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