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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7876e4356325725b X-Google-Attributes: gid103376,public From: Steve Quinlan Subject: Re: Ada.Streams examples Date: 1999/03/10 Message-ID: <36E68CF9.6E48A77B@nospam.lmco.com>#1/1 X-Deja-AN: 453414608 Content-Transfer-Encoding: 7bit References: <36e61db4.50430543@news.pacbell.net> Content-Type: text/plain; charset=us-ascii Organization: Lockheed-Martin Air Traffic Management Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-03-10T00:00:00+00:00 List-Id: Tom Moran wrote: > Could someone please point me to a text or tutorial or something on > using Ada.Streams - in particular overriding the default 'Read etc. If you're asking the mechanics of how to accomplish the override (vs. how to implement it), the general concept is you define a subprogram something like this for type foo; procedure Foo_Write ( Stream access Root_Stream_Type'class; Item in Foo) is --- code here end Foo_Write; for Foo'Write use Foo_Write; As far as what to put into Foo_Write, you can do whatever you like -- implement it using the stream attributes of components of Foo, re-ordering them or adding things or whatever. You could also define your own way to convert Foo into an array of Stream Elements, and update the Stream using the overriden Write procedure from Ada.Streams, which given an array of stream elements will write it to the stream (and similarly for reading Foo). There is a limited example of this in the Barnes book 'Programming in Ada95'.