comp.lang.ada
 help / color / mirror / Atom feed
From: Marius Amado-Alves <marius@amado-alves.info>
To: comp.lang.ada@ada-france.org
Subject: Re: Actual stream of a certain type
Date: Thu, 27 Jul 2006 01:25:04 +0100
Date: 2006-07-27T02:25:23+02:00	[thread overview]
Message-ID: <mailman.3.1153959919.32700.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <71E9A504-B016-49E2-AB85-34CCDF0AEEC8@amado-alves.info>

Ok, here it goes. Of all idioms I tried maybe the least unsuccessful  
(?) ones are those that raise Program_Error with message  
"accessibility check failed" (GNAT) for line marked HERE below. The  
problem here is: how to use the stream visible on that line, as the  
good T_Stream object he is, pass it as a variable, etc? Thanks a  
great lot.

    type T_Stream_Class_Access is access all T_Stream'Class;

    procedure Write_T
      (Stream : T_Stream_Class_Access;
       Item : in T) is
    begin
       Foobar (Stream.all, Item);
    end;

    procedure Write
      (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
       Item : in T) is
    begin
       if Stream.all not in T_Stream'Class then
          raise Actual_Stream_Must_Be_A_T_Stream;
       else
          Write_T (T_Stream_Class_Access (Stream), Item); -- <== HERE
       end if;
    end;





  parent reply	other threads:[~2006-07-27  0:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-26 17:27 Actual stream of a certain type Marius Amado-Alves
2006-07-26 18:25 ` tmoran
2006-07-26 23:47   ` Marius Amado-Alves
2006-07-27  8:05     ` Dmitry A. Kazakov
2006-07-27  8:45       ` Marius Amado-Alves
     [not found]       ` <2AA0FC04-5130-42BF-A6C9-03C3D6F4C642@amado-alves.info>
2006-07-27 10:47         ` Marius Amado-Alves
     [not found]   ` <71E9A504-B016-49E2-AB85-34CCDF0AEEC8@amado-alves.info>
2006-07-27  0:25     ` Marius Amado-Alves [this message]
     [not found] <03AF72A2-6759-4DE5-9D52-4E8266C19C43@amado-alves.info>
2006-07-26 18:04 ` Marius Amado-Alves
replies disabled

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