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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Re: On packages hierarchy Date: Tue, 29 Jul 2014 15:36:58 +0300 Organization: Aioe.org NNTP Server Message-ID: References: <4vuBv.121143$pu5.79212@fx27.iad> NNTP-Posting-Host: rFX7cZOSaeuGGZI2vwQTaQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.12.4 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:21336 Date: 2014-07-29T15:36:58+03:00 List-Id: Shark8 wrote: > On 28-Jul-14 10:35, Victor Porton wrote: >>> Why not just have a single stream type? >> I want to make an interface to streams of Raptor C library. >> >> Because, as you say, we are to have a single stream type, this type >> should be well-interfaces with that "single" Ada stream class. >> >>> >Moreover, Ada's root-stream is abstract, so you can't have objects of >>> >that type. >> Well, I mean object of Root_Stream_Type'Class. > > Again, why? > Your Raptor-stream type /will/ be an concrete-instance of > Root_stream_type, and a member of its class, won't it? I mean unless I'm > completely misunderstanding you... My raptor stream is derived from some my base class. Due no multiple type inheritance in Ada, it cannot be also derived from Root_Stream_Type. So I need a wrapper type. > Use Ada.Streams; > Type Dave is new Root_Stream_Type with null record; > > > overriding procedure Read > (Stream : in out Dave; > Item : out Stream_Element_Array; > Last : out Stream_Element_Offset); > > > procedure Write > (Stream : in out Dave; > Item : Stream_Element_Array); > > ---- Implementation: > > overriding procedure Read > (Stream : in out Dave; > Item : out Stream_Element_Array; > Last : out Stream_Element_Offset) > is null; -- Replace this with actual implementation. > > overriding procedure Write > (Stream : in out Dave; > Item : Stream_Element_Array) > is null; -- Replace this with actual implementation. > > Perhaps reading the first and second posts on this thread will help you > understand: > > http://computer-programming-forum.com/44-ada/07c6cd94dbb2d6b1.htm -- Victor Porton - http://portonvictor.org