comp.lang.ada
 help / color / mirror / Atom feed
From: Victor Porton <porton@narod.ru>
Subject: Re: On packages hierarchy
Date: Tue, 29 Jul 2014 15:36:58 +0300
Date: 2014-07-29T15:36:58+03:00	[thread overview]
Message-ID: <lr84h7$j2k$1@speranza.aioe.org> (raw)
In-Reply-To: fZABv.52877$nx3.32319@fx29.iad

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


  reply	other threads:[~2014-07-29 12:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-28 13:41 On packages hierarchy Victor Porton
2014-07-28 16:03 ` Shark8
2014-07-28 16:35   ` Victor Porton
2014-07-28 23:24     ` Shark8
2014-07-29 12:36       ` Victor Porton [this message]
2014-07-29 18:44         ` Shark8
2014-07-29 19:42           ` Simon Wright
2014-07-29 21:26             ` Shark8
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox