Re: [BLACKBOX] Storing an extended object

From: [at]} <Robert>
Date: Tue, 11 Nov 2008 18:13:15 +0000

----boundary-LibPST-iamunique-121049330_-_-
Content-type: text/plain

Doug

1 -
In your Base type declare a NEW EMPTY PROCEDURE Externalize2-.
Call it in your Externalize PROCEDURE.

In your extended type implement Externalize2 for the additional fields.

If further extensions are possible, ectend the chain to Externalize3- etc.


2 - For extensive examples of this technique look at Escher, eg Escher.EdgeFigures.

3 - YES - DO store a version byte - it will get you out of trouble every time.

Cheers

Robert


PS: Using 'Super' calls is 'Deprecated' "because of the so-called semantic
fragile base class problem" - See the 'Whats New' Docu. I don't understand any
of this, but just trust the computer scientists to have got it right!


Douglas G. Danforth wrote:
> I am not quite sure how to implement the Externalize and Internalize
> procedures
> for objects that are an extension of a base type. If I write an
> Externalize procedure
> (one for the base and one for the extension) then BB complains. So must
> I do something
> like the following?
>
> TYPE
> Base = POINTER TO EXTENSIBLE RECORD(Stores.Store)
> data: INTEGER
> END;
> Sub = POINTER TO RECORD(Base)
> moreData: INTEGER;
> END;
>
> PROCEDURE (base: Base) Externalize- (VAR wr: Stores.Writer);
> BEGIN
> wr.WriteInt(base.data);
> WITH base: Sub DO
> wr.WriteInt(base.moreData);
> ELSE
> END
> END Externalize;
>
> But now when I internalize what must I do?
>
> This seems cumbersome and not very elegant.
> -Doug Danforth
>
>
> ----
> To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
> LISTSERV{([at]})nowhere.xy
>
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.175 / Virus Database: 270.9.1/1781 - Release Date: 11/11/2008 08:59
>


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-121049330_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZm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cg0K
PiBWZXJzaW9uOiA4LjAuMTc1IC8gVmlydXMgRGF0YWJhc2U6IDI3MC45LjEvMTc4MSAtIFJlbGVh
c2UgRGF0ZTogMTEvMTEvMjAwOCAwODo1OVxwYXINCj4gXHBhcg0KXHBhcg0KXHBhcg0KLS0tLVxw
YXINClRvIHVuc3Vic2NyaWJlLCBzZW5kIGEgbWVzc2FnZSB3aXRoIGJvZHkgIlNJR05PRkYgQkxB
Q0tCT1giIHRvIExJU1RTRVJWQExJU1RTLk9CfX0AY3JpYmU6IDxtYWk=
----boundary-LibPST-iamunique-121049330_-_---
Received on Tue Nov 11 2008 - 19:13:15 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:51 UTC