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 11:26:19 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Persistence of limited tagged types Date: 07 Apr 2003 14:11:25 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1049739967 12227 128.183.235.92 (7 Apr 2003 18:26:07 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 7 Apr 2003 18:26:07 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:35969 Date: 2003-04-07T18:26:07+00:00 List-Id: 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. -- -- Stephe